Behavior.st
author Stefan Vogel <sv@exept.de>
Tue, 28 Apr 2020 16:22:26 +0200
changeset 25375 b784fc06a5eb
parent 25033 8e8e038e486e
permissions -rw-r--r--
#REFACTORING by stefan class: KeyedCollection class added: #newWithCapacity:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25033
8e8e038e486e #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24921
diff changeset
     1
"{ Encoding: utf8 }"
8e8e038e486e #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24921
diff changeset
     2
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     3
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1988 by Claus Gittinger
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
     5
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
"
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
    14
"{ Package: 'stx:libbasic' }"
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
    15
17295
ef2cff0e1dca class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17237
diff changeset
    16
"{ NameSpace: Smalltalk }"
ef2cff0e1dca class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17237
diff changeset
    17
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
Object subclass:#Behavior
20024
13ac22ebb436 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19943
diff changeset
    19
	instanceVariableNames:'superclass flags methodDictionary lookupCache lookupObject
13ac22ebb436 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19943
diff changeset
    20
		instSize'
16268
b24e511fbc3d class: Behavior
Stefan Vogel <sv@exept.de>
parents: 16050
diff changeset
    21
	classVariableNames:''
b24e511fbc3d class: Behavior
Stefan Vogel <sv@exept.de>
parents: 16050
diff changeset
    22
	poolDictionaries:''
b24e511fbc3d class: Behavior
Stefan Vogel <sv@exept.de>
parents: 16050
diff changeset
    23
	category:'Kernel-Classes'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    24
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    25
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
    26
!Behavior class methodsFor:'documentation'!
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    27
88
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    28
copyright
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    29
"
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    30
 COPYRIGHT (c) 1988 by Claus Gittinger
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
    31
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    32
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    33
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    34
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    36
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    37
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    38
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    39
"
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    40
!
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    41
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    42
documentation
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    43
"
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    44
    Every class in the system inherits from Behavior (via Class, ClassDescription);
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    45
    so here is where most of the class messages end up being implemented.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    46
    (to answer a FAQ: 'Point basicNew' will be done here :-)
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    47
356
claus
parents: 345
diff changeset
    48
    Beginners should keep in mind, that all classes are instances (of subclasses)
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
    49
    of Behavior, therefore you will find the above mentioned 'basicNew:' method
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
    50
    under the 'instance'-methods of Behavior - NOT under the class methods
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
    51
    ('Behavior new' will create and return a new class, while sending 'new' to
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
    52
    any instance of Behavior (i.e. any class) will return an instance of that class).
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    53
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    54
19833
2c27676f3588 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19822
diff changeset
    55
    Behavior provides minimum support for all class-like objects, which define behavior
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    56
    of other objects. Additional stuff (meta info) is found in ClassDescription and Class.
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    57
    Behavior provides all mechanisms needed to create instances (on the class side),
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    58
    and send messages to them.
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    59
    However, Behavior does not provide the (symbolic) information needed to compile methods
19833
2c27676f3588 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19822
diff changeset
    60
    for a class or to get useful information in inspectors or browsers.
2c27676f3588 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19822
diff changeset
    61
2c27676f3588 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19822
diff changeset
    62
    For experts:
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    63
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    64
    Since instances of Behavior provide all that is needed to interact with the VM's
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    65
    message dispatch mechanism, these can be used as 'light weight' classes.
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    66
    I.e. it is possible, to generate completely anonymous classes (and instances thereof)
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    67
    on the fly - 'Behavior new new' is such a thingy.
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    68
17126
f2bd6126991d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16848
diff changeset
    69
    The selectors and methods are organized in a MethodDictionary (which is not a true
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    70
    dictionary, but an Array with alternating selector/method entries).
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    71
    This avoids the need for knowledge about Dictionaries in the runtime library (VM)
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
    72
    (lookup and search in these is seldom anyway, so the added benefit from using a
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    73
     hashed dictionary is almost void).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    74
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    75
    [Instance variables:]
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    76
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    77
	superclass        <Class>            the classes superclass
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    78
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    79
	methodDictionary  <MethodDictionary> inst-selectors and methods
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    80
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    81
	instSize          <SmallInteger>     the number of instance variables
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    82
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    83
	flags             <SmallInteger>     special flag bits coded in a number
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    84
					     not for application use
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    85
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
    86
    flag bits (see stc.h):
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    87
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    88
    NOTICE: layout known by compiler and runtime system; be careful when changing
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    89
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1285
diff changeset
    90
    [author:]
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    91
	Claus Gittinger
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1285
diff changeset
    92
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    93
    [see also:]
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    94
	Class ClassDescription Metaclass
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
    95
	Method MethodDictionary
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    96
"
356
claus
parents: 345
diff changeset
    97
!
claus
parents: 345
diff changeset
    98
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
    99
virtualMachineRelationship
356
claus
parents: 345
diff changeset
   100
"
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   101
    Expert info follows:
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   102
    --------------------
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   103
    NOTICE:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   104
	the stuff described below may not be available on other
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   105
	Smalltalk implementations; be aware that these error mechanisms
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   106
	are ST/X specials and applications using these (tricks) may
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   107
	not be portable to other systems.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   108
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   109
    WARNING:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   110
	do not try the examples below on (some) other smalltalk systems;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   111
	it has been reported, that some crash badly when doing this .... ;-)
357
claus
parents: 356
diff changeset
   112
356
claus
parents: 345
diff changeset
   113
    Instances of Behavior and subclasses (i.e. in sloppy words: classes)
claus
parents: 345
diff changeset
   114
    play a special role w.r.t. the VM. Only objects whose class-slot is marked
claus
parents: 345
diff changeset
   115
    as being behaviorLike (in the flag-instvar) are considered to be classLike
claus
parents: 345
diff changeset
   116
    and a message lookup will be done for it in the well known way.
claus
parents: 345
diff changeset
   117
    Thus, if an object has a class for which its class does NOT have
362
claus
parents: 360
diff changeset
   118
    this flag bit set, the VM will trigger an error on a message send.
356
claus
parents: 345
diff changeset
   119
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   120
356
claus
parents: 345
diff changeset
   121
    Why is this so:
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   122
    ---------------
356
claus
parents: 345
diff changeset
   123
    the above lets every object play the role of a class,
claus
parents: 345
diff changeset
   124
    which has been flagged as behaviorLike in its class's flag.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   125
    Thus, you can create arbitrary new classLike objects and have the VM
356
claus
parents: 345
diff changeset
   126
    play with them.
claus
parents: 345
diff changeset
   127
    This may offer the flexibility to create a totally different object scheme
362
claus
parents: 360
diff changeset
   128
    on top of ST/X (for example: Self like objects) where any object can play
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   129
    a classRole for another object or even for itself.
356
claus
parents: 345
diff changeset
   130
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   131
    [A concrete application of this is found in the Structure class,
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   132
     which creates objects which are their own class !!
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   133
     This may look to be of theoretical value at first sight,
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   134
     however, such a construct saves memory, by not requiring an extra
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   135
     class object per Structure object.]
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   136
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   137
    Be aware, that the VM trusts the isBehaviorLike flag - IF it is set for some
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   138
    object, the VM EXPECTS the object selector and methodDictionaries to be found
362
claus
parents: 360
diff changeset
   139
    at the instance positions as defined here.
claus
parents: 360
diff changeset
   140
    (i.e. instanceVariables with contents and semantic corresponding to
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   141
	superclass
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   142
	flags
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   143
	methodDictionary
362
claus
parents: 360
diff changeset
   144
     must be present and have the same instVar-index as here).
claus
parents: 360
diff changeset
   145
356
claus
parents: 345
diff changeset
   146
    The VM (and the system) may crash badly, if this is not the case.
362
claus
parents: 360
diff changeset
   147
356
claus
parents: 345
diff changeset
   148
    Since every class in the system derives from Behavior, the flag setting
357
claus
parents: 356
diff changeset
   149
    (and instance variable layout) is correct for all 'normal' classes.
claus
parents: 356
diff changeset
   150
    If you experiment by creating new behaviorLike objects, please take
claus
parents: 356
diff changeset
   151
    care of this flag. If you want to use the VM's lookup function, the
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   152
    instVars  'superclass' and 'methodDictionary' are required
357
claus
parents: 356
diff changeset
   153
    and have to be at the same instVar index.
362
claus
parents: 360
diff changeset
   154
    (we suggest, you subclass Behavior, to make certain)
357
claus
parents: 356
diff changeset
   155
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   156
8503
e8e0bff4c813 typo in comment
Stefan Vogel <sv@exept.de>
parents: 8398
diff changeset
   157
    Vice versa, defining 'dumb classes', which have the behaviorLike bit turned
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   158
    off may be useful as well; if a message is sent to an instance of such
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   159
    a thingy, the VM performs a recovery sequence, which is much like the
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   160
    #doesNotUnderstand: mechanism - however, since the instance is no good
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   161
    receiver of such a message, a #cannotSendMessage:to: is now sent to the
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   162
    class (which is not a real class), passing the original message (selector
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   163
    and arguments) along with the original receiver.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   164
    The default behavior for this message is to raise an internalError signal -
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   165
    however, you may redefine this in your 'dum class' for recovery.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   166
    One possible use of this is to provide new message send algorithms - the
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   167
    class may lookup a method and invoke it directly, via the #valueWithReceiver:
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   168
    interface.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   169
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   170
    All of the above is pure expert stuff
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   171
    - You do not have to care about the above details if you are a 'normal'
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   172
    ST-programmer, though (and even most of those will never use these features).
357
claus
parents: 356
diff changeset
   173
356
claus
parents: 345
diff changeset
   174
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   175
    Examples (only of theoretical interest):
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   176
    ----------------------------------------
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   177
	take away the behaviorLike-flag from a class.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   178
	-> The instances will not understand any messages, since the VM will
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   179
	   not recognize its class as being a class ...
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   180
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   181
	|newMeta notRecognizedAsClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   182
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   183
	newMeta := Metaclass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   184
	newMeta flags:0.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   185
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   186
	notRecognizedAsClass := newMeta new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   187
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   188
	someInstance := notRecognizedAsClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   189
	someInstance perform:#isNil
356
claus
parents: 345
diff changeset
   190
357
claus
parents: 356
diff changeset
   191
claus
parents: 356
diff changeset
   192
    Of course, this is an exception which can be handled ...:
claus
parents: 356
diff changeset
   193
    Example:
claus
parents: 356
diff changeset
   194
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   195
	|newMeta notRecognizedAsClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   196
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   197
	newMeta := Metaclass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   198
	newMeta flags:0.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   199
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   200
	notRecognizedAsClass := newMeta new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   201
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   202
	someInstance := notRecognizedAsClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   203
	Object errorSignal handle:[:ex |
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   204
	    ex return
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   205
	] do:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   206
	    someInstance perform:#isNil
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   207
	]
357
claus
parents: 356
diff changeset
   208
claus
parents: 356
diff changeset
   209
claus
parents: 356
diff changeset
   210
    likewise, a doesNotUnderstand-notUnderstood can be handled:
claus
parents: 356
diff changeset
   211
    Example:
claus
parents: 356
diff changeset
   212
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   213
	|newMeta funnyClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   214
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   215
	newMeta := Metaclass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   216
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   217
	funnyClass := newMeta new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   218
	funnyClass setSuperclass:nil.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   219
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   220
	someInstance := funnyClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   221
	Object errorSignal handle:[:ex |
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   222
	     ex return
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   223
	] do:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   224
	    someInstance perform:#isNil
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   225
	]
357
claus
parents: 356
diff changeset
   226
claus
parents: 356
diff changeset
   227
362
claus
parents: 360
diff changeset
   228
    more examples, which try to trick the VM ;-):
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   229
	badly playing around with a classes internals ...
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   230
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   231
	|newClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   232
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   233
	newClass := Class new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   234
	newClass setSuperclass:nil.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   235
	someInstance := newClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   236
	someInstance inspect
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   237
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   238
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   239
	|newClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   240
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   241
	newClass := Class new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   242
	newClass setSuperclass:newClass.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   243
	someInstance := newClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   244
	someInstance inspect
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   245
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   246
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   247
	|newClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   248
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   249
	newClass := Class new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   250
	newClass setSuperclass:1.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   251
	someInstance := newClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   252
	someInstance inspect
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   253
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   254
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   255
    Example:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   256
	creating totally anonymous classes:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   257
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   258
	|newClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   259
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   260
	newClass := Class new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   261
	someInstance := newClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   262
	someInstance inspect
357
claus
parents: 356
diff changeset
   263
claus
parents: 356
diff changeset
   264
356
claus
parents: 345
diff changeset
   265
    Example:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   266
	creating totally anonymous metaclasses:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   267
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   268
	|newMeta newClass someInstance|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   269
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   270
	newMeta := Metaclass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   271
	newClass := newMeta new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   272
	someInstance := newClass new.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   273
	someInstance inspect
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   274
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   275
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   276
    PS: if you experiment with new behaviorLike objects, you may want
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   277
	to turn off the VM's debugPrintouts
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   278
	with:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   279
		'Smalltalk debugPrinting:false'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   280
	and:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   281
		'Smalltalk infoPrinting:false'
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   282
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   283
    Meta-Object-Protocol support:
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   284
    -----------------------------
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   285
    the above tricks do not affect the inline caches, and are therefore somewhat slow.
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   286
    Another hook is the lookupObject which, if non-nil, is consulted to do the lookup
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   287
    instead of the hardwired VM lookup algorithm, and provide a method as return value.
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   288
    This method (if non-nil) will be put into the inline-and polymorph caches for speedy
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   289
    call the next time. If non-nil, the lookup object is sent the:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   290
	    lookupMethodForSelector:aSelector
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   291
	    directedTo:searchClass
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   292
	    for:aReceiver
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   293
	    withArguments:argArrayOrNil
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   294
	    from:sendingContext
12858
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   295
    message.
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   296
    'searchClass' is the object class or any of its superclasses (for directed/super sends).
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   297
    You can return any arbitrary method there - for example to implement multiple inheritance,
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   298
    selector namespace tricks or multi-dispatch on argument types (double dispatch for a method).
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   299
    Be aware, that the returned method is cached, and the lookup is not consulted again for the
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   300
    same receiver/callsite combination. So the returned method should check if it's ok to be called
695cbd35ce8a changed: #virtualMachineRelationship
Claus Gittinger <cg@exept.de>
parents: 12855
diff changeset
   301
    again (maybe, a synthetic method is generated and returned).
356
claus
parents: 345
diff changeset
   302
"
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
   303
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   304
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   305
!Behavior class methodsFor:'creating new classes'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   306
a27a279701f8 Initial revision
claus
parents:
diff changeset
   307
new
356
claus
parents: 345
diff changeset
   308
    "creates and return a new behavior (which is like a class,
claus
parents: 345
diff changeset
   309
     but without the symbolic & name information).
claus
parents: 345
diff changeset
   310
     Not for normal applications.
claus
parents: 345
diff changeset
   311
     Sending the returned behavior the #new message gives you
claus
parents: 345
diff changeset
   312
     an instance if it.
claus
parents: 345
diff changeset
   313
claus
parents: 345
diff changeset
   314
     Notice: the returned class is given a superclass of Object;
claus
parents: 345
diff changeset
   315
     this allows for its new instances to be inspected and the like."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   316
a27a279701f8 Initial revision
claus
parents:
diff changeset
   317
    |newClass|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   318
a27a279701f8 Initial revision
claus
parents:
diff changeset
   319
    newClass := self basicNew.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   320
    newClass
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   321
	setSuperclass:Object
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   322
	methodDictionary:(MethodDictionary new)
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   323
	instSize:0
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   324
	flags:(self flagBehavior).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   325
    ^ newClass
356
claus
parents: 345
diff changeset
   326
claus
parents: 345
diff changeset
   327
    "
claus
parents: 345
diff changeset
   328
     Behavior new               <- a new behavior
claus
parents: 345
diff changeset
   329
     Behavior new new           <- an instance of it
claus
parents: 345
diff changeset
   330
     ClassDescription new       <- a new classDescription
claus
parents: 345
diff changeset
   331
     ClassDescription new new   <- an instance of it
claus
parents: 345
diff changeset
   332
     Class new                  <- a new class
claus
parents: 345
diff changeset
   333
     Class new new              <- an instance of it
claus
parents: 345
diff changeset
   334
     Metaclass new              <- a new metaclass
claus
parents: 345
diff changeset
   335
     Metaclass new new          <- an instance (i.e. a class) of it
claus
parents: 345
diff changeset
   336
     Metaclass new new new      <- an instance of this new class
claus
parents: 345
diff changeset
   337
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   338
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   339
    "Modified: 7.6.1996 / 15:38:58 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   340
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   341
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   342
!Behavior class methodsFor:'flag bit constants'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   343
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   344
flagAlien
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   345
    "Return the flag code for Alien objects for Translucent Object implementation"
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   346
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   347
%{  /* NOCONTEXT */
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   348
    /* this is defined as a primitive to get defines from stc.h */
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   349
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   350
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   351
    return __c__._RETURN( STClass.FLAG_ALIENPOINTERS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   352
#else
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   353
    RETURN ( __mkSmallInteger(ALIENPOINTERS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   354
#endif
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   355
%}
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   356
!
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   357
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   358
flagBehavior
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   359
    "return the flag code which marks Behavior-like instances.
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   360
     Inline C-code and the VM check this single bit in the flag value when
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   361
     checking for behaviors."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   362
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   363
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   364
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   365
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   366
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   367
    return __c__._RETURN( STClass.FLAG_BEHAVIOR_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   368
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   369
    RETURN ( __mkSmallInteger(BEHAVIOR_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   370
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   371
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   372
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   373
    "consistency check:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   374
     all class-entries must be behaviors;
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   375
     all behaviors must be flagged so (in its class's flags)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   376
     (otherwise, VM will bark)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   377
     all non-behaviors may not be flagged
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   378
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   379
     |bit|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   380
     bit := Class flagBehavior.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   381
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   382
     ObjectMemory allObjectsDo:[:o|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   383
       o isBehavior ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   384
	 (o class flags bitTest:bit) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   385
	     self halt
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   386
	 ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   387
       ] ifFalse:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   388
	 (o class flags bitTest:bit) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   389
	     self halt
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   390
	 ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   391
       ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   392
       o class isBehavior ifFalse:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   393
	 self halt
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   394
       ] ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   395
	 (o class class flags bitTest:bit) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   396
	     self halt
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   397
	 ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   398
       ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   399
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   400
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   401
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   402
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   403
flagBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   404
    "return the flag code which marks Block-like instances.
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
   405
     The VM and compiled code check for this bit in the flag
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
   406
     value when checking for blocks to be evaluated from bytecode
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
   407
     or calling the block's code immediately."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   408
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   409
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   410
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   411
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   412
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   413
    return __c__._RETURN( STClass.FLAG_BLOCK_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   414
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   415
    RETURN ( __mkSmallInteger(BLOCK_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   416
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   417
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   418
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   419
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   420
flagBlockContext
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   421
    "return the flag code which marks BlockContext-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   422
     The VM checks this single bit in the flag value when
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   423
     checking for blockContexts."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   424
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   425
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   426
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   427
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   428
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   429
    return __c__._RETURN( STClass.FLAG_BCONTEXT_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   430
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   431
    RETURN ( __mkSmallInteger(BCONTEXT_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   432
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   433
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   434
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   435
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   436
flagBytes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   437
    "return the flag code for byte-valued indexed instances.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   438
     The VM masks the flag value with the indexMask (maskIndexType)
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   439
     and compares it to this flag value, when checking for byte valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   440
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   441
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   442
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   443
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   444
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   445
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   446
    return __c__._RETURN( STClass.FLAG_BYTEARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   447
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   448
    RETURN ( __mkSmallInteger(BYTEARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   449
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   450
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   451
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   452
     Behavior flagBytes
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   453
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   454
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   455
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   456
flagContext
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   457
    "return the flag code which marks Context-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   458
     The VM checks this single bit in the flag value when
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   459
     checking for contexts."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   460
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   461
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   462
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   463
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   464
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   465
    return __c__._RETURN( STClass.FLAG_CONTEXT_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   466
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   467
    RETURN ( __mkSmallInteger(CONTEXT_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   468
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   469
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   470
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   471
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   472
flagDoubles
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   473
    "return the flag code for double-valued indexed instances (i.e. 8-byte reals).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   474
     The VM masks the flag value with the indexMask (maskIndexType)
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   475
     and compares it to this flag value, when checking for double valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   476
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   477
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   478
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   479
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   480
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   481
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   482
    return __c__._RETURN( STClass.FLAG_DOUBLEARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   483
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   484
    RETURN ( __mkSmallInteger(DOUBLEARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   485
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   486
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   487
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   488
     Behavior flagDoubles
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   489
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   490
     (ByteArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   491
     (DoubleArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   492
     (Object flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   493
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   494
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   495
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   496
flagExternalBytes
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   497
    "return the flag code which marks ExternalBytes-like instances.
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   498
     Inline C-code and the VM check this single bit in the flag value when
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   499
     checking for an externalBytes-like objet."
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   500
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   501
%{  /* NOCONTEXT */
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   502
    /* this is defined as a primitive to get defines from stc.h */
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   503
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   504
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   505
    return __c__._RETURN( STClass.FLAG_EXTERNALBYTES_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   506
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   507
    RETURN ( __mkSmallInteger(EXTERNALBYTES_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   508
#endif
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   509
%}
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   510
!
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   511
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   512
flagFloat
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   513
    "return the flag code which marks Float-like instances.
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   514
     Inline C-code and the VM check this single bit in the flag value when
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   515
     checking for a float."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   516
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   517
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   518
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   519
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   520
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   521
    return __c__._RETURN( STClass.FLAG_FLOAT_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   522
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   523
    RETURN ( __mkSmallInteger(FLOAT_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   524
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   525
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   526
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   527
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   528
flagFloats
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   529
    "return the flag code for float-valued indexed instances (i.e. 4-byte reals).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   530
     The VM masks the flag value with the indexMask (maskIndexType)
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   531
     and compares it to this flag value, when checking for double valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   532
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   533
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   534
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   535
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   536
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   537
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   538
    return __c__._RETURN( STClass.FLAG_FLOATARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   539
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   540
    RETURN ( __mkSmallInteger(FLOATARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   541
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   542
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   543
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   544
     Behavior flagFloats
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   545
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   546
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   547
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   548
flagForSymbolic:aSymbol
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   549
    "return the flag code for indexed instances with aSymbolic type.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   550
     The argument may be one of
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   551
        #float, #double,
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   552
        #word, #signedWord,
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   553
        #long, #signedLong
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   554
        #longLong, #signedLongLong,
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   555
        #byte
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   556
        #weakObjects
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   557
     For VW compatibility, also accept:
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   558
        #objects, #bytes, #weak.
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   559
    "
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   560
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   561
%{   /* NOCONTEXT */
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   562
#ifdef __SCHTEAM__
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   563
    if (aSymbol == @symbol(float)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   564
        return __c__._RETURN ( STClass.FLAG_FLOATARRAY );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   565
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   566
    if (aSymbol == @symbol(double)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   567
        return __c__._RETURN ( STClass.FLAG_DOUBLEARRAY );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   568
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   569
    if (aSymbol == @symbol(long)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   570
        return __c__._RETURN ( STClass.FLAG_LONGARRAY );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   571
    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   572
    if (aSymbol == @symbol(longLong)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   573
        return __c__._RETURN ( STClass.FLAG_LONGLONGARRAY );
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   574
    }
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   575
    if (aSymbol == @symbol(word)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   576
        return __c__._RETURN ( STClass.FLAG_WORDARRAY );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   577
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   578
    if (aSymbol == @symbol(signedWord)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   579
        return __c__._RETURN ( STClass.FLAG_SWORDARRAY );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   580
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   581
    if (aSymbol == @symbol(signedLong)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   582
        return __c__._RETURN ( STClass.FLAG_SLONGARRAY );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   583
    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   584
    if (aSymbol == @symbol(signedLongLong)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   585
        return __c__._RETURN ( STClass.FLAG_SLONGLONGARRAY );
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   586
    }
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   587
    if ((aSymbol == @symbol(byte)) || (aSymbol == @symbol(bytes))) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   588
        return __c__._RETURN ( STClass.FLAG_BYTEARRAY );
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   589
    }
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   590
    if ((aSymbol == @symbol(objects))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   591
     || (aSymbol == @symbol(object))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   592
     || (aSymbol == @symbol(pointer))) {
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   593
        return __c__._RETURN ( STClass.FLAG_POINTERARRAY );
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   594
    }
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   595
    if ((aSymbol == @symbol(weakObjects))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   596
     || (aSymbol == @symbol(weakObject))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   597
     || (aSymbol == @symbol(weak))) {
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   598
        return __c__._RETURN ( STClass.FLAG_WKPOINTERARRAY );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   599
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   600
#else
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   601
    if (aSymbol == @symbol(float)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   602
        RETURN ( __mkSmallInteger(FLOATARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   603
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   604
    if (aSymbol == @symbol(double)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   605
        RETURN ( __mkSmallInteger(DOUBLEARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   606
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   607
    if (aSymbol == @symbol(long)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   608
        RETURN ( __mkSmallInteger(LONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   609
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   610
    if (aSymbol == @symbol(longLong)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   611
        RETURN ( __mkSmallInteger(LONGLONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   612
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   613
    if (aSymbol == @symbol(word)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   614
        RETURN ( __mkSmallInteger(WORDARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   615
    }
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   616
    if (aSymbol == @symbol(signedWord)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   617
        RETURN ( __mkSmallInteger(SWORDARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   618
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   619
    if (aSymbol == @symbol(signedLong)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   620
        RETURN ( __mkSmallInteger(SLONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   621
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   622
    if (aSymbol == @symbol(signedLongLong)) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   623
        RETURN ( __mkSmallInteger(SLONGLONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   624
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   625
    if ((aSymbol == @symbol(byte)) || (aSymbol == @symbol(bytes))) {
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   626
        RETURN ( __mkSmallInteger(BYTEARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   627
    }
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   628
    if ((aSymbol == @symbol(objects))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   629
     || (aSymbol == @symbol(object))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   630
     || (aSymbol == @symbol(pointer))) {
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   631
        RETURN ( __mkSmallInteger(POINTERARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   632
    }
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   633
    if ((aSymbol == @symbol(weakObjects))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   634
     || (aSymbol == @symbol(weakObject))
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   635
     || (aSymbol == @symbol(weak))) {
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   636
        RETURN ( __mkSmallInteger(WKPOINTERARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   637
    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   638
#endif
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   639
%}.
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   640
    ^ 0         "/ not indexed
10605
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   641
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   642
    "Modified: / 07-06-2007 / 11:57:44 / cg"
23379
6a77fc46ffeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23278
diff changeset
   643
    "Modified: / 22-09-2018 / 15:39:10 / Claus Gittinger"
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   644
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   645
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   646
flagJavaArray
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   647
    "return the flag code which marks Java array-like instances.
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   648
     The VM checks this single bit in the flag value when
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   649
     checking for a java arrays."
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   650
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   651
%{  /* NOCONTEXT */
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   652
    /* this is defined as a primitive to get defines from stc.h */
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   653
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   654
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   655
    return __c__._RETURN( STClass.FLAG_JARRAY_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   656
#else
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   657
    RETURN ( __mkSmallInteger(JARRAY_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   658
#endif
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   659
%}
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   660
!
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
   661
3141
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   662
flagJavaClass
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   663
    "return the flag code which marks JavaClass-like instances.
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   664
     The VM checks this single bit in the flag value when
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   665
     checking for a javaClass."
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   666
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   667
%{  /* NOCONTEXT */
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   668
    /* this is defined as a primitive to get defines from stc.h */
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   669
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   670
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   671
    return __c__._RETURN( STClass.FLAG_JCLASS_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   672
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   673
    RETURN ( __mkSmallInteger(JCLASS_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   674
#endif
3141
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   675
%}
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   676
!
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   677
2801
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   678
flagJavaMethod
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   679
    "return the flag code which marks JavaMethod-like instances.
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   680
     Inline C-code and the VM check this single bit in the flag value when
2801
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   681
     checking for a method."
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   682
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   683
%{  /* NOCONTEXT */
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   684
    /* this is defined as a primitive to get defines from stc.h */
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   685
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   686
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   687
    return __c__._RETURN( STClass.FLAG_JMETHOD_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   688
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   689
    RETURN ( __mkSmallInteger(JMETHOD_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   690
#endif
2801
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   691
%}
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   692
!
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   693
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   694
flagLongLongs
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   695
    "return the flag code for longlong-valued indexed instances (i.e. 8-byte).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   696
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   697
     and compares it to this flag value, when checking for
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   698
     unsigned long valued variable instances."
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   699
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   700
%{  /* NOCONTEXT */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   701
    /* this is defined as a primitive to get defines from stc.h */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   702
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   703
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   704
    return __c__._RETURN( STClass.FLAG_LONGLONGARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   705
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   706
    RETURN ( __mkSmallInteger(LONGLONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   707
#endif
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   708
%}
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   709
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   710
     Behavior flagLongLongs
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   711
    "
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   712
!
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   713
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   714
flagLongs
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   715
    "return the flag code for long-valued indexed instances (i.e. 4-byte).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   716
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   717
     and compares it to this flag value, when checking for
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   718
     unsigned long valued variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   719
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   720
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   721
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   722
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   723
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   724
    return __c__._RETURN( STClass.FLAG_LONGARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   725
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   726
    RETURN ( __mkSmallInteger(LONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   727
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   728
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   729
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   730
     Behavior flagLongs
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   731
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   732
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   733
5743
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   734
flagMetaMethod
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   735
    "return the flag code which marks MetaMethod-like instances.
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   736
     Inline C-code and the VM check this single bit in the flag value when
5743
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   737
     about to evaluate a method."
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   738
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   739
%{  /* NOCONTEXT */
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   740
    /* this is defined as a primitive to get defines from stc.h */
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   741
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   742
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   743
    return __c__._RETURN( STClass.FLAG_METAMETHOD_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   744
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   745
    RETURN ( __mkSmallInteger(METAMETHOD_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   746
#endif
5743
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   747
%}
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   748
!
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   749
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   750
flagMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   751
    "return the flag code which marks Method-like instances.
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   752
     Inline C-code and the VM check this single bit in the flag value when
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   753
     checking for a method."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   754
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   755
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   756
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   757
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   758
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   759
    return __c__._RETURN( STClass.FLAG_METHOD_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   760
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   761
    RETURN ( __mkSmallInteger(METHOD_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   762
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   763
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   764
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   765
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   766
flagNonObjectInst
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   767
    "return the flag code which marks instances which have a
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   768
     non-object instance variable (in slot 1).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   769
     (these are ignored by the garbage collector)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   770
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   771
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   772
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   773
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   774
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   775
    return __c__._RETURN( STClass.FLAG_NONOBJECT_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   776
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   777
    RETURN ( __mkSmallInteger(NONOBJECT_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   778
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   779
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   780
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   781
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   782
flagNotIndexed
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   783
    "return the flag code for non-indexed instances.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   784
     You have to mask the flag value with indexMask when comparing
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   785
     it with flagNotIndexed."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   786
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   787
    ^ 0
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   788
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   789
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   790
flagPointers
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   791
    "return the flag code for pointer indexed instances (i.e. Array of object).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   792
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   793
     and compares it to this flag value, when checking for
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   794
     pointer variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   795
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   796
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   797
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   798
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   799
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   800
    return __c__._RETURN( STClass.FLAG_POINTERARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   801
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   802
    RETURN ( __mkSmallInteger(POINTERARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   803
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   804
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   805
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   806
     Behavior flagPointers
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   807
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   808
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   809
1383
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   810
flagRegular
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   811
    "return the flag code which marks regular instances."
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   812
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   813
    ^ 0
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   814
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   815
    "Created: 12.5.1996 / 17:53:36 / cg"
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   816
!
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   817
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   818
flagSignedLongLongs
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   819
    "return the flag code for signed longlong-valued indexed instances (i.e. 8-byte).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   820
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   821
     and compares it to this flag value, when checking for
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   822
     signed long valued variable instances."
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   823
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   824
%{  /* NOCONTEXT */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   825
    /* this is defined as a primitive to get defines from stc.h */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   826
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   827
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   828
    return __c__._RETURN( STClass.FLAG_SLONGLONGARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   829
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   830
    RETURN ( __mkSmallInteger(SLONGLONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   831
#endif
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   832
%}
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   833
    "
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   834
     Behavior flagSignedLongLongs
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   835
    "
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   836
!
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   837
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   838
flagSignedLongs
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   839
    "return the flag code for signed long-valued indexed instances (i.e. 4-byte).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   840
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   841
     and compares it to this flag value, when checking for
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   842
     signed long valued variable instances."
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   843
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   844
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   845
    /* this is defined as a primitive to get defines from stc.h */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   846
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   847
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   848
    return __c__._RETURN( STClass.FLAG_SLONGARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   849
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   850
    RETURN ( __mkSmallInteger(SLONGARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   851
#endif
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   852
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   853
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   854
     Behavior flagSignedLongs
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   855
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   856
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   857
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   858
flagSignedWords
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   859
    "return the flag code for signed word-valued indexed instances (i.e. 2-byte).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   860
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   861
     and compares it to this flag value, when checking for
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   862
     signed word valued variable instances."
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   863
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   864
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   865
    /* this is defined as a primitive to get defines from stc.h */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   866
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   867
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   868
    return __c__._RETURN( STClass.FLAG_SWORDARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   869
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   870
    RETURN ( __mkSmallInteger(SWORDARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   871
#endif
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   872
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   873
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   874
     Behavior flagSignedWords
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   875
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   876
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   877
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   878
flagSymbol
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   879
    "return the flag code which marks Symbol-like instances.
7190
2056416250a2 comments
Claus Gittinger <cg@exept.de>
parents: 7162
diff changeset
   880
     Inline C-code and the VM check this single bit in the flag value when
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   881
     checking for symbols."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   882
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   883
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   884
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   885
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   886
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   887
    return __c__._RETURN( STClass.FLAG_SYMBOL_INSTS );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   888
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   889
    RETURN ( __mkSmallInteger(SYMBOL_INSTS) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   890
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   891
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   892
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   893
22362
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   894
flagVarArgBlock
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   895
    "return the flag code which marks varArg Block-like instances
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   896
     with respect to byteCode interpretation & code calling."
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   897
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   898
%{  /* NOCONTEXT */
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   899
    /* this is defined as a primitive to get defines from stc.h */
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   900
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   901
#ifdef __SCHTEAM__
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   902
    return __c__._RETURN( STClass.FLAG_VARARGBLOCK_INSTS );
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   903
#else
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   904
    RETURN ( __mkSmallInteger(VARARGBLOCK_INSTS) );
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   905
#endif
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   906
%}
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   907
!
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
   908
10605
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   909
flagWeak
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   910
    "return the flag code for weak-object-pointer indexed instances.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   911
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   912
     and compares it to this flag value, when checking for
10605
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   913
     weak pointer variable instances."
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   914
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   915
%{  /* NOCONTEXT */
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   916
    /* this is defined as a primitive to get defines from stc.h */
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   917
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   918
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   919
    return __c__._RETURN( STClass.FLAG_WKPOINTERARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   920
#else
10605
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   921
    RETURN ( __mkSmallInteger(WKPOINTERARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   922
#endif
10605
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   923
%}
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   924
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   925
     Behavior flagWeak
10605
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   926
    "
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   927
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   928
    "Created: / 07-06-2007 / 11:59:12 / cg"
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   929
!
afa10df77327 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10535
diff changeset
   930
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   931
flagWeakPointers
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   932
    "return the flag code for weak pointer indexed instances (i.e. WeakArray).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   933
     The VM masks the flag value with the indexMask (maskIndexType)
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   934
     and compares it to this flag value, when checking for weak pointers."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   935
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   936
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   937
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   938
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   939
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   940
    return __c__._RETURN( STClass.FLAG_WKPOINTERARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   941
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   942
    RETURN ( __mkSmallInteger(WKPOINTERARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   943
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   944
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   945
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   946
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   947
flagWords
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   948
    "return the flag code for word-valued indexed instances (i.e. 2-byte).
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   949
     The VM masks the flag value with the indexMask (maskIndexType)
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   950
     and compares it to this flag value, when checking for
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   951
     unsigned word valued variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   952
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   953
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   954
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   955
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   956
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   957
    return __c__._RETURN( STClass.FLAG_WORDARRAY );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   958
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   959
    RETURN ( __mkSmallInteger(WORDARRAY) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   960
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   961
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   962
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
   963
     Behavior flagWords
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   964
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   965
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   966
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   967
maskIndexType
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   968
    "return a mask to extract all index-type bits"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   969
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   970
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   971
    /* this is defined as a primitive to get defines from stc.h */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   972
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   973
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   974
    return __c__._RETURN( STClass.FLAG_ARRAYMASK );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   975
#else
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8910
diff changeset
   976
    RETURN ( __mkSmallInteger(ARRAYMASK) );
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   977
#endif
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   978
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   979
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   980
8962
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
   981
!Behavior class methodsFor:'helpers'!
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
   982
15125
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   983
classesSortedByLoadOrder2:aCollectionOfClasses
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   984
    "return a copy of the given collection of classes, which is sorted
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   985
     by inheritance and superclass-of-any-private class.
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   986
     This is the optimal order for loading, and the required order for compilation.
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   987
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   988
     This is an alternate algorithm showing cycles"
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   989
15230
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
   990
    |orderedTuples|
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
   991
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
   992
    orderedTuples := OrderedCollection new:aCollectionOfClasses size.
15125
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
   993
    aCollectionOfClasses do:[:eachClass|
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   994
	|sharedPools|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   995
	orderedTuples add:(Array with:eachClass with:eachClass superclass).
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   996
	sharedPools := eachClass sharedPools.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   997
	sharedPools notEmptyOrNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   998
	    orderedTuples add:((OrderedCollection with:eachClass) addAll:sharedPools).
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
   999
	].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1000
	eachClass allPrivateClasses do:[:eachPrivateClass| |superClassOwner|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1001
	    superClassOwner := eachPrivateClass superclass.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1002
	    "take care of classes inheriting from nil or ProtoObject"
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1003
	    superClassOwner isBehavior ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1004
		superClassOwner := superClassOwner owningClassOrYourself.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1005
	    ].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1006
	    orderedTuples add:(Array with:eachPrivateClass with:superClassOwner).
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1007
	    sharedPools := eachPrivateClass sharedPools.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1008
	    sharedPools notEmptyOrNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1009
		orderedTuples add:((OrderedCollection with:eachPrivateClass) addAll:sharedPools).
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1010
	    ].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1011
	].
15125
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1012
    ].
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1013
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1014
    "I am only interested in my classes"
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1015
    ^ orderedTuples topologicalSort intersect:aCollectionOfClasses.
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1016
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1017
    "
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1018
     Class classesSortedByLoadOrder:stx_libbasic compiled_classes_common
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1019
     Class classesSortedByLoadOrder2:stx_libbasic compiled_classes_common
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1020
     Class classesSortedByLoadOrder:stx_libjava compiled_classes_common
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1021
     Class classesSortedByLoadOrder2:stx_libjava compiled_classes_common
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1022
    "
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1023
!
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1024
9849
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1025
classesSortedByLoadOrder:someClasses
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1026
    "return a copy of the given collection of classes, which is sorted
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1027
     by inheritance and superclass-of-any-private class.
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1028
     This is the optimal order for loading, and the required order for compilation"
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1029
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1030
    |remaining classesInLoadOrder|
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1031
10008
85b80de0562a fix private class dependency handling in #classesSortedByLoadOrder:
Stefan Vogel <sv@exept.de>
parents: 9849
diff changeset
  1032
    "private classes are not loaded directly, so ignore them"
14990
8ed060e047c7 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 14972
diff changeset
  1033
    remaining := someClasses select:[:eachClass| eachClass isPrivate not] as:IdentitySet.
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  1034
    "JV-2011-05-05: Sort the classes by name to get more stable order.
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1035
     This stabilizes order of classes in generated build files and
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1036
     makes text-based diffing/merging easier for both human beings
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1037
     and version control systems"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1038
    remaining := remaining asOrderedCollection sort:[:a :b|a name < b name].
10008
85b80de0562a fix private class dependency handling in #classesSortedByLoadOrder:
Stefan Vogel <sv@exept.de>
parents: 9849
diff changeset
  1039
    classesInLoadOrder := OrderedCollection new:(remaining size).
85b80de0562a fix private class dependency handling in #classesSortedByLoadOrder:
Stefan Vogel <sv@exept.de>
parents: 9849
diff changeset
  1040
9849
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1041
    [remaining notEmpty] whileTrue:[
23010
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1042
        |thoseWithOtherSuperclasses thoseWhichCanBeLoadedNow|
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1043
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1044
        "find the next class(es) to be loaded.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1045
         Consider first:
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1046
            all those, which do not have a superclass in the remaining set.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1047
            and which do not use a shared pool defined in the remaining set"
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1048
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1049
        thoseWithOtherSuperclasses :=
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1050
            remaining
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1051
                reject:[:eachClass |
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1052
                    (remaining includes:eachClass superclass)
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1053
                    or:[eachClass sharedPoolNames contains:[:eachPoolSymbol|
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1054
                            remaining contains:[:eachRemainingClass| eachPoolSymbol = eachRemainingClass name]
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1055
                        ]
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1056
                    ].
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1057
                ].
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1058
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1059
        "second: the subset with all those having no private classes,
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1060
                 or having private classes, whose superclasses are NOT in the remaining set,
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1061
                 or having private classes which do not use a shared pool in the remaining set"
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1062
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1063
        thoseWhichCanBeLoadedNow :=
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1064
            thoseWithOtherSuperclasses
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1065
                reject:[:eachClass |
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1066
                    eachClass allPrivateClasses contains:[:eachPrivateClass|
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1067
                        |superClassesOwner sharedPools|
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1068
                        superClassesOwner := eachPrivateClass superclass.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1069
                        "take care of classes inheriting from nil or ProtoObject"
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1070
                        superClassesOwner isBehavior ifTrue:[
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1071
                            superClassesOwner := superClassesOwner owningClassOrYourself.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1072
                        ].
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1073
                        sharedPools := eachPrivateClass sharedPools.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1074
                        (superClassesOwner ~~ eachClass
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1075
                            and:[remaining includes:superClassesOwner])
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1076
                        or:[remaining includesAny:sharedPools]
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1077
                    ].
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1078
                ].
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1079
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1080
        thoseWhichCanBeLoadedNow isEmpty ifTrue:[
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1081
            thoseWithOtherSuperclasses isEmpty ifTrue:[
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1082
                "this does not normally happen"
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1083
                self error:'superclass order is cyclic'.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1084
            ] ifFalse:[
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1085
                "no class found, that may be loaded - maybe there is a cyclic
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1086
                 dependency involving private classes.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1087
                 If you proceed here, private class dependencies are ignored
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1088
                 for this pass"
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1089
                self proceedableError:'load order is cyclic (care for private classes)'.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1090
                thoseWhichCanBeLoadedNow := thoseWithOtherSuperclasses.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1091
            ].
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1092
        ].
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1093
        remaining removeAllFoundIn:thoseWhichCanBeLoadedNow.
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1094
        classesInLoadOrder addAll:(thoseWhichCanBeLoadedNow sort:[:a :b | a name < b name]).
9849
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1095
    ].
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1096
    ^ classesInLoadOrder
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1097
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1098
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1099
     Class classesSortedByLoadOrder:(Smalltalk allClassesInPackage:'stx:libbasic')
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1100
     Class classesSortedByLoadOrder:(Smalltalk allClassesInPackage:'stx:libbasic3')
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1101
     Class classesSortedByLoadOrder:(Smalltalk allClassesInPackage:'stx:libwidg')
15125
35cada99c55a class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15107
diff changeset
  1102
     Class classesSortedByLoadOrder:(Smalltalk allClassesInPackage:'stx:libjava')
9849
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1103
    "
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1104
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1105
    "Created: / 14-09-2006 / 11:21:25 / cg"
13215
14d2bc8d5c5f changed: #classesSortedByLoadOrder:
Claus Gittinger <cg@exept.de>
parents: 12936
diff changeset
  1106
    "Modified: / 18-01-2011 / 17:55:59 / cg"
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1107
    "Modified: / 05-05-2011 / 12:43:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23010
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  1108
    "Modified: / 24-05-2018 / 21:06:25 / Claus Gittinger"
9849
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1109
!
c764113d98aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9696
diff changeset
  1110
8962
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1111
commonSuperclassOf:listOfClassesOrClassNames
11984
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1112
    "given a list of classes, return the common superclass.
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1113
     A helper for the browser, some dialogs and some refactorings"
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1114
8962
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1115
    |common|
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1116
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1117
    listOfClassesOrClassNames do:[:classOrClassName |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1118
	|class|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1119
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1120
	class := classOrClassName isBehavior
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1121
			ifTrue:[classOrClassName]
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1122
			ifFalse:[Smalltalk classNamed:classOrClassName].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1123
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1124
	common isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1125
	    common := class
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1126
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1127
	    (class isSubclassOf:common) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1128
		"keep common"
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1129
	    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1130
		(common isSubclassOf:class) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1131
		    common := class
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1132
		] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1133
		    common := common commonSuperclass:class.
8962
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1134
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1135
"/                    "walk up, checking"
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1136
"/                    found := false.
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1137
"/
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1138
"/                    common allSuperclassesDo:[:sup |
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1139
"/                        (found not and:[class isSubclassOf:sup]) ifTrue:[
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1140
"/                            common := sup.
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1141
"/                            found := true.
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1142
"/                        ]
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1143
"/                    ].
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1144
"/                    found ifFalse:[
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1145
"/                        class allSuperclassesDo:[:sup |
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1146
"/                            (found not and:[common isSubclassOf:sup]) ifTrue:[
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1147
"/                                common := sup.
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1148
"/                                found := true.
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1149
"/                            ]
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1150
"/                        ].
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1151
"/                    ].
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1152
		]
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1153
	    ].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1154
	].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1155
	(common isNil or:[common == Object]) ifTrue:[^ common].
8962
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1156
    ].
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1157
    ^ common
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1158
11984
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1159
    "
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1160
     Class commonSuperclassOf:#(Array OrderedCollection Set)
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1161
     Class commonSuperclassOf:#(Character Number Point)
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1162
    "
905d971cda90 comment
Claus Gittinger <cg@exept.de>
parents: 11958
diff changeset
  1163
8962
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1164
    "Modified: 17.6.1996 / 17:09:21 / stefan"
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1165
    "Modified: 5.9.1996 / 19:34:41 / cg"
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1166
! !
67187d6f3f52 refactored
Claus Gittinger <cg@exept.de>
parents: 8961
diff changeset
  1167
4964
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1168
!Behavior class methodsFor:'misc'!
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1169
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1170
autoload
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1171
    "for compatibility with autoloaded classes - dummy here"
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1172
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1173
    ^ self
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1174
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1175
! !
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
  1176
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  1177
!Behavior class methodsFor:'queries'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1178
4332
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
  1179
definitionSelectorFirstParts
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
  1180
    "return a collection of partial class-definition selectors"
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
  1181
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
  1182
    ^ #( #'subclass:'
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1183
	 #'variableSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1184
	 #'variableByteSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1185
	 #'variableWordSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1186
	 #'variableLongSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1187
	 #'variableSignedWordSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1188
	 #'variableSignedLongSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1189
	 #'variableLongLongSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1190
	 #'variableSignedLongLongSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1191
	 #'variableFloatSubclass:'
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1192
	 #'variableDoubleSubclass:'
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1193
      )
4332
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
  1194
!
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
  1195
4428
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  1196
definitionSelectors
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  1197
    "return a collection class-definition selectors"
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
  1198
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1199
    ^ #(
24921
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1200
         #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1201
         #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1202
         #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1203
         #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1204
         #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1205
         #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1206
         #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1207
         #'variableLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1208
         #'variableSignedLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1209
         #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1210
         #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1211
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1212
        "/ ST/X private subclasses
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1213
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1214
         #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1215
         #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1216
         #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1217
         #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1218
         #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1219
         #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1220
         #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1221
         #'variableLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1222
         #'variableSignedLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1223
         #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1224
         #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1225
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1226
        "/ ST/V subclass messages
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1227
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1228
         #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1229
         #'variableByteSubclass:classVariableNames:poolDictionaries:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1230
         #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1231
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1232
        "/ Dolphin
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1233
         #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:classInstanceVariableNames:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1234
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1235
        "/ VSE
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1236
         #'variableByteSubclass:classVariableNames:poolDictionaries:category:'
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1237
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1238
        "/ Squeak
181fb14c2db8 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24848
diff changeset
  1239
         #'subclass:instanceVariableNames:classVariableNames:package:'
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1240
      )
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1241
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1242
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1243
isBuiltInClass
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1244
    "return true if this class is known by the run-time-system.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1245
     Here, true is returned for myself, false for subclasses."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1246
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1247
    ^ (self == Behavior class) or:[self == Behavior]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1248
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1249
    "Modified: 23.4.1996 / 15:55:52 / cg"
14154
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1250
!
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1251
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1252
supportsMethodCategories
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1253
    "return true, if my methods are categorized.
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1254
     This is a hook for the browser to allow alien classes
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1255
     to be handled (actually, this is not yet used)."
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1256
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1257
    ^ true
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1258
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  1259
    "Created: / 01-06-2012 / 20:37:46 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1260
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  1261
16280
cd8ddeffcf92 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 16268
diff changeset
  1262
7269
f1e3ab435963 method category rename
Claus Gittinger <cg@exept.de>
parents: 7260
diff changeset
  1263
!Behavior methodsFor:'Compatibility-Dolphin'!
6329
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
  1264
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
  1265
allSubinstances
11953
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1266
    "Compatibility method - do not use in new code.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1267
     Same as allSubInstances; added for Dolphin compatibility"
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1268
6865
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
  1269
    ^ self allSubInstances
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
  1270
!
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
  1271
6889
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1272
fromString:aString
11953
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1273
    "reconstruct an instance of myself from the ascii-store string.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1274
     These bytes are typically the result from storing into a string/stream.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1275
     Same as readFrom:, for Dolphin compatibility."
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1276
19602
04e812e52dfc #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19435
diff changeset
  1277
    |result|
04e812e52dfc #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19435
diff changeset
  1278
04e812e52dfc #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19435
diff changeset
  1279
    result := self readFrom:aString readStream.
14972
93fdcdc3bf09 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 14703
diff changeset
  1280
"/ should check here for garbage - maybe later
93fdcdc3bf09 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 14703
diff changeset
  1281
"/    s atEnd ifFalse:[^ ConversionError raiseRequestWith:aString errorString:' - garbage at end of ', self name].
93fdcdc3bf09 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 14703
diff changeset
  1282
    ^ result
6889
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1283
!
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1284
6865
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
  1285
guid:aUUID
11953
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1286
    "Compatibility method - do not use in new code.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1287
     An ignored dummy; for Dolphin compatibility."
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1288
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1289
    "/ intentionally left blank - for now
11158
3c2ab1fc09c2 +lookupMethod:
Claus Gittinger <cg@exept.de>
parents: 11131
diff changeset
  1290
!
3c2ab1fc09c2 +lookupMethod:
Claus Gittinger <cg@exept.de>
parents: 11131
diff changeset
  1291
3c2ab1fc09c2 +lookupMethod:
Claus Gittinger <cg@exept.de>
parents: 11131
diff changeset
  1292
lookupMethod:selector
21398
4ec3b243ac5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21393
diff changeset
  1293
    <resource: #obsolete>
11953
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1294
    "Compatibility method - do not use in new code.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1295
     Return the method for given selector aSelector or nil.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1296
     Only methods in the receiver - not in the superclass chain are returned.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1297
     For dolphin compatibility.
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1298
     TODO: fixme if I am wrong, and dolphin does a full lookup here. If that is the case,
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1299
     change to use lookupMethodFor:aSelector below."
58c0d5d790cc comments
Claus Gittinger <cg@exept.de>
parents: 11578
diff changeset
  1300
11158
3c2ab1fc09c2 +lookupMethod:
Claus Gittinger <cg@exept.de>
parents: 11131
diff changeset
  1301
    ^ self compiledMethodAt:selector
6329
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
  1302
! !
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
  1303
7269
f1e3ab435963 method category rename
Claus Gittinger <cg@exept.de>
parents: 7260
diff changeset
  1304
!Behavior methodsFor:'Compatibility-Squeak'!
4889
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
  1305
13600
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1306
classSide
21393
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1307
    <resource: #obsolete>
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1308
13600
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1309
    "alias for theMetaclass - return the metaclass"
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1310
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1311
    ^ self theMetaclass
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1312
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1313
    "Created: / 26-08-2009 / 11:44:51 / Jaroslav Havlin <havlij6@fel.cvut.cz>"
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1314
    "Modified: / 12-09-2010 / 16:38:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
21393
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1315
    "Modified: / 10-02-2017 / 10:42:59 / cg"
13600
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1316
!
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1317
21393
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1318
instanceSide
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1319
    <resource: #obsolete>
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1320
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1321
    "alias for theNonMetaclass - return the non-metaclass"
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1322
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1323
    ^ self theNonMetaclass
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1324
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1325
    "Created: / 10-02-2017 / 10:42:44 / cg"
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1326
!
ed2989c9dca3 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21392
diff changeset
  1327
5753
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
  1328
lookupSelector:aSelector
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
  1329
    "return the method for a selector - Squeak compatibility"
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
  1330
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
  1331
    ^ self lookupMethodFor:aSelector
6147
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
  1332
!
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
  1333
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1334
selectorsWithArgs:numberOfArgs
6147
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
  1335
    "Return all selectors defined in this class that take this number of arguments."
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
  1336
24479
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1337
    |selectors|
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1338
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1339
    selectors := OrderedCollection new.
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1340
    (self methodDictionary ? #()) keysDo:[:sel |
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1341
        sel argumentCount == numberOfArgs ifTrue:[
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1342
            selectors add:sel
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1343
        ]
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1344
    ].
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1345
    ^ selectors
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1346
"/    ^ self selectors
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1347
"/        select:[:sel | sel argumentCount == numberOfArgs]
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1348
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1349
    "
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1350
     SmallInteger selectorsWithArgs:0  
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1351
     SmallInteger selectorsWithArgs:1  
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1352
     SmallInteger selectorsWithArgs:2  
2b01fef43f16 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24273
diff changeset
  1353
     SmallInteger selectorsWithArgs:3  
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1354
     SmallInteger selectorsWithArgs:4
6147
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
  1355
    "
13600
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1356
!
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1357
21392
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1358
theMetaClass
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1359
    <resource: #obsolete>
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  1360
21392
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1361
    "alias for theMetaclass (Squeak) - return the class.
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1362
     sigh; in ST/X, it is called theMetaclass; please use that."
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1363
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1364
    ^ self theMetaclass
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1365
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1366
    "Created: / 10-02-2017 / 10:39:58 / cg"
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1367
!
2fbf902049bf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21391
diff changeset
  1368
13600
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1369
theNonMetaClass
20780
db420e657390 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 20706
diff changeset
  1370
    <resource: #obsolete>
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  1371
19822
1af258da56af #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19718
diff changeset
  1372
    "alias for theNonMetaclass (Squeak) - return the class.
1af258da56af #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19718
diff changeset
  1373
     sigh; in ST/X, it is called theNonMetaclass; please use that."
13600
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1374
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1375
    ^ self theNonMetaclass
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1376
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1377
    "Created: / 26-08-2009 / 11:39:08 / Jaroslav Havlin <havlij6@fel.cvut.cz>"
Claus Gittinger <cg@exept.de>
parents: 13460
diff changeset
  1378
    "Modified (comment): / 20-08-2011 / 16:35:07 / cg"
4889
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
  1379
! !
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
  1380
7269
f1e3ab435963 method category rename
Claus Gittinger <cg@exept.de>
parents: 7260
diff changeset
  1381
!Behavior methodsFor:'Compatibility-VW'!
5964
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1382
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1383
>> aSelector
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1384
    "return the method stored under the given selector; nil if there is none"
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1385
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1386
    ^ self compiledMethodAt:aSelector
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1387
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1388
    "
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1389
     self compiledMethodAt:#compiledMethodAt:
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1390
     self >> #compiledMethodAt:
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1391
    "
6115
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1392
!
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1393
17646
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1394
findSelector:aSelector
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1395
    "return an array filled with class and method, which would be executed if aSelector was sent to
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1396
     an instance of the receiver.
17646
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1397
     I.e. the selector arrays of the receiver
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1398
     and all of its superclasses are searched for aSelector.
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1399
     Return nil if instances do not understand aSelector"
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1400
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1401
    |mthd|
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1402
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1403
    mthd := self lookupMethodFor:aSelector.
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1404
    mthd notNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1405
	^ { mthd mclass . mthd }
17646
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1406
    ].
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1407
    ^ nil
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1408
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1409
    "
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1410
     Array findSelector:#at:
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1411
    "
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1412
!
069983bf8610 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17633
diff changeset
  1413
6115
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1414
fixedFieldsMask
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1415
    "Mask on the format word to indicate the number of fixed fields in instances
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1416
     of a behavior.  If this is non-zero, the behavior must be pointer-type"
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1417
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1418
    ^ 255
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1419
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1420
!
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1421
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1422
format
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1423
    "Answer an Integer that encodes the kinds and numbers of
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1424
    variables of instances of the receiver.
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1425
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1426
    See instSize method for reference to the fixedFieldsMask bit mask of the format.
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1427
    See isVariable method for reference to the indexableMask bit mask of the format.
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1428
    See isBits method for reference to the pointersMask bit mask of the format.
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1429
    All other bits of the format are unused and should be 0."
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1430
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1431
    "/ simulate a VW5i mask
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1432
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1433
    ^ (self instSize
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1434
      bitOr:( self isPointers ifTrue:[16384] ifFalse:[0]))
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1435
      bitOr:( self isVariable ifTrue:[ 4096] ifFalse:[0])
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1436
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1437
!
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1438
10085
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  1439
getMethodDictionary
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  1440
    "ST 80 compatibility: return the receiver's method dictionary."
10085
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  1441
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  1442
    ^ self methodDictionary
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  1443
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  1444
    "Modified: / 6.3.1998 / 15:45:50 / stefan"
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  1445
!
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  1446
6115
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1447
instanceBehavior
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1448
    "Answer the instance behavior of the receiver.
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1449
     This is the receiver for non metaclasses.
6115
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1450
     Metaclass overrides this to answer a Metaclass's sole instance.
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1451
     Same as #theNonMetaclass - for VW compatibility
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1452
    "
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1453
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1454
    ^ self theNonMetaclass
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
  1455
5964
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1456
! !
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  1457
17237
dfbba5167502 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17126
diff changeset
  1458
!Behavior methodsFor:'RefactoringBrowser'!
dfbba5167502 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17126
diff changeset
  1459
dfbba5167502 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17126
diff changeset
  1460
realClass
dfbba5167502 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17126
diff changeset
  1461
    "for compatibility with RBAbstractClass"
dfbba5167502 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17126
diff changeset
  1462
dfbba5167502 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17126
diff changeset
  1463
    ^ self
dfbba5167502 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17126
diff changeset
  1464
! !
16848
4ab0652eb947 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16734
diff changeset
  1465
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1466
!Behavior methodsFor:'accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1467
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1468
addSelector:newSelector withMethod:newMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1469
    "add the method given by 2nd argument under the selector given by
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1470
     1st argument to the methodDictionary. Flushes all caches."
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1471
15046
1355771b72e3 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15027
diff changeset
  1472
    |oldMethod ns nsName selector newLookupObject|
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1473
7800
9f0c69234af7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7764
diff changeset
  1474
    (newSelector isMemberOf:Symbol) ifFalse:[
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1475
        ArgumentError raiseErrorString:'invalid selector'.
7800
9f0c69234af7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7764
diff changeset
  1476
    ].
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  1477
14551
701b20a585a6 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14550
diff changeset
  1478
    ns := newMethod nameSpace.
15046
1355771b72e3 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15027
diff changeset
  1479
    (ns notNil and:[(nsName := ns name) ~= self programmingLanguage defaultSelectorNameSpacePrefix]) ifTrue:[
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1480
        selector := (':' , nsName , '::' , newSelector) asSymbol.
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1481
        newLookupObject := Smalltalk at: #NamespaceAwareLookup. "/ so it can be nilled to disable that feature
14550
0064b35cbeb2 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14535
diff changeset
  1482
    ] ifFalse:[
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1483
        selector := newSelector
14550
0064b35cbeb2 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14535
diff changeset
  1484
    ].
14535
45cf589372fa class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14504
diff changeset
  1485
45cf589372fa class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14504
diff changeset
  1486
    "/ Q (cg): isn't that something that the caller should decide?
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1487
    oldMethod := self compiledMethodAt:selector.
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  1488
    oldMethod notNil ifTrue:[
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1489
        newMethod restricted:(oldMethod isRestricted).
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1490
        newMethod setPrivacy:(oldMethod privacy) flushCaches:false.
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  1491
    ].
11578
30909b044a03 updateRequests
ca
parents: 11574
diff changeset
  1492
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1493
    (self primAddSelector:selector withMethod:newMethod) ifFalse:[^ false].
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1494
14550
0064b35cbeb2 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14535
diff changeset
  1495
    newLookupObject notNil ifTrue:[
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1496
        lookupObject ~= newLookupObject ifTrue:[
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1497
            self lookupObject: newLookupObject
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1498
        ]
13460
3197ced2f512 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13419
diff changeset
  1499
    ].
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1500
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1501
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1502
     if I have no subclasses, all we have to flush is cached
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1503
     data for myself ... (actually, in any case all that needs
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1504
     to be flushed is info for myself and all of my subclasses)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1505
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1506
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1507
    problem: this is slower; since looking for all subclasses is (currently)
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1508
             a bit slow :-(
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1509
             We need the hasSubclasses-info bit in Behavior; now
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1510
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1511
    self withAllSubclassesDo:[:aClass |
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1512
        ObjectMemory flushInlineCachesFor:aClass withArgs:nargs.
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1513
        ObjectMemory flushMethodCacheFor:aClass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1514
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1515
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1516
3805
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1517
    "/
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1518
    "/ pass the selector AND the old method as changeArg
21424
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  1519
    "/ - this allows for watchers to find out if it's a new method or a method-change
3805
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1520
    "/
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1521
    self changed:#methodDictionary with:(Array with:selector with:oldMethod).
3805
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1522
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1523
    "/
20555
050b21b2bf4f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20308
diff changeset
  1524
    "/ pass the class AND selector AND the old method as changeArg
050b21b2bf4f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20308
diff changeset
  1525
    "/ - this allows for watchers to depend on a non-metaclass only, watching both sides.
050b21b2bf4f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20308
diff changeset
  1526
    "/
050b21b2bf4f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20308
diff changeset
  1527
    self theNonMetaclass changed:#classesMethodDictionary with:(Array with:self with:selector with:oldMethod).
050b21b2bf4f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20308
diff changeset
  1528
050b21b2bf4f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20308
diff changeset
  1529
    "/
3805
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1530
    "/ also notify a change of Smalltalk;
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1531
    "/ this allows a dependent of Smalltalk to watch all class
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1532
    "/ changes (no need for observing all classes)
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1533
    "/ - this allows for watchers to find out if its a new method or a method-change
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1534
    "/
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1535
    Smalltalk changed:#methodInClass with:(Array with:self with:selector with:oldMethod).
11574
5626102f41e8 changed #addSelector:withMethod:
ca
parents: 11552
diff changeset
  1536
    ^ true.
3805
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1537
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  1538
    "Created: / 11-12-1995 / 13:59:37 / cg"
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  1539
    "Modified: / 04-08-2006 / 11:39:28 / cg"
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1540
    "Modified: / 20-07-2010 / 11:29:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
21424
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  1541
    "Modified (comment): / 13-02-2017 / 19:55:19 / cg"
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  1542
    "Modified: / 06-06-2019 / 23:28:06 / Claus Gittinger"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1543
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1544
9445
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1545
basicAddSelector:newSelector withMethod:newMethod
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1546
    "add the method given by 2nd argument under the selector given by
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1547
     1st argument to the methodDictionary. Flushes all caches."
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1548
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1549
    |nargs |
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1550
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1551
    self primAddSelector:newSelector withMethod:newMethod.
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1552
18435
b58b1b222873 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 18424
diff changeset
  1553
    nargs := newMethod argumentCount.
9445
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1554
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1555
    ObjectMemory flushMethodCacheForSelector:newSelector.
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1556
"/    ObjectMemory flushMethodCache.
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1557
    ObjectMemory flushInlineCachesWithArgs:nargs.
17527
6226760f4f60 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17379
diff changeset
  1558
    ObjectMemory flushCachesForSelector:newSelector numArgs:nargs
9445
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1559
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1560
    "Created: / 15-07-2006 / 16:56:43 / cg"
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1561
!
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  1562
10535
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1563
basicRemoveSelector:aSelector
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1564
    "remove the selector, aSelector and its associated method
10535
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1565
     from the methodDictionary"
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1566
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1567
    |dict newDict|
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1568
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1569
    (Smalltalk
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  1570
        changeRequest:#methodInClassRemoved
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  1571
        with:(Array with:self with:aSelector)
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  1572
    ) ifFalse:[
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  1573
        ^ false
11578
30909b044a03 updateRequests
ca
parents: 11574
diff changeset
  1574
    ].
30909b044a03 updateRequests
ca
parents: 11574
diff changeset
  1575
10535
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1576
    dict := self methodDictionary.
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1577
    newDict := dict removeKeyAndCompress:aSelector.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1578
    newDict isNil ifTrue:[
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  1579
        ^ false.
10535
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1580
    ].
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1581
    self setMethodDictionary:newDict.
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1582
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1583
    "
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1584
     actually, we would do better with less flushing ...
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1585
    "
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1586
    "/ObjectMemory flushCaches.
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1587
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1588
    "yes, we can:"
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1589
    ObjectMemory flushCachesForSelector:aSelector.
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1590
    ^ true
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1591
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1592
    "Modified: / 12-06-1996 / 11:54:29 / stefan"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1593
    "Modified: / 19-07-2010 / 11:22:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  1594
    "Modified (format): / 12-03-2019 / 20:45:40 / Claus Gittinger"
10535
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1595
!
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1596
14703
6a9a49cea683 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14688
diff changeset
  1597
containingNameSpace
6a9a49cea683 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14688
diff changeset
  1598
    "return the namespace which contains me.
6a9a49cea683 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14688
diff changeset
  1599
     Defined here as a dummy; actually only real classes should ever be put into a namespace."
6a9a49cea683 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14688
diff changeset
  1600
6a9a49cea683 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14688
diff changeset
  1601
    ^ nil
6a9a49cea683 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14688
diff changeset
  1602
!
6a9a49cea683 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14688
diff changeset
  1603
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1604
flags
16016
125e360f8867 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15986
diff changeset
  1605
    "return the receiver's flag bits.
125e360f8867 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15986
diff changeset
  1606
     see flagXXX methods on my class side for details"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1607
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1608
    ^ flags
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1609
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1610
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1611
instSize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1612
    "return the number of instance variables of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1613
     This includes all superclass instance variables."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1614
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1615
    ^ instSize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1616
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1617
12842
90e2972fe619 lookup object
Claus Gittinger <cg@exept.de>
parents: 12794
diff changeset
  1618
lookupObject
90e2972fe619 lookup object
Claus Gittinger <cg@exept.de>
parents: 12794
diff changeset
  1619
    "return the lookupObject (Jan's MetaObjectProtocol support) or nil.
18367
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1620
     If non-nil, no lookup is performed by the VM, instead the VM asks the lookupObject
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1621
     to provide a method for message sends."
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1622
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1623
    ^ lookupObject
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1624
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1625
    "/ CG: why this?
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1626
    "/ the VM ONLY looks at the lookupObject slot and does not walk the hierarchy;
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1627
    "/ (which it should never !!!!!!)
18402
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1628
    "/ It is the responsibility of the IDE (or whoever uses lookupObjects),
18367
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1629
    "/ to make sure that subclasses get a lookupObject, if they need it.
18402
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1630
    "/ Also: it does not really make sense to redefine the behavior here
18367
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1631
    "/ (for inheritance of lookup),
18402
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1632
    "/ differently to what the VM does;
18367
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1633
    "/ remember: this is also called for canUnderstand, respondsTo etc.
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1634
    "/ and no one expects these to return different results than what the VM does.
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1635
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1636
    "/    | behavior lookupInherited |
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1637
    "/
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1638
    "/    lookupObject notNil ifTrue:[^ lookupObject].
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1639
    "/    Lookup isNil ifTrue:[^ nil].
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1640
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1641
    "/    behavior := self.
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1642
    "/    [ behavior notNil ] whileTrue:[
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1643
    "/        lookupInherited := behavior getLookupObject.
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1644
    "/        lookupInherited notNil ifTrue: [^ lookupInherited].
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1645
    "/        behavior := behavior superclass
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1646
    "/    ].
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1647
    "/    ^ BuiltinLookup instance "Lookup builtin"
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1648
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1649
    "Modified: / 26-04-2010 / 21:05:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1650
!
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1651
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1652
lookupObject: anObject
14535
45cf589372fa class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14504
diff changeset
  1653
    lookupObject == anObject ifTrue:[^ self ].
18367
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1654
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  1655
    anObject notNil ifTrue:[
18402
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1656
	"/ check if it is valid; the reason is that the VM gets into bad trouble,
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1657
	"/ if some invalid thingy is set as lookup object
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1658
	(anObject respondsTo: #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:)
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1659
	ifFalse:[
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1660
	    self error:'Lookup object does not respond to #lookupMethodForSelector:directedTo:for:withArguments:from:ilc:'
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1661
	].
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1662
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1663
	"/ CG: huh - what is this - it is nowhere implemented.
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1664
	(anObject respondsTo:#superLookupObject:)
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1665
	ifTrue:[
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1666
	    anObject superLookupObject: self lookupObject
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1667
	].
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  1668
    ].
18369
ab2eced5a342 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18367
diff changeset
  1669
    "/ the builtin has the same behavior as the VM's default;
ab2eced5a342 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18367
diff changeset
  1670
    "/ so let it do it - it's faster
ab2eced5a342 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18367
diff changeset
  1671
    anObject == BuiltinLookup instance ifTrue:[
18402
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1672
	self setLookupObject: nil.
18369
ab2eced5a342 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18367
diff changeset
  1673
    ] ifFalse:[
18402
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  1674
	self setLookupObject: anObject.
18369
ab2eced5a342 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18367
diff changeset
  1675
    ].
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1676
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  1677
    "Created: / 26-04-2010 / 13:35:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  1678
    "Modified: / 26-10-2011 / 13:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12842
90e2972fe619 lookup object
Claus Gittinger <cg@exept.de>
parents: 12794
diff changeset
  1679
!
90e2972fe619 lookup object
Claus Gittinger <cg@exept.de>
parents: 12794
diff changeset
  1680
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1681
methodDictionary
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  1682
    "return the receiver's method dictionary."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1683
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1684
    ^ methodDictionary
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1685
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1686
    "Modified: 12.6.1996 / 13:47:08 / stefan"
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1687
    "Modified: 16.8.1996 / 14:55:21 / cg"
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1688
!
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1689
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1690
methodDictionary:dict
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  1691
    "set the receiver's method dictionary and flush inline caches."
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1692
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1693
    dict isNil ifTrue:[
23007
cae37a19473b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22935
diff changeset
  1694
        self proceedableError:'attempt to set methodDictionary to nil.'.
cae37a19473b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22935
diff changeset
  1695
        ^ self
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1696
    ].
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1697
    self setMethodDictionary:dict.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1698
    ObjectMemory flushCaches.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1699
23007
cae37a19473b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22935
diff changeset
  1700
    "Created: / 05-06-1996 / 11:29:36 / stefan"
cae37a19473b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22935
diff changeset
  1701
    "Modified: / 07-06-1996 / 08:39:51 / stefan"
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  1702
    "Modified: / 12-03-2019 / 20:46:58 / Claus Gittinger"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1703
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1704
7605
945a2cd8115c moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7435
diff changeset
  1705
package
945a2cd8115c moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7435
diff changeset
  1706
    "for protocol compatibility with class"
945a2cd8115c moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7435
diff changeset
  1707
945a2cd8115c moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7435
diff changeset
  1708
    ^ ''
945a2cd8115c moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7435
diff changeset
  1709
!
945a2cd8115c moved some stuff from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7435
diff changeset
  1710
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1711
removeSelector:aSelector
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1712
    "remove the selector, aSelector and its associated method
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1713
     from the methodDictionary"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1714
10535
527b1fd57a09 +basicRemoveSelector
ca
parents: 10534
diff changeset
  1715
    ^ self basicRemoveSelector:aSelector
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1716
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1717
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1718
selectors
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  1719
    "return the receiver's selector array as an OrderedCollection.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1720
     Notice: this may not be compatible with ST-80.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1721
     (should we return a Set ?)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1722
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1723
    |md|
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1724
1967
e8a6fb1e14ce oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  1725
    (md := self methodDictionary) isNil ifTrue:[
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  1726
	'oops - nil methodDictionary' errorPrintCR.
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  1727
	^ #()
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1728
    ].
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1729
    ^ md keys
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1730
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1731
    "Modified: 7.6.1996 / 15:33:18 / stefan"
1967
e8a6fb1e14ce oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  1732
    "Modified: 12.11.1996 / 11:31:51 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1733
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1734
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1735
superclass
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  1736
    "return the receiver's superclass"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1737
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1738
    ^ superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1739
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1740
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1741
!Behavior methodsFor:'autoload check'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1742
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1743
autoload
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1744
    "force autoloading - do nothing here;
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1745
     redefined in Autoload; see comment there"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1746
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1747
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1748
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1749
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1750
isLoaded
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1751
    "return true, if the class has been loaded;
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1752
     redefined in Autoload; see comment there"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1753
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1754
    ^ true
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1755
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1756
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1757
wasAutoloaded
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1758
    "return true, if this class came into the system via an
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1759
     autoload; false otherwise.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1760
     Returning false here. This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1761
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1762
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1763
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1764
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1765
    "Created: 16.4.1996 / 16:27:16 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1766
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1767
15230
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
  1768
15769
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1769
!Behavior methodsFor:'cleanup'!
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1770
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1771
flushSubclasses
20785
d92576d9a18f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20780
diff changeset
  1772
    "I don't keep my subclasses - but if anyone inherits from me,
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1773
     it better knows how to ignore this"
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1774
!
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1775
15769
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1776
lowSpaceCleanup
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1777
    "ignored here - redefined in some classes to
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1778
     cleanup in low-memory situations"
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1779
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1780
    ^ self
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1781
! !
00ff0c8bc13a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15745
diff changeset
  1782
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1783
!Behavior methodsFor:'compiler interface'!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1784
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1785
browserClass
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1786
    "return the browser to use for this class -
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1787
     this can be redefined in special classes, to get different browsers"
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1788
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1789
    ^ self class browserClass.
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1790
!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1791
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1792
compiler
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1793
    "return the compiler to use for this class.
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1794
     OBSOLETE: This is the old ST/X interface, kept for migration.
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1795
	       Don't use it - it will vanish."
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1796
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1797
    <resource:#obsolete>
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1798
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1799
    self obsoleteMethodWarning:'use #compilerClass'.
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1800
    ^ self compilerClass
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1801
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1802
    "Modified: 31.7.1997 / 23:04:33 / cg"
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1803
!
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1804
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1805
compilerClass
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1806
    "return the compiler to use for this class -
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1807
     this can be redefined in special classes, to compile classes with
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1808
     JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1809
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1810
    ^ self class compilerClass.
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1811
!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1812
12936
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1813
dllPath
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  1814
    "if a class contains ExternalFunctions,
12936
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1815
     return a collection of pathNames where to find the DLLs
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1816
     containing the external functions.
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1817
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1818
     Do not code absolute path names here - keep them in the system settings.
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1819
     Use this if the DLL location is kept in some registry entry."
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1820
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1821
    ^ #()
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1822
!
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1823
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1824
evaluatorClass
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1825
    "return the compiler to use for expression evaluation for this class -
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1826
     this can be redefined in special classes, to evaluate expressions with
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1827
     JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1828
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1829
    ^ self class evaluatorClass.
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1830
!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1831
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1832
formatterClass
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1833
    "return the parser to use for formatting (prettyPrinting) this class -
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1834
     this can be redefined in special classes, to format classes with
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1835
     JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1836
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1837
    ^ self class formatterClass.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1838
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1839
11990
5a201d98f702 changed #language
fm
parents: 11984
diff changeset
  1840
language
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1841
    "return the programming language to use for this class.
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1842
     OBSOLETE: This is an old interface which will vanish (easily confused with UI-national language)."
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1843
12936
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1844
    <resource: #obsolete>
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1845
12936
2971e38050f2 added: #dllPath
Stefan Vogel <sv@exept.de>
parents: 12869
diff changeset
  1846
    self obsoleteMethodWarning:'use #programmingLanguage or Smalltalk language'.
12148
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1847
    ^ self class programmingLanguage
11990
5a201d98f702 changed #language
fm
parents: 11984
diff changeset
  1848
5a201d98f702 changed #language
fm
parents: 11984
diff changeset
  1849
    "Created: / 15-08-2009 / 09:06:46 / Jan Vrany <vranyj1@fel.cvut.cz>"
5a201d98f702 changed #language
fm
parents: 11984
diff changeset
  1850
!
5a201d98f702 changed #language
fm
parents: 11984
diff changeset
  1851
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1852
parserClass
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1853
    "return the parser to use for parsing this class -
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1854
     this can be redefined in special classes, to parse classes with
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1855
     JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1856
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1857
    ^ self class parserClass.
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1858
!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1859
12148
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1860
programmingLanguage
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1861
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1862
    ^self class programmingLanguage
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1863
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1864
    "Created: / 15-08-2009 / 09:06:46 / Jan Vrany <vranyj1@fel.cvut.cz>"
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1865
!
e7a761017355 added: #programmingLanguage
Claus Gittinger <cg@exept.de>
parents: 12114
diff changeset
  1866
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1867
subclassDefinerClass
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1868
    "Answer an evaluator class appropriate for evaluating definitions of new
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1869
     subclasses of this class."
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1870
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1871
    ^ self class subclassDefinerClass.
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1872
!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1873
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1874
syntaxHighlighterClass
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1875
    "return the class to use for syntaxHighlighting (prettyPrinting) this class -
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1876
     this can be redefined in special classes, to highlight classes with
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  1877
     JavaScript, Ruby, Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1878
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1879
    ^ self class syntaxHighlighterClass.
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1880
! !
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1881
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1882
!Behavior methodsFor:'compiling'!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1883
15107
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1884
compile:code
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1885
    "compile code, aString for this class;
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1886
     if successful update the method dictionary.
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1887
     Returns the new method or nil (on failure)."
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1888
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1889
    ^ self compilerClass
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1890
	compile:code
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1891
	forClass:self
15107
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1892
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1893
    "Modified: 13.12.1995 / 10:56:00 / cg"
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1894
    "Created: 1.4.1997 / 23:43:51 / stefan"
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1895
!
40a747a170c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15103
diff changeset
  1896
15344
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1897
compile:code categorized:methodCategory
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1898
    "compile code, aString for this class;
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1899
     if successful update the method dictionary.
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1900
     Returns the new method or nil (on failure)."
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1901
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1902
    ^ self compilerClass
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1903
	compile:code
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1904
	forClass:self
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1905
	inCategory:methodCategory
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1906
	notifying:nil
15344
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1907
!
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1908
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1909
compile:code categorized:methodCategory notifying:requestor
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1910
    "compile code, aString for this class;
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1911
     if successful update the method dictionary.
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1912
     Returns the new method or nil (on failure)."
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1913
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1914
    ^ self compilerClass
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1915
	compile:code
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1916
	forClass:self
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1917
	inCategory:methodCategory
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1918
	notifying:requestor
15344
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1919
!
313226d4ee5a class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15262
diff changeset
  1920
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1921
compile:code notifying:requestor
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1922
    "compile code, aString for this class; on any error, notify
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1923
     requestor, anObject with the error reason.
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1924
     Returns the new method or nil (on failure)."
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1925
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1926
    ^ self compilerClass
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1927
	compile:code
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1928
	forClass:self
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  1929
	notifying:requestor
9639
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1930
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1931
    "Modified: 13.12.1995 / 11:02:40 / cg"
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1932
    "Created: 1.4.1997 / 23:43:43 / stefan"
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1933
! !
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1934
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1935
!Behavior methodsFor:'copying'!
ec0c8078671a boss stuff separated
Claus Gittinger <cg@exept.de>
parents: 9489
diff changeset
  1936
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1937
canCloneFrom:anObject
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1938
    "return true, if this class can clone an obsolete object as retrieved
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1939
     by a binary load. Subclasses which do not want to have obsolete objects
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1940
     be converted, should redefine this method to return false.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1941
     (However, conversion is never done silently in a binary load; you
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1942
      have to have a handler for the binaryload errors and for the conversion
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1943
      request signal.)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1944
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1945
    ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1946
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1947
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1948
cloneFrom:aPrototype
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1949
    "return an instance of myself with variables initialized from
22708
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1950
     a prototype. 
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1951
     This is eg. used when instances of obsolete classes are
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  1952
     binary loaded and a conversion is done on the obsolete object.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1953
     UserClasses may redefine this for better conversions."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1954
4738
fe2a0f7d585e Remove unused method vars.
Stefan Vogel <sv@exept.de>
parents: 4728
diff changeset
  1955
    |newInst indexed|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1956
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1957
    indexed := false.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1958
    aPrototype class isVariable ifTrue:[
22708
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1959
        self isVariable ifTrue:[
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1960
            indexed := true.
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1961
        ].
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1962
        "otherwise, these are lost ..."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1963
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1964
    indexed ifTrue:[
22708
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1965
        newInst := self basicNew:aPrototype basicSize
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1966
    ] ifFalse:[
22708
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1967
        newInst := self basicNew
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1968
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1969
4692
055edf6e95af Redefine #cloneFrom: using #cloneInstanceVariablesFrom:.
Stefan Vogel <sv@exept.de>
parents: 4682
diff changeset
  1970
    newInst cloneInstanceVariablesFrom:aPrototype.
055edf6e95af Redefine #cloneFrom: using #cloneInstanceVariablesFrom:.
Stefan Vogel <sv@exept.de>
parents: 4682
diff changeset
  1971
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1972
    ^ newInst
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1973
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1974
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1975
     Class withoutUpdatingChangesDo:[
22708
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1976
         Point subclass:#Point3D
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1977
           instanceVariableNames:'z'
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1978
           classVariableNames:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1979
           poolDictionaries:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1980
           category:'testing'.
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1981
         (Point3D cloneFrom:1@2) inspect.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1982
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1983
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1984
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1985
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1986
     Class withoutUpdatingChangesDo:[
22708
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1987
         Point variableSubclass:#Point3D
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1988
           instanceVariableNames:'z'
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1989
           classVariableNames:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1990
           poolDictionaries:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1991
           category:'testing'.
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  1992
         (Point3D cloneFrom:#(1 2 3)) inspect.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1993
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1994
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1995
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1996
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1997
     |someObject|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1998
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1999
     Class withoutUpdatingChangesDo:[
22708
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2000
         Object subclass:#TestClass1
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2001
           instanceVariableNames:'foo bar'
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2002
           classVariableNames:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2003
           poolDictionaries:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2004
           category:'testing'.
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2005
         someObject := TestClass1 new.
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2006
         someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2007
         Object subclass:#TestClass2
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2008
           instanceVariableNames:'bar foo'
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2009
           classVariableNames:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2010
           poolDictionaries:''
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2011
           category:'testing'.
d5fdc5d3edfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22441
diff changeset
  2012
         (TestClass2 cloneFrom:someObject) inspect.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2013
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2014
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2015
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2016
10949
ead99e0cfad2 deepCopy change
ab
parents: 10938
diff changeset
  2017
deepCopyUsing:aDictionary postCopySelector:postCopySelector
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2018
    "return a deep copy of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2019
     - return the receiver here - time will show if this is ok"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2020
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2021
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2022
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2023
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2024
simpleDeepCopy
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2025
    "return a deep copy of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2026
     - return the receiver here - time will show if this is ok"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2027
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2028
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2029
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2030
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2031
!Behavior methodsFor:'dummy changes management'!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2032
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2033
addChangeRecordForClassRemove:aClassName
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2034
     "add a change record that some class has been removed.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2035
      Defined as dummy here, since Behavior does not know about change management.
22935
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  2036
      (only Classes do). This allows different Behavior-like  
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  2037
      objects (alien classes) to be handled by the browser as well."
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2038
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2039
    "Created: 16.4.1996 / 16:30:09 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2040
    "Modified: 16.4.1996 / 18:10:35 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2041
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2042
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2043
!Behavior methodsFor:'dummy fileOut'!
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2044
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2045
fileOutDefinitionOn:aStream
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2046
    "dummy fileOut defined here.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2047
     This allows different Behavior-like objects
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2048
     (alien classes) to be handled by the browser as well."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2049
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2050
    ^ self
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2051
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2052
    "Created: 16.4.1996 / 16:28:01 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2053
! !
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2054
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2055
!Behavior methodsFor:'enumerating'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2056
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2057
allDerivedInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2058
    "evaluate aBlock for all of my instances and all instances of subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2059
     This method is going to be removed for protocol compatibility with
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2060
     other STs; use allSubInstancesDo:"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2061
5862
c0ca96f505d7 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5842
diff changeset
  2062
    <resource:#obsolete>
c0ca96f505d7 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5842
diff changeset
  2063
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2064
    self obsoleteMethodWarning:'use #allSubInstancesDo:'.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2065
    self allSubInstancesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2066
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2067
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2068
     StandardSystemView allDerivedInstancesDo:[:v | Transcript showCR:(v name)]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2069
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2070
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2071
    "Modified: 31.7.1997 / 23:05:04 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2072
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2073
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2074
allInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2075
    "evaluate aBlock for all of my instances"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2076
18570
198c3622e7d6 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 18435
diff changeset
  2077
    ObjectMemory allInstancesOf:self do:aBlock.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2078
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2079
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  2080
     StandardSystemView allInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2081
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2082
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2083
7809
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2084
allOwningclassesDo:aBlock
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2085
    "evaluate aBlock for all of my owners (i.e. owner, owner-of-owner etc)."
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2086
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2087
    |owner|
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2088
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2089
    owner := self owningClass.
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2090
    [owner notNil] whileTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2091
	aBlock value:owner.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2092
	owner := owner owningClass.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2093
    ].
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2094
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2095
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2096
     Method::MethodWhoInfo allOwningclassesDo:[:c | Transcript showCR:(c name)]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2097
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2098
!
7809
c5f353b2135a +allOwningClassesDo:
Claus Gittinger <cg@exept.de>
parents: 7800
diff changeset
  2099
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  2100
allSelectorsAndMethodsDo:aTwoArgBlock
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  2101
    "evaluate the argument, aBlock for all selectors of mySelf and my metaclass,
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  2102
     passing the corresponding method as second argument"
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  2103
8353
69f1af98ff91 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 7858
diff changeset
  2104
    <resource: #obsolete>
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2105
    self obsoleteMethodWarning:'use #instAndClassSelectorsAndMethodsDo:'.
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2106
6022
112a2f86608d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6015
diff changeset
  2107
    self selectorsAndMethodsDo:aTwoArgBlock.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2108
    self class selectorsAndMethodsDo:aTwoArgBlock.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2109
!
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  2110
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2111
allSubInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2112
    "evaluate aBlock for all of my instances and all instances of subclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2113
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2114
    ObjectMemory allObjectsDo:[:anObject |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2115
	(anObject isKindOf:self) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2116
	    aBlock value:anObject
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2117
	]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2118
    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2119
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2120
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  2121
     StandardSystemView allSubInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2122
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2123
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2124
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2125
allSubclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2126
    "evaluate aBlock for all of my subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2127
     There is no specific order, in which the entries are enumerated.
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2128
     Warning:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2129
	This will only enumerate globally known classes - for anonymous
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2130
	behaviors, you have to walk over all instances of Behavior."
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2131
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2132
    self allSubclassesInOrderDo:aBlock
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2133
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2134
"/    self isMeta ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2135
"/        "/ metaclasses are not found via Smalltalk allClassesDo:
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2136
"/        "/ here, walk over classes and enumerate corresponding metas.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2137
"/        self soleInstance allSubclassesDo:[:aSubClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2138
"/            aBlock value:(aSubClass class)
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2139
"/        ].
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2140
"/    ] ifFalse:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2141
"/        Smalltalk allClassesDo:[:aClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2142
"/            (aClass isSubclassOf:self) ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2143
"/                aBlock value:aClass
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2144
"/            ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2145
"/        ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2146
"/    ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2147
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2148
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  2149
     Collection allSubclassesDo:[:c | Transcript showCR:(c name)]
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2150
     Collection class allSubclassesDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2151
    "
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2152
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2153
    "Modified: / 25.10.1997 / 21:17:13 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2154
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2155
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2156
allSubclassesInOrderDo:aBlock
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2157
    "evaluate aBlock for all of my subclasses.
21629
69b1f1595325 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21605
diff changeset
  2158
     The subclasses are enumerated breadth first (i.e. all of a classes superclasses
15562
03361352367b class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15344
diff changeset
  2159
     come before a class, which comes before any of its subclasses).
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2160
     However, within one inheritance level, there is no specific order,
15562
03361352367b class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15344
diff changeset
  2161
     in which the entries are enumerated.
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2162
     Warning:
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2163
	This will only enumerate globally known classes - for anonymous
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2164
	behaviors, you have to walk over all instances of Behavior."
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2165
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2166
    |meta toDo cls|
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2167
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2168
    meta := self isMeta.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2169
20024
13ac22ebb436 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19943
diff changeset
  2170
    toDo := self theNonMetaclass subclasses asNewOrderedCollection.
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2171
    [toDo notEmpty] whileTrue:[
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2172
	cls := toDo removeFirst.
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2173
	toDo addAll:cls subclasses.
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2174
	meta ifTrue:[
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2175
	    aBlock value:cls class.
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2176
	] ifFalse:[
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2177
	    aBlock value:cls.
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  2178
	]
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2179
    ].
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2180
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2181
"/    self isMeta ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2182
"/        "/ metaclasses are not found via Smalltalk allClassesDo:
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2183
"/        "/ here, walk over classes and enumerate corresponding metas.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2184
"/        self soleInstance allSubclassesDo:[:aSubClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2185
"/            aBlock value:(aSubClass class)
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2186
"/        ].
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2187
"/    ] ifFalse:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2188
"/        Smalltalk allClassesDo:[:aClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2189
"/            (aClass isSubclassOf:self) ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2190
"/                aBlock value:aClass
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2191
"/            ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2192
"/        ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2193
"/    ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2194
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2195
    "
7435
c5afb1b0fd1b Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2196
     Collection allSubclassesInOrderDo:[:c | Transcript showCR:(c name)]
c5afb1b0fd1b Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2197
     Collection class allSubclassesInOrderDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2198
    "
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  2199
15562
03361352367b class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15344
diff changeset
  2200
    "Modified: / 25-10-1997 / 21:17:13 / cg"
21629
69b1f1595325 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21605
diff changeset
  2201
    "Modified (comment): / 07-03-2017 / 19:14:10 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2202
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2203
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2204
allSuperclassesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2205
    "evaluate aBlock for all of my superclasses"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2206
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2207
    |theClass
16050
95fbf5838a55 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16042
diff changeset
  2208
     n "{ Class: SmallInteger }"|
95fbf5838a55 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16042
diff changeset
  2209
95fbf5838a55 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16042
diff changeset
  2210
    n := 1.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2211
    theClass := self superclass.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2212
    [theClass notNil] whileTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2213
	aBlock value:theClass.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2214
	theClass := theClass superclass.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2215
	n := n + 1.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2216
	n > 100000 ifTrue:[ VMInternalError raiseErrorString:'deep inheritance' ].
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2217
    ]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2218
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2219
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2220
     String allSuperclassesDo:[:c | Transcript showCR:(c name)]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2221
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2222
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2223
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2224
instAndClassMethodsDo:aOneArgBlock
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2225
    "evaluate the argument, aBlock for all methods of mySelf and my metaclass
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2226
     See selectorsAndMethodsDo: for a method which only enumerates methods here."
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2227
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2228
    self theNonMetaclass methodsDo:aOneArgBlock.
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2229
    self theMetaclass    methodsDo:aOneArgBlock.
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2230
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2231
    "Modified (comment): / 10-02-2017 / 10:30:49 / cg"
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2232
!
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2233
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2234
instAndClassSelectorsAndMethodsDo:aTwoArgBlock
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2235
    "evaluate the argument, aBlock for all selectors of mySelf and my metaclass,
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2236
     passing the corresponding method as second argument.
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2237
     This enumerates methods both here and in my corresponding nonMeta/meta class.
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2238
     See selectorsAndMethodsDo: for a method which only enumerates methods here."
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2239
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2240
    self selectorsAndMethodsDo:aTwoArgBlock.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2241
    self class selectorsAndMethodsDo:aTwoArgBlock.
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2242
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2243
    "Modified (comment): / 10-02-2017 / 10:30:28 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2244
!
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2245
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2246
methodsDo:aOneArgBlock
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2247
    "evaluate the argument, aBlock for all my methods.
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2248
     This only enumerates methods contained here,
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2249
     not in my corresponding nonMeta/meta class.
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2250
     See instAndClassMethodsDo: for a method which does this."
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2251
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2252
    self methodDictionary do:aOneArgBlock
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2253
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2254
    "
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2255
     UndefinedObject methodsDo:[:m | Transcript showCR:m whoString]
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2256
     UndefinedObject selectorsDo:[:sym | Transcript showCR:sym]
21052
78f6e1861891 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20976
diff changeset
  2257
     UndefinedObject methodDictionary
78f6e1861891 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20976
diff changeset
  2258
    "
78f6e1861891 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20976
diff changeset
  2259
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2260
    "Modified (comment): / 10-02-2017 / 10:31:17 / cg"
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2261
!
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2262
22027
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2263
privateClassesDo:aBlock
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2264
    "evaluate aBlock on all of my (immediate) private classes (if any).
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2265
     Evaluation is in no particular order."
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2266
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2267
    "/ I have no private class - only Class has."
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2268
    "/ Intentionally left blank
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2269
    ^ self
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2270
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2271
    "Created: / 17-07-2017 / 10:19:19 / cg"
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2272
!
2835965d3bef #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22023
diff changeset
  2273
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2274
selectorsAndMethodsDo:aTwoArgBlock
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  2275
    "evaluate the argument, aBlock for all my selectors,
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2276
     passing the corresponding method as second argument.
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2277
     This only enumerates methods contained here,
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2278
     not in my corresponding nonMeta/meta class.
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2279
     See instAndClassSelectorsAndMethodsDo: for a method which does this."
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2280
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2281
    self methodDictionary keysAndValuesDo:aTwoArgBlock
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2282
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2283
    "Created: / 27-10-1997 / 14:09:27 / cg"
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2284
    "Modified (comment): / 10-02-2017 / 10:29:43 / cg"
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2285
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2286
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2287
selectorsDo:aOneArgBlock
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2288
    "evaluate the argument, aBlock for all my selectors.
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2289
     This only enumerates selectors of methods contained here,
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2290
     not in my corresponding nonMeta/meta class."
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2291
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2292
    self methodDictionary keysDo:aOneArgBlock
21391
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2293
011f12112e92 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21315
diff changeset
  2294
    "Modified (comment): / 10-02-2017 / 10:31:45 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2295
!
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  2296
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2297
subclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2298
    "evaluate the argument, aBlock for all immediate subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2299
     This will only enumerate globally known classes - for anonymous
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2300
     behaviors, you have to walk over all instances of Behavior."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2301
7435
c5afb1b0fd1b Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  2302
    "Do it the hard way. Subclasses redefine this"
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  2303
    Smalltalk allClassesDo:[:aClass |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2304
	(aClass superclass == self) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2305
	    aBlock value:aClass
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2306
	]
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2307
    ]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2308
!
5638
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2309
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2310
whichClassSatisfies: aBlock
12862
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2311
    "return the first class along the superclass-chain, which satisfies aBlock.
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2312
     Return nil, if there is none."
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2313
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2314
    |cls|
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2315
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2316
    cls := self.
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2317
    [cls notNil] whileTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2318
	(aBlock value: cls) ifTrue: [^ cls].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2319
	cls := cls superclass.
12862
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2320
    ].
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2321
    ^ nil
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2322
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2323
    "
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2324
     SimpleView whichClassSatisfies:[:cls | cls instanceVariableNames includes:'gc']
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  2325
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2326
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2327
5638
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2328
withAllSubclassesDo:aBlock
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2329
    "evaluate aBlock for mySelf and all of my subclasses.
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2330
     There is no specific order, in which the entries are enumerated.
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2331
     Warning:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2332
	This will only enumerate globally known classes - for anonymous
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2333
	behaviors, you have to walk over all instances of Behavior."
5638
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2334
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2335
    aBlock value:self.
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2336
    self allSubclassesDo:aBlock
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2337
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2338
    "
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2339
     Collection withAllSubclassesDo:[:c | Transcript showCR:(c name)]
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2340
     Collection class withAllSubclassesDo:[:c | Transcript showCR:(c name)]
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2341
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2342
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2343
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2344
withAllSuperclassesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2345
    "evaluate aBlock for the class and all of its superclasses"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2346
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2347
    aBlock value:self.
16050
95fbf5838a55 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16042
diff changeset
  2348
    self allSuperclassesDo:aBlock
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2349
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2350
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2351
     String withAllSuperclassesDo:[:each| Transcript showCR:each]
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2352
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2353
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2354
14469
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2355
!Behavior methodsFor:'error handling'!
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2356
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2357
abstractClassInstantiationError
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2358
    "sent by an abstract classes redefined new method"
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2359
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2360
    ^ AbstractClassInstantiationError raiseRequest
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2361
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2362
    "Created: / 02-11-2012 / 10:07:01 / cg"
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2363
! !
239e909bf765 added: #abstractClassInstantiationError
Claus Gittinger <cg@exept.de>
parents: 14414
diff changeset
  2364
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2365
!Behavior methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2366
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2367
deinitialize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2368
    "deinitialize is sent to a class before it is physically unloaded.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2369
     This is only done with classes which have been loaded in from a binary
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2370
     file. Classes may release any primitive memory or other stuff which is
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2371
     not visible to smalltalk (for example, release internal memory).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2372
     The default action here is to do nothing."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2373
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2374
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2375
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2376
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2377
initialize
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2378
    "initialize is sent to a class either during startup,
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2379
     (for all statically compiled-in classes) or after a class
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2380
     has been loaded into the system (either bytecodes or machinecode).
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2381
     The default action here is to do nothing."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2382
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2383
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2384
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2385
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2386
postAutoload
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2387
    "postAutoload is sent to a class after it has been autoloaded.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2388
     This gives it a chance to arrange for automatic unloading to be done
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2389
     after a while ...
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2390
     This is NOT sent to statically compiled in or explicitely filedIn
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2391
     classes.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2392
     The default action here is to do nothing."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2393
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2394
    ^ self
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2395
!
328
claus
parents: 325
diff changeset
  2396
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2397
reinitialize
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2398
    "reinitialize is sent to a class when an image has been restarted.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2399
     I.e. when the system is restarted.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2400
     This gives classes a chance to flush any device dependent or otherwise
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2401
     obsolete data which may be a leftover from the previous live.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2402
     The default action here is to do nothing."
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  2403
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2404
    ^ self
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2405
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2406
15230
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
  2407
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2408
!Behavior methodsFor:'instance creation'!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2409
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2410
basicNew
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2411
    "return an instance of myself without indexed variables.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2412
     If the receiver-class has indexed instvars, the new object will have
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2413
     a basicSize of zero -
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2414
     i.e. 'aClass basicNew' is equivalent to 'aClass basicNew:0'.
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2415
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2416
     ** Do not redefine this method in any class **"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2417
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2418
%{  /* NOCONTEXT */
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2419
#ifdef __SCHTEAM__
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2420
    return __c__._RETURN( self.basicNew() );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2421
#else
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  2422
    REGISTER OBJ newobj;
15231
59326b42815a void*/char *
Stefan Vogel <sv@exept.de>
parents: 15230
diff changeset
  2423
    REGISTER char *nextPtr;
14688
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  2424
    unsigned INT instsize;
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  2425
    REGISTER unsigned INT nInstVars;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2426
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2427
    /*
369
claus
parents: 362
diff changeset
  2428
     * the following ugly code is nothing more than a __new() followed
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2429
     * by a nilling of the new instance.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2430
     * Unrolled for a bit more speed since this is one of the central object
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2431
     * allocation methods in the system
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2432
     */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2433
    nInstVars = __intVal(__INST(instSize));
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2434
    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2435
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2436
    newobj = (OBJ) __newNextPtr;
15231
59326b42815a void*/char *
Stefan Vogel <sv@exept.de>
parents: 15230
diff changeset
  2437
    nextPtr = ((char *)newobj) + instsize;
20308
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2438
    // 26-AUG-2016
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2439
    nextPtr = (char *)(__ALIGNED__(nextPtr));
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  2440
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  2441
    /*
15230
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
  2442
     * don't argue about the goto and the arrangement below - it saves
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  2443
     * an extra nil-compare and branch in the common case ...
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2444
     * (i.e. if no GC is needed, we fall through without a branch)
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  2445
     */
15231
59326b42815a void*/char *
Stefan Vogel <sv@exept.de>
parents: 15230
diff changeset
  2446
    if (nextPtr < (char *)__newEndPtr) {
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2447
	__objPtr(newobj)->o_size = instsize;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2448
	/* o_allFlags(newobj) = 0;              */
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2449
	/* __objPtr(newobj)->o_space = __newSpace; */
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2450
	o_setAllFlags(newobj, __newSpace);
20308
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2451
	// 26-AUG-2016
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2452
	__newNextPtr = nextPtr;
20308
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2453
//# ifdef __HAS_ALIGN4__
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2454
//        /*
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2455
//         * if the alignment is 4, we are already sat,
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2456
//         * since a non-indexed object always has a word-aligned size.
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2457
//         */
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2458
//        __newNextPtr = nextPtr;
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2459
//# else
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2460
//        if (instsize & (__ALIGN__-1)) {
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2461
//            __newNextPtr = (char *)newobj + (instsize & ~(__ALIGN__-1)) + __ALIGN__;
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2462
//        } else {
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2463
//            __newNextPtr = nextPtr;
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2464
//        }
9110f117d260 ALIGNMENT code clean up
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  2465
//# endif
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2466
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2467
ok:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2468
	__InstPtr(newobj)->o_class = self;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2469
	__qSTORE(newobj, self);
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2470
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2471
	if (nInstVars) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2472
# if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2473
	    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2474
# else
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2475
	    REGISTER OBJ *op = __InstPtr(newobj)->i_instvars;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2476
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2477
	    /*
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2478
	     * knowing that nil is 0
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2479
	     */
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2480
#  if defined(FAST_OBJECT_MEMSET_DOUBLES_UNROLLED)
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2481
	    if (nInstVars > 8) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2482
		*op++ = nil;    /* for alignment */
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2483
		nInstVars--;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2484
		while (nInstVars >= 8) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2485
		    *(double *)op = 0.0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2486
		    ((double *)op)[1] = 0.0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2487
		    ((double *)op)[2] = 0.0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2488
		    ((double *)op)[3] = 0.0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2489
		    op += 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2490
		    nInstVars -= 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2491
		}
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2492
	    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2493
	    while (nInstVars != 0) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2494
		*op++ = 0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2495
		nInstVars--;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2496
	    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2497
#  else
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2498
#   if defined(FAST_OBJECT_MEMSET_LONGLONG_UNROLLED)
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2499
	    if (nInstVars > 8) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2500
		*op++ = nil;    /* for alignment */
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2501
		nInstVars--;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2502
		while (nInstVars >= 8) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2503
		    *(long long *)op = 0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2504
		    ((long long *)op)[1] = 0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2505
		    ((long long *)op)[2] = 0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2506
		    ((long long *)op)[3] = 0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2507
		    op += 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2508
		    nInstVars -= 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2509
		}
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2510
	    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2511
	    while (nInstVars != 0) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2512
		*op++ = 0;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2513
		nInstVars--;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2514
	    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2515
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2516
#   else
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2517
#    if defined(FAST_OBJECT_MEMSET_WORDS_UNROLLED)
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2518
	    while (nInstVars >= 8) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2519
		*op = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2520
		*(op+1) = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2521
		*(op+2) = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2522
		*(op+3) = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2523
		*(op+4) = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2524
		*(op+5) = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2525
		*(op+6) = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2526
		*(op+7) = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2527
		op += 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2528
		nInstVars -= 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2529
	    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2530
	    while (nInstVars != 0) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2531
		*op++ = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2532
		nInstVars--;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2533
	    }
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2534
#    else
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2535
#     if defined(FAST_MEMSET)
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2536
	    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2537
#     else
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2538
	    while (nInstVars >= 8) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2539
		nInstVars -= 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2540
		op[0] = nil; op[1] = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2541
		op[2] = nil; op[3] = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2542
		op[4] = nil; op[5] = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2543
		op[6] = nil; op[7] = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2544
		op += 8;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2545
	    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2546
	    while (nInstVars != 0) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2547
		*op++ = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2548
		nInstVars--;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2549
	    }
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2550
#     endif
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2551
#    endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2552
#   endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2553
#  endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2554
# endif
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2555
	}
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2556
	RETURN ( newobj );
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  2557
    }
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2558
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2559
    /*
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2560
     * the slow case - a GC will occur
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2561
     */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2562
    __PROTECT_CONTEXT__
14688
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  2563
    newobj = __STX___new((INT)instsize);
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2564
    __UNPROTECT_CONTEXT__
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2565
    if (newobj != nil) goto ok;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2566
#endif /* NOT REACHED */
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2567
%}
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2568
.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2569
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2570
     memory allocation failed.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2571
     When we arrive here, there was no memory, even after
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2572
     a garbage collect.
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2573
     This means, that the VM wanted to get some more memory from the
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2574
     Operatingsystem, which was not kind enough to give it.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2575
     Bad luck - you should increase the swap space on your machine.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2576
    "
20706
009b8269bd08 we have class based exceptions - use them
Claus Gittinger <cg@exept.de>
parents: 20573
diff changeset
  2577
    ^ AllocationFailure raise.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2578
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2579
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2580
basicNew:anInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2581
    "return an instance of myself with anInteger indexed variables.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2582
     If the receiver-class has no indexed instvars, this is only allowed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2583
     if the argument, anInteger is zero.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2584
     ** Do not redefine this method in any class **"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2585
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2586
%{  /* NOCONTEXT */
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2587
#ifdef __SCHTEAM__
18364
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  2588
    if (anInteger.isSmallInteger()) {
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2589
        return __c__._RETURN( self.basicNew( anInteger.intValue()) );
18364
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  2590
    }
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2591
#else
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2592
    OBJ newobj;
14688
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  2593
    unsigned INT nInstVars;
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  2594
    unsigned INT instsize;
19904
28e5df23d412 nindexedinstvars is signed (argument to new may be a bad one)
Claus Gittinger <cg@exept.de>
parents: 19895
diff changeset
  2595
    INT nindexedinstvars;
19348
Stefan Vogel <sv@exept.de>
parents: 19291
diff changeset
  2596
    unsigned INT nBytes;
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2597
    unsigned INT flags;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2598
# if ! defined(FAST_ARRAY_MEMSET)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2599
    REGISTER char *cp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2600
    short *sp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2601
    long *lp;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2602
# endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2603
    REGISTER OBJ *op;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2604
    float *fp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2605
    double *dp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2606
249
claus
parents: 216
diff changeset
  2607
    if (__isSmallInteger(anInteger)) {
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2608
        nindexedinstvars = __intVal(anInteger);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2609
        if (nindexedinstvars >= 0) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2610
            nInstVars = __intVal(__INST(instSize));
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2611
            flags = __intVal(__INST(flags)) & ARRAYMASK;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2612
            switch (flags) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2613
                case BYTEARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2614
                    nBytes = nindexedinstvars + __OBJS2BYTES__(nInstVars);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2615
                    instsize = OHDR_SIZE + nBytes;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2616
                    if (__CanDoQuickNew(instsize)) {        /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2617
                        /*
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2618
                         * the most common case
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2619
                         */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2620
                        __qCheckedNew(newobj, instsize);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2621
                        __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2622
                        __qSTORE(newobj, self);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2623
                nilIt:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2624
                        cp = (char *)__InstPtr(newobj)->i_instvars;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2625
# if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2626
                        memset4(cp, 0, (nBytes+3) >> 2);
19348
Stefan Vogel <sv@exept.de>
parents: 19291
diff changeset
  2627
# elif defined(FAST_ARRAY_MEMSET)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2628
                        memset(cp, 0, nBytes);
357
claus
parents: 356
diff changeset
  2629
# else
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2630
                        while (nBytes >= (sizeof(INT) * 8L)) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2631
                            ((INT *)cp)[0] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2632
                            ((INT *)cp)[1] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2633
                            ((INT *)cp)[2] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2634
                            ((INT *)cp)[3] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2635
                            ((INT *)cp)[4] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2636
                            ((INT *)cp)[5] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2637
                            ((INT *)cp)[6] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2638
                            ((INT *)cp)[7] = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2639
                            cp += (sizeof(INT) * 8L);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2640
                            nBytes -= (sizeof(INT) * 8L);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2641
                        }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2642
                        while (nBytes >= sizeof(INT)) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2643
                            *(INT *)cp = (INT)0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2644
                            cp += sizeof(INT);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2645
                            nBytes -= sizeof(INT);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2646
                        }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2647
                        while (nBytes--)
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2648
                            *cp++ = 0;
357
claus
parents: 356
diff changeset
  2649
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2650
                        RETURN ( newobj );
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2651
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2652
                    __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2653
                    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2654
                    __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2655
                    if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2656
                        break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2657
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2658
                    __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2659
                    __qSTORE(newobj, self);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2660
                    goto nilIt;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2661
                    break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2662
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2663
                case WORDARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2664
                case SWORDARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2665
                    nBytes = __OBJS2BYTES__(nInstVars) + nindexedinstvars * 2;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2666
                    instsize = OHDR_SIZE + nBytes;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2667
                    __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2668
                    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2669
                    __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2670
                    if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2671
                        break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2672
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2673
                    __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2674
                    __qSTORE(newobj, self);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2675
                    goto nilIt;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2676
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2677
               case LONGARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2678
               case SLONGARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2679
                    nBytes = __OBJS2BYTES__(nInstVars) + nindexedinstvars * 4;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2680
                    instsize = OHDR_SIZE + nBytes;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2681
                    __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2682
                    __qNew(newobj, instsize);    /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2683
                    __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2684
                    if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2685
                        break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2686
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2687
                    __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2688
                    __qSTORE(newobj, self);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2689
                    goto nilIt;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2690
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2691
               case LONGLONGARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2692
               case SLONGLONGARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2693
                    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2694
# ifdef __NEED_LONGLONG_ALIGN
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2695
                    instsize = ((instsize-1) + __LONGLONG_ALIGN) & ~(__LONGLONG_ALIGN-1);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2696
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2697
                    instsize += nindexedinstvars * 8;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2698
                    nBytes = instsize - OHDR_SIZE;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2699
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2700
                    __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2701
                    __qNew(newobj, instsize);    /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2702
                    __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2703
                    if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2704
                        break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2705
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2706
                    __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2707
                    __qSTORE(newobj, self);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2708
                    goto nilIt;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2709
                    break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2710
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2711
               case FLOATARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2712
                    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20024
diff changeset
  2713
# ifdef __NEED_FLOATARRAY_ALIGN
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2714
                    instsize = ((instsize-1) + __FLOATARRAY_ALIGN) & ~(__FLOATARRAY_ALIGN-1);
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20024
diff changeset
  2715
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2716
                    instsize += nindexedinstvars * sizeof(float);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2717
                    nBytes = instsize - OHDR_SIZE;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2718
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2719
                    __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2720
                    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2721
                    __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2722
                    if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2723
                        break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2724
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2725
                    __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2726
                    __qSTORE(newobj, self);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2727
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  2728
# if defined(__FLOAT0_IS_INT0) /* knowin that float 0.0 is all-zeros */
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2729
                    goto nilIt;
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  2730
# else
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2731
                    op = __InstPtr(newobj)->i_instvars;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2732
                    while (nInstVars-- != 0)
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2733
                        *op++ = nil;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2734
                    fp = (float *)op;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2735
                    while (nindexedinstvars-- != 0)
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2736
                        *fp++ = 0.0;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2737
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2738
                    RETURN ( newobj );
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2739
                    break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2740
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2741
               case DOUBLEARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2742
                    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2743
# ifdef __NEED_DOUBLE_ALIGN
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2744
                    instsize = ((instsize-1) + __DOUBLE_ALIGN) & ~(__DOUBLE_ALIGN-1);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2745
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2746
                    instsize += nindexedinstvars * sizeof(double);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2747
                    nBytes = instsize - OHDR_SIZE;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2748
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2749
                    __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2750
                    __qNew(newobj, instsize);    /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2751
                    __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2752
                    if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2753
                        break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2754
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2755
                    __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2756
                    __qSTORE(newobj, self);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2757
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2758
# if defined(__DOUBLE0_IS_INT0) /* knowin that double 0.0 is all-zeros */
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2759
                    goto nilIt;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2760
# else
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2761
                    op = __InstPtr(newobj)->i_instvars;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2762
                    while (nInstVars-- != 0)
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2763
                        *op++ = nil;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2764
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2765
#  ifdef __NEED_DOUBLE_ALIGN
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2766
                    /*
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2767
                     * care for double alignment
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2768
                     * add filler.
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2769
                     */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2770
                    if ((INT)op & (__DOUBLE_ALIGN-1)) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2771
                        *op++ = nil;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2772
                    }
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2773
#  endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2774
                    dp = (double *)op;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2775
                    while (nindexedinstvars-- != 0)
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2776
                        *dp++ = 0.0;
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2777
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2778
                    RETURN ( newobj );
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2779
                    break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2780
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2781
                case WKPOINTERARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2782
                case POINTERARRAY:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2783
                    nInstVars += nindexedinstvars;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2784
                    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2785
                    __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2786
                    __qNew(newobj, instsize);    /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2787
                    __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2788
                    if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2789
                        break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2790
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2791
                    __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2792
                    __qSTORE(newobj, self);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2793
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2794
# if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2795
                    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2796
# else
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2797
                    /*
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2798
                     * knowing that nil is 0
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2799
                     */
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2800
#  ifdef sparc
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2801
#   define FAST_ARRAY_MEMSET_DOUBLES_UNROLLED
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2802
#  endif
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2803
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2804
#  if defined(FAST_ARRAY_MEMSET_DOUBLES_UNROLLED)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2805
                    op = __InstPtr(newobj)->i_instvars;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2806
                    if (nInstVars > 8) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2807
                        *op++ = nil;    /* for alignment */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2808
                        nInstVars--;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2809
                        while (nInstVars >= 8) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2810
                            *(double *)op = 0.0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2811
                            ((double *)op)[1] = 0.0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2812
                            ((double *)op)[2] = 0.0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2813
                            ((double *)op)[3] = 0.0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2814
                            op += 8;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2815
                            nInstVars -= 8;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2816
                        }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2817
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2818
                    while (nInstVars != 0) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2819
                        *op++ = 0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2820
                        nInstVars--;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2821
                    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2822
#  else
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2823
#   if defined(FAST_ARRAY_MEMSET_LONGLONG_UNROLLED)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2824
                    op = __InstPtr(newobj)->i_instvars;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2825
                    if (nInstVars > 8) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2826
                        *op++ = nil;    /* for alignment */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2827
                        nInstVars--;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2828
                        while (nInstVars >= 8) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2829
                            *(long long *)op = 0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2830
                            ((long long *)op)[1] = 0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2831
                            ((long long *)op)[2] = 0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2832
                            ((long long *)op)[3] = 0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2833
                            op += 8;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2834
                            nInstVars -= 8;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2835
                        }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2836
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2837
                    while (nInstVars != 0) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2838
                        *op++ = 0;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2839
                        nInstVars--;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2840
                    }
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2841
#   else
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2842
#    if defined(FAST_ARRAY_MEMSET)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2843
                    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2844
#    else
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2845
                    op = __InstPtr(newobj)->i_instvars;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2846
                    while (nInstVars >= 8) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2847
                        nInstVars -= 8;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2848
                        op[0] = nil; op[1] = nil;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2849
                        op[2] = nil; op[3] = nil;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2850
                        op[4] = nil; op[5] = nil;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2851
                        op[6] = nil; op[7] = nil;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2852
                        op += 8;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2853
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2854
                    while (nInstVars-- != 0)
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2855
                        *op++ = nil;
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2856
#    endif
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2857
#   endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2858
#  endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2859
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2860
                    RETURN ( newobj );
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2861
                    break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2862
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2863
                default:
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2864
                    /*
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2865
                     * new:n for non-variable classes only allowed if
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2866
                     * n == 0
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2867
                     */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2868
                    if (nindexedinstvars == 0) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2869
                        instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2870
                        __PROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2871
                        __qNew(newobj, instsize);        /* OBJECT ALLOCATION */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2872
                        __UNPROTECT_CONTEXT__
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2873
                        if (newobj == nil) {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2874
                            break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2875
                        }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2876
                        __InstPtr(newobj)->o_class = self;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2877
                        __qSTORE(newobj, self);
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2878
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2879
                        if (nInstVars) {
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2880
# if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2881
                            memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2882
# else
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2883
#  if defined(FAST_MEMSET)
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2884
                            /*
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2885
                             * knowing that nil is 0
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2886
                             */
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2887
                            memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2888
#  else
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2889
                            op = __InstPtr(newobj)->i_instvars;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2890
                            do {
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2891
                                *op++ = nil;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2892
                            } while (--nInstVars != 0);
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2893
#  endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2894
# endif
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2895
                        }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2896
                        RETURN ( newobj );
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2897
                    }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2898
                    break;
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2899
            }
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2900
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2901
    }
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2902
#endif /* not SCHTEAM */
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2903
%}.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2904
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2905
     arrive here if something went wrong ...
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2906
     figure out what it was
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2907
    "
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2908
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2909
    (anInteger isMemberOf:SmallInteger) ifFalse:[
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2910
        "
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2911
         the argument is either not an integer,
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2912
         or a LargeInteger (which means that its definitely too big)
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2913
        "
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2914
        self argumentError:'argument to new: must be Integer' with:anInteger.
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2915
        ^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2916
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2917
    (anInteger < 0) ifTrue:[
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2918
        "
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2919
         the argument is negative,
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2920
        "
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2921
        self argumentError:'bad (negative) argument to new:' with:anInteger.
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2922
        ^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2923
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2924
    self isVariable ifFalse:[
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2925
        "
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2926
         this class does not have any indexed instance variables
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2927
        "
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2928
        self argumentError:'class has no indexed instvars - cannot create with new:'.
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2929
        ^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2930
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2931
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2932
     memory allocation failed.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2933
     When we arrive here, there was no memory, even after
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2934
     a garbage collect.
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2935
     This means, that the VM wanted to get some more memory from the
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2936
     Operatingsystem, which was not kind enough to give it.
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2937
     Bad luck - you should increase the swap space on your machine.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2938
    "
20706
009b8269bd08 we have class based exceptions - use them
Claus Gittinger <cg@exept.de>
parents: 20573
diff changeset
  2939
    ^ AllocationFailure raise.
23278
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2940
dbe7d04af1a2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23240
diff changeset
  2941
    "Modified: / 14-08-2018 / 10:54:18 / Claus Gittinger"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2942
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2943
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2944
decodeFromLiteralArray:anArray
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2945
    "create & return a new instance from information encoded in anArray."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2946
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2947
    ^ self new fromLiteralArrayEncoding:anArray.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2948
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2949
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2950
     Rectangle
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2951
	decodeFromLiteralArray:#(Rectangle 10 10 100 100)
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2952
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2953
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2954
    "Modified: / 28.1.1998 / 17:40:30 / cg"
2370
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2955
!
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2956
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2957
new
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2958
    "return an instance of myself without indexed variables"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2959
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2960
    ^ self basicNew
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2961
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2962
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2963
new:anInteger
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2964
    "return an instance of myself with anInteger indexed variables"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2965
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2966
    ^ self basicNew:anInteger
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2967
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2968
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2969
niceBasicNew:anInteger
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2970
    "same as basicNew:anInteger, but tries to avoid long pauses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2971
     due to garbage collection. This method checks to see if
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2972
     allocation is possible without a pause, and does a background
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2973
     incremental garbage collect first if there is not enough memory
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2974
     available at the moment for fast allocation.
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2975
     This is useful in low-priority background processes which like to
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2976
     avoid disturbing any higher priority foreground process while allocating
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2977
     big amounts of memory. Of course, using this method only makes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2978
     sense for big or huge objects (say > 200k).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2979
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2980
     EXPERIMENTAL: this is a non-standard interface and should only
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2981
     be used for special applications. There is no guarantee, that this
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2982
     method will be available in future ST/X releases."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2983
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2984
    |size|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2985
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2986
    size := self sizeOfInst:anInteger.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2987
    (ObjectMemory checkForFastNew:size) ifFalse:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2988
	"
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2989
	 incrementally collect garbage
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2990
	"
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  2991
	ObjectMemory incrementalGC.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2992
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2993
    ^ self basicNew:anInteger
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2994
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2995
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  2996
readFrom:aStream
22935
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  2997
    "read an object's printed representation from the argument, aStream
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  2998
     and return it.
21424
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  2999
     The read object must be a kind of myself;
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  3000
     if it's not, an error is raised.
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  3001
     This is the reverse operation to 'storeOn:'.
43
00ca34676cbf *** empty log message ***
claus
parents: 25
diff changeset
  3002
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3003
     WARNING: storeOn: does not handle circular references and multiple
22935
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  3004
              references to the same object.
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  3005
              Use #storeBinary:/readBinaryFrom: for this."
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3006
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3007
    ^ self
22935
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  3008
        readFrom:aStream
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  3009
        onError:[ self conversionErrorSignal
21b27365d08b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22708
diff changeset
  3010
                    raiseWith:aStream errorString:' for: ' , self name ]
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  3011
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3012
    "
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3013
     |s|
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  3014
     s := WriteStream on:String new.
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  3015
     #(1 2 3 4) storeOn:s.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3016
     Object readFrom:(ReadStream on:s contents)
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  3017
    "
21424
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  3018
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  3019
    "Modified (comment): / 13-02-2017 / 19:55:37 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3020
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3021
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3022
readFrom:aStream onError:exceptionBlock
15862
ea0f876d7b1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15785
diff changeset
  3023
    "read an object's printed representation from the argument, aStream
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3024
     and return it (i.e. the stream should contain some representation of
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3025
     the object which was created using #storeOn:).
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3026
     The read object must be a kind of myself.
19649
cb8cf22fbb97 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 19602
diff changeset
  3027
     If it's not, the value of exceptionBlock is returned.
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3028
     To get any object, use 'Object readFrom:...',
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3029
     To get any number, use 'Number readFrom:...' and so on.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3030
     This is the reverse operation to 'storeOn:'.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3031
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3032
     WARNING: storeOn: does not handle circular references and multiple
23049
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3033
              references to the same object.
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3034
              Use #storeBinary:/readBinaryFrom: for this."
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3035
6627
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  3036
    ^ [
23049
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3037
        |newObject|
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3038
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3039
        newObject := self evaluatorClass evaluateFrom:aStream ifFail:[^ exceptionBlock value].
24505
d6fd2fc59509 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24479
diff changeset
  3040
        "ProtoObjects do not inherit from Object. Take care when restoring them"
d6fd2fc59509 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24479
diff changeset
  3041
        ((newObject class == self) 
d6fd2fc59509 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24479
diff changeset
  3042
         or:[(newObject isKindOf:self) 
d6fd2fc59509 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24479
diff changeset
  3043
         or:[self == Object and:[newObject isProtoObject]]])
23049
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3044
            ifTrue:[newObject]
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3045
            ifFalse:[exceptionBlock value].
6627
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  3046
    ] on:Error do:exceptionBlock.
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3047
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3048
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3049
     |s|
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3050
     s := WriteStream on:String new.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3051
     #(1 2 3 4) storeOn:s.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  3052
     Transcript showCR:(
23049
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3053
        Array readFrom:(ReadStream on:s contents) onError:'not an Array'
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3054
     )
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3055
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3056
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3057
     |s|
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3058
     s := WriteStream on:String new.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3059
     #[1 2 3 4] storeOn:s.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  3060
     Transcript showCR:(
23049
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3061
         Array readFrom:(ReadStream on:s contents) onError:'not an Array'
345
claus
parents: 343
diff changeset
  3062
     )
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3063
    "
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  3064
    "
23593
86a20df2c254 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23379
diff changeset
  3065
     Object readFrom:'''abc''' onError:['bla']
6627
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  3066
     Object readFrom:'illegal' onError:['bla']
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  3067
     String readFrom:'illegal' onError:'bla'
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  3068
    "
21482
4a261f7b1174 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21424
diff changeset
  3069
4a261f7b1174 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21424
diff changeset
  3070
    "Modified: / 16-02-2017 / 21:26:38 / stefan"
22128
d7fc6efe8cc5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22027
diff changeset
  3071
    "Modified: / 28-07-2017 / 18:58:13 / cg"
23049
b88087dd4b13 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23010
diff changeset
  3072
    "Modified: / 05-06-2018 / 12:11:48 / Stefan Vogel"
24505
d6fd2fc59509 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24479
diff changeset
  3073
    "Modified (format): / 01-08-2019 / 18:02:49 / Stefan Vogel"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3074
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3075
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3076
readFromString:aString
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3077
    "create an object from its printed representation.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3078
     For most classes, the string is expected to be in a format created by
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3079
     storeOn: or storeString; however, some (Time, Date) expect a user
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3080
     readable string here.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3081
     See comments in Behavior>>readFromString:onError:,
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3082
     Behavior>>readFrom: and Behavior>>readFrom:onError:"
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  3083
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3084
    ^ self
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  3085
	readFromString:aString
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  3086
	onError:[
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  3087
	    self conversionErrorSignal raiseWith:aString errorString:' - expected: ' , self name
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  3088
	]
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3089
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3090
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3091
     Integer readFromString:'12345678901234567890'
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3092
     Point readFromString:'1@2'
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3093
     Point readFromString:'1'
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3094
    "
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3095
!
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3096
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3097
readFromString:aString onError:exceptionBlock
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3098
    "create an object from its printed representation.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3099
     Here, the string is expected to be in a format created by
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3100
     storeOn: or storeString;
9196
a6d45629bb3b readFromString allows for whiteSpace after reading
Claus Gittinger <cg@exept.de>
parents: 9194
diff changeset
  3101
     However, some classes (Time, Date) may redefine it to expect a user readable string here.
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3102
     See comments in Behavior>>readFrom: and Behavior>>readFrom:onError:"
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3103
8531
2bbe01cfb56f differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents: 8529
diff changeset
  3104
    |str val|
2bbe01cfb56f differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents: 8529
diff changeset
  3105
2bbe01cfb56f differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents: 8529
diff changeset
  3106
    str := ReadStream on:aString.
2bbe01cfb56f differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents: 8529
diff changeset
  3107
    val := self readFrom:str onError:[^ exceptionBlock value].
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3108
    str atEnd ifFalse:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3109
	str skipSeparators.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3110
	str atEnd ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3111
	    ^ exceptionBlock value
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3112
	]
9196
a6d45629bb3b readFromString allows for whiteSpace after reading
Claus Gittinger <cg@exept.de>
parents: 9194
diff changeset
  3113
    ].
8531
2bbe01cfb56f differenciate between readFrom: (which allows more text after read part)
Claus Gittinger <cg@exept.de>
parents: 8529
diff changeset
  3114
    ^ val
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3115
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3116
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3117
     Integer readFromString:'12345678901234567890'
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3118
     Integer readFromString:'abc'
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  3119
     Integer readFromString:'abc' onError:0
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3120
     Point readFromString:'1@2'
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3121
     Point readFromString:'0'
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3122
     Point readFromString:'0' onError:[0@0]
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  3123
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3124
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3125
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3126
uninitializedNew
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3127
    "create an instance of myself with uninitialized contents.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3128
     For all classes except ByteArray, this is the same as #basicNew."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3129
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3130
    ^ self basicNew
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3131
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3132
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3133
uninitializedNew:anInteger
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3134
    "create an instance of myself with uninitialized contents.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3135
     For all classes except ByteArray, this is the same as #basicNew:."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3136
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3137
    ^ self basicNew:anInteger
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3138
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3139
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  3140
!Behavior methodsFor:'misc ui support'!
3619
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3141
4928
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  3142
browse
18908
0150d9a27bc0 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18906
diff changeset
  3143
    "open a browser showing the receiver. Returns the browser"
0150d9a27bc0 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18906
diff changeset
  3144
0150d9a27bc0 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18906
diff changeset
  3145
    ^ self browserClass openInClass:self
4928
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  3146
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  3147
    "
5546
934ca7bfecc6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5517
diff changeset
  3148
     Array browserClass
4928
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  3149
     Array browse
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  3150
    "
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  3151
!
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  3152
17633
1657ab5d1b35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17591
diff changeset
  3153
browse:selector
18908
0150d9a27bc0 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18906
diff changeset
  3154
    "open a browser showing the receiver.
0150d9a27bc0 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18906
diff changeset
  3155
     Returns the browser"
0150d9a27bc0 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18906
diff changeset
  3156
0150d9a27bc0 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18906
diff changeset
  3157
    ^ self browserClass openInClass:self selector:selector
17633
1657ab5d1b35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17591
diff changeset
  3158
1657ab5d1b35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17591
diff changeset
  3159
    "
1657ab5d1b35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17591
diff changeset
  3160
     Array browse:#at:put:
1657ab5d1b35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17591
diff changeset
  3161
    "
1657ab5d1b35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17591
diff changeset
  3162
!
1657ab5d1b35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17591
diff changeset
  3163
8725
4cdbbbc7615c *** empty log message ***
james
parents: 8562
diff changeset
  3164
classOperationsMenu
13260
c0f943d9b4df comment
Claus Gittinger <cg@exept.de>
parents: 13215
diff changeset
  3165
    "a chance to return additional menu items for the browser's class-menu"
8725
4cdbbbc7615c *** empty log message ***
james
parents: 8562
diff changeset
  3166
4cdbbbc7615c *** empty log message ***
james
parents: 8562
diff changeset
  3167
    ^ nil
13260
c0f943d9b4df comment
Claus Gittinger <cg@exept.de>
parents: 13215
diff changeset
  3168
c0f943d9b4df comment
Claus Gittinger <cg@exept.de>
parents: 13215
diff changeset
  3169
    "Modified: / 31-01-2011 / 11:05:49 / cg"
8725
4cdbbbc7615c *** empty log message ***
james
parents: 8562
diff changeset
  3170
!
4cdbbbc7615c *** empty log message ***
james
parents: 8562
diff changeset
  3171
3619
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3172
sourceCodeTemplate
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3173
    ^ 'messageSelector and arguments
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3174
    "method comment - purpose of message"
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3175
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3176
    |temporaries|
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3177
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3178
    statements
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3179
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3180
    "
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3181
     example uses
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3182
    "
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3183
'
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3184
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3185
    "Created: / 19.6.1998 / 02:14:02 / cg"
17674
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3186
!
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3187
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3188
toolListIcon
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3189
    "VisualWorks icon retrieval for the browser list.
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3190
     Only redefined in VW classes.
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  3191
     Notice, that ST/X uses a better scheme, where the class only
17674
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3192
     returns a symbol, which is used to map into the icon library.
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3193
     Thus allowing different icons as per view style"
a5831f576b78 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17646
diff changeset
  3194
18147
a32fa9214805 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18146
diff changeset
  3195
    ^ nil
3619
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3196
! !
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  3197
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3198
!Behavior methodsFor:'printing & storing'!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3199
14288
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3200
displayOn:aGCOrStream
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3201
    "return a string to display the receiver - include the
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3202
     count for your convenience.
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3203
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3204
     although behaviors have no name, we return something
10085
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  3205
     useful here - there are many places (inspectors) where
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  3206
     a classes name is asked for.
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  3207
     Implementing this message here allows instances of anonymous classes
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  3208
     to show a reasonable name."
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  3209
14288
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3210
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
21532
bd59cd746b98 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 21482
diff changeset
  3211
    "/ old ST80 means: draw-yourself on a GC.
14288
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3212
    (aGCOrStream isStream) ifFalse:[
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  3213
	^ super displayOn:aGCOrStream
14288
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3214
    ].
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3215
d30ff513d793 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14259
diff changeset
  3216
    aGCOrStream nextPutAll:self name
21532
bd59cd746b98 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 21482
diff changeset
  3217
bd59cd746b98 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 21482
diff changeset
  3218
    "Modified (format): / 22-02-2017 / 17:03:58 / cg"
10085
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  3219
!
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  3220
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3221
printOn:aStream
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3222
    aStream nextPutAll:(self name).
6590
53ad98dc93ef *** empty log message ***
penk
parents: 6589
diff changeset
  3223
! !
6589
cf52ed7e5601 *** empty log message ***
penk
parents: 6477
diff changeset
  3224
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3225
!Behavior methodsFor:'private-accessing'!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3226
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3227
flags:aNumber
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3228
    "set the flags.
16016
125e360f8867 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15986
diff changeset
  3229
     see flagXXX methods on my class side for details.
15102
3cc5739645dc class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15067
diff changeset
  3230
     This method is for special uses only - there will be no recompilation
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3231
     and no change record written here;
15262
5047292c9107 all stx macros begin with double underline (eg. __qClass instead of _qClass)
Claus Gittinger <cg@exept.de>
parents: 15231
diff changeset
  3232
     Warning:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3233
	the flags slot specifies the layout and behavior of my instances slots
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3234
	and affects both the VM's and the class library's behavior.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3235
	It is required to be consistent and correct.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3236
	Setting it to a wrong value may severely affect the system's operation,
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3237
	and even crash the system (in the garbage collector).
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3238
	Do NOT use it, unless you really know what you are doing."
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3239
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3240
    flags := aNumber
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3241
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3242
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3243
instSize:aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3244
    "set the instance size.
15102
3cc5739645dc class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15067
diff changeset
  3245
     This method is for special uses only - there will be no recompilation
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3246
     and no change record written here;
15262
5047292c9107 all stx macros begin with double underline (eg. __qClass instead of _qClass)
Claus Gittinger <cg@exept.de>
parents: 15231
diff changeset
  3247
     Warning:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3248
	the instSize slot specifies the size of my instances and affects
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3249
	both the VM's and the class library's behavior.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3250
	It is required to be consistent and correct.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3251
	Setting it to a wrong value may severely affect the system's operation,
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3252
	and even crash the system (in the garbage collector).
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3253
	Do NOT use it, unless you really know what you are doing."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3254
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3255
    instSize := aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3256
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3257
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3258
primAddSelector:aSelector withMethod:newMethod
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3259
    "add the method given by 2nd argument under the selector given by
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3260
     the 1st argument to the methodDictionary.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3261
     Does NOT flush any caches, does NOT write a change record.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3262
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3263
     Do not use this in normal situations, strange behavior will be
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3264
     the consequence.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3265
     I.e. executing obsolete methods, since the old method will still
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3266
     be executed out of the caches."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3267
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3268
    |dict oldMethod|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3269
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3270
    newMethod isNil ifTrue:[
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  3271
        ArgumentError raiseErrorString:'invalid method'.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3272
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3273
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3274
    dict := self methodDictionary.
15230
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
  3275
    oldMethod := dict at:aSelector ifAbsent:nil.
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
  3276
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
  3277
    (Smalltalk
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  3278
            changeRequest:#methodInClass
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  3279
            with:(Array with:self with:aSelector with:oldMethod)) ifFalse:[
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  3280
        ^ false
15230
7584977d5920 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15125
diff changeset
  3281
    ].
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3282
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3283
    self setMethodDictionary:(dict at:aSelector putOrAppend:newMethod).
7123
2af84f5b1447 pre-set the methods mclass cache when adding a method
Claus Gittinger <cg@exept.de>
parents: 6968
diff changeset
  3284
    newMethod mclass:self.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3285
18435
b58b1b222873 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 18424
diff changeset
  3286
    ObjectMemory flushCachesForSelector:aSelector numArgs:newMethod argumentCount.
11578
30909b044a03 updateRequests
ca
parents: 11574
diff changeset
  3287
    ^ true
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3288
9445
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  3289
    "Modified: / 07-06-1996 / 14:48:45 / stefan"
10693
d397d49e1134 changed #primAddSelector:withMethod:
Claus Gittinger <cg@exept.de>
parents: 10669
diff changeset
  3290
    "Modified: / 31-08-2007 / 16:53:20 / cg"
24273
54d3e4370077 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23876
diff changeset
  3291
    "Modified: / 06-06-2019 / 23:28:16 / Claus Gittinger"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3292
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3293
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3294
setMethodDictionary:dict
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  3295
    "set the receiver's method dictionary.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3296
     Convert dict to a MethodDictionary if necessary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3297
     Do not flush inline caches, therefore old cached methods may be executed
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3298
     after this call"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3299
18424
280626c612bc comment
Claus Gittinger <cg@exept.de>
parents: 18402
diff changeset
  3300
%{
280626c612bc comment
Claus Gittinger <cg@exept.de>
parents: 18402
diff changeset
  3301
#ifdef __SCHTEAM__
280626c612bc comment
Claus Gittinger <cg@exept.de>
parents: 18402
diff changeset
  3302
    self.instVarAt_put(I_methodDictionary, dict);
280626c612bc comment
Claus Gittinger <cg@exept.de>
parents: 18402
diff changeset
  3303
    return __c__._RETURN(self);
280626c612bc comment
Claus Gittinger <cg@exept.de>
parents: 18402
diff changeset
  3304
#endif
280626c612bc comment
Claus Gittinger <cg@exept.de>
parents: 18402
diff changeset
  3305
%}.
2228
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  3306
    "/ since the only thing the VM is prepared to deal with are
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  3307
    "/ proper methodDictionaries (it cannot do another message send, to
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  3308
    "/ find any methods ...), we convert it here if required.
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  3309
    "/ No other classes instances are allowed.
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  3310
23826
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3311
    dict class == MethodDictionary ifTrue:[
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3312
        methodDictionary := dict.
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3313
    ] ifFalse:[
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3314
        (dict class inheritsFrom:MethodDictionary) ifTrue:[
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3315
            "/ the VM can handle those
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3316
            methodDictionary := dict.
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3317
        ] ifFalse:[    
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3318
            methodDictionary := MethodDictionary withAll:dict.
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3319
            methodDictionary isNil ifTrue:[
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  3320
                "/ refuse to do this.
23826
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3321
                "/ (can only happen in case of memory allocation trouble,
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  3322
                "/  where the allocation failed and some exception handler returned nil)
23826
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3323
                self proceedableError:'cannot set methodDictionary to nil'.
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3324
                ^ self.
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3325
            ]
23010
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  3326
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3327
    ].
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  3328
    ^ self.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3329
23010
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  3330
    "Created: / 05-06-1996 / 11:29:36 / stefan"
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  3331
    "Modified: / 12-06-1996 / 13:58:55 / stefan"
73f892ed003c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23007
diff changeset
  3332
    "Modified: / 22-01-1997 / 21:10:48 / cg"
23826
f122be17a8d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23593
diff changeset
  3333
    "Modified: / 03-03-2019 / 20:06:57 / Claus Gittinger"
23876
bae22b8411f9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23826
diff changeset
  3334
    "Modified (format): / 12-03-2019 / 20:47:47 / Claus Gittinger"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3335
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3336
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3337
setSuperclass:aClass
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3338
    "set the superclass of the receiver.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3339
     this method is for special uses only - there will be no recompilation
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3340
     and no change record written here. Also, if the receiver class has
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3341
     already been in use, future operation of the system is not guaranteed to
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3342
     be correct, since no caches are flushed.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3343
     Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3344
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3345
    superclass := aClass
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3346
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3347
    "Modified: 3.3.1997 / 13:27:00 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3348
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3349
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3350
setSuperclass:aClass instSize:i
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3351
    "set some inst vars.
5906
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3352
     this method is for special uses only - there will be no recompilation
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3353
     and no change record is written here. Also, if the receiver class has
5906
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3354
     already been in use, future operation of the system is not guaranteed to
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3355
     be correct, since no caches are flushed.
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3356
     Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)"
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3357
19270
e73f2c974712 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19194
diff changeset
  3358
    superclass := aClass.
5906
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3359
    instSize := i.
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3360
!
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  3361
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3362
setSuperclass:aClass methodDictionary:d instSize:i flags:f
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3363
    "set some inst vars.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3364
     this method is for special uses only - there will be no recompilation
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3365
     and no change record is written here. Also, if the receiver class has
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3366
     already been in use, future operation of the system is not guaranteed to
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3367
     be correct, since no caches are flushed.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3368
     Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3369
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3370
    self setMethodDictionary:d.
19270
e73f2c974712 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 19194
diff changeset
  3371
    superclass := aClass.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3372
    instSize := i.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3373
    flags := f
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3374
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3375
    "Created: 7.6.1996 / 08:41:20 / stefan"
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3376
    "Modified: 22.1.1997 / 18:42:12 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3377
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3378
7260
edfa8d6a6046 method category rename
Claus Gittinger <cg@exept.de>
parents: 7224
diff changeset
  3379
!Behavior methodsFor:'private-helpers'!
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3380
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3381
addAllClassVarNamesTo:aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3382
    "helper - add the name-strings of the class variables and of the class-vars
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3383
     of all superclasses to the argument, aCollection. Return aCollection"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3384
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3385
    |classvars superclass|
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3386
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3387
    superclass := self superclass.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3388
    (superclass notNil) ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3389
	superclass addAllClassVarNamesTo:aCollection
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3390
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3391
    (classvars := self classVariableString) notNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3392
	aCollection addAll:(classvars asCollectionOfWords).
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3393
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3394
    ^ aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3395
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3396
    "Created: 16.4.1996 / 18:00:38 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3397
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3398
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3399
addAllInstVarNamesTo:aCollection
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3400
    "helper for allInstVarNames - add the name-strings of the instance variables
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3401
     and of the inst-vars of all superclasses to the argument, aCollection.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3402
     Return aCollection."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3403
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3404
    |superclass|
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3405
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3406
    superclass := self superclass.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3407
    (superclass notNil) ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3408
	superclass addAllInstVarNamesTo:aCollection
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3409
    ].
5512
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  3410
    aCollection addAll:self instVarNames.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3411
    ^ aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3412
5512
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  3413
    "
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  3414
     SortedCollection allInstVarNames
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  3415
     SortedCollection instVarNames
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  3416
    "
4371
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  3417
!
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  3418
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3419
getLookupObject
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3420
    "return the lookupObject (Jan's MetaObjectProtocol support) or nil.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3421
     If non-nil, no lookup is performed by the VM, instead the lookupObject
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3422
     has to provide a method object for message sends."
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3423
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  3424
    ^ lookupObject
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3425
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3426
    "Created: / 26-04-2010 / 13:36:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3427
!
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3428
18367
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  3429
setLookupObject:aLookupObjectOrNil
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3430
    "set the lookupObject (Jan's MetaObjectProtocol support) or nil.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3431
     If non-nil, no lookup is performed by the VM, instead the lookupObject
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3432
     has to provide a method object for message sends."
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3433
18367
d657e5e06c1d class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18364
diff changeset
  3434
    lookupObject ~~ aLookupObjectOrNil ifTrue:[
18402
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  3435
	lookupObject := aLookupObjectOrNil.
b702d11f9a32 array-long set seems to be broken
Claus Gittinger <cg@exept.de>
parents: 18369
diff changeset
  3436
	self withAllSubclassesDo:[:cls | ObjectMemory flushCachesFor: cls]
14535
45cf589372fa class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14504
diff changeset
  3437
    ]
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3438
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  3439
    "Modified: / 22-07-2010 / 18:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3440
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3441
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3442
!Behavior methodsFor:'queries'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3443
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3444
category
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3445
    "return the category of the class.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3446
     Returning nil here, since Behavior does not define a category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3447
     (only ClassDescriptions do)."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3448
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3449
    ^ nil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3450
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3451
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3452
     Point category
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3453
     Behavior new category
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3454
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3455
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3456
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3457
comment
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3458
    "return the comment of the class.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3459
     Returning nil here, since Behavior does not define a category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3460
     (only Classes do). This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3461
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3462
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3463
    ^ nil
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3464
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3465
    "Modified: 16.4.1996 / 16:25:23 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3466
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3467
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3468
definitionSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3469
    "return the selector with which I was (can be) defined in my superclass"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3470
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3471
    ^ (self firstDefinitionSelectorPart
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3472
      ,
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3473
      'instanceVariableNames:classVariableNames:poolDictionaries:category:') asSymbol
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3474
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3475
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3476
     Object definitionSelector
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3477
     Array definitionSelector
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3478
     ByteArray definitionSelector
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3479
     FloatArray definitionSelector
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3480
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3481
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3482
    "Modified: 3.3.1997 / 11:50:37 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3483
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3484
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3485
definitionSelectorPrivate
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3486
    "return the selector with which I was (can be) defined in my superclass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3487
     as a private class"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3488
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3489
    ^ (self firstDefinitionSelectorPart
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3490
      ,
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3491
      'instanceVariableNames:classVariableNames:poolDictionaries:privateIn:') asSymbol
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3492
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3493
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3494
     Array definitionSelector
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3495
     Array definitionSelectorPrivate
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3496
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3497
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3498
    "Modified: 23.6.1997 / 10:45:57 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3499
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3500
15103
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3501
environment
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3502
    "return the namespace I am contained in; ST-80 compatible name.
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3503
     Not normally needed here, but added to allow for instances of anonymous behaviours
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3504
     to be inspected or browsed."
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3505
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3506
    ^ nil
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3507
!
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3508
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3509
firstDefinitionSelectorPart
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3510
    "return the first part of the selector with which I was (can be) defined in my superclass"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3511
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3512
    self isVariable ifFalse:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3513
	^ #'subclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3514
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3515
    self isBytes ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3516
	^ #'variableByteSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3517
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3518
    self isLongs ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3519
	^ #'variableLongSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3520
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3521
    self isFloats ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3522
	^ #'variableFloatSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3523
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3524
    self isDoubles ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3525
	^ #'variableDoubleSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3526
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3527
    self isWords ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3528
	^ #'variableWordSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3529
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3530
    self isSignedWords ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3531
	^ #'variableSignedWordSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3532
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3533
    self isSignedLongs ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3534
	^ #'variableSignedLongSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3535
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3536
    self isSignedLongLongs ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3537
	^ #'variableSignedLongLongSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3538
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3539
    self isLongLongs ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3540
	^ #'variableLongLongSubclass:'
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3541
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3542
    ^ #'variableSubclass:'
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3543
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3544
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3545
fullName
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3546
    "Answer the name of the receiver, fully qualified."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3547
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3548
    ^ self name asString
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3549
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3550
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3551
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3552
hasExtensions
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3553
    ^ false
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3554
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3555
    "Created: / 06-08-2006 / 15:23:32 / cg"
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3556
!
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3557
14504
81da612cffd8 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14469
diff changeset
  3558
isAbstract
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  3559
    "true if this is an abstract class
18910
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3560
     (has no direct instances, should not be instantiated).
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3561
     Usually, this means that it only provides shared protocol for its
19435
d410a2d70d68 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19348
diff changeset
  3562
     subclasses, which should be used.
d410a2d70d68 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19348
diff changeset
  3563
     Notice: this does not have any semantic effect;
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  3564
     it is purely for the browser (shows an 'A'-Indicator)
19435
d410a2d70d68 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19348
diff changeset
  3565
     and for documentation.
d410a2d70d68 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19348
diff changeset
  3566
     To enforce abstractness, a subclass should redefine new, to raise an exception.
d410a2d70d68 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19348
diff changeset
  3567
     (which some do, but many are too lazy to do)"
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  3568
14504
81da612cffd8 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14469
diff changeset
  3569
    ^ false
81da612cffd8 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14469
diff changeset
  3570
!
81da612cffd8 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 14469
diff changeset
  3571
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3572
isBehavior
18353
83774b46e6c5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18309
diff changeset
  3573
    "return true, if the receiver is describing another object's behavior.
9219
50eb13c217ac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9196
diff changeset
  3574
     Defined to avoid the need to use isKindOf:"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3575
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3576
    ^ true
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3577
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3578
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3579
     True isBehavior
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3580
     true isBehavior
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3581
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3582
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3583
10043
22138758483e protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 10008
diff changeset
  3584
isBrowserStartable
22138758483e protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 10008
diff changeset
  3585
    ^ false
22138758483e protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 10008
diff changeset
  3586
22138758483e protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 10008
diff changeset
  3587
    "Created: / 06-10-2006 / 11:33:42 / cg"
22138758483e protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 10008
diff changeset
  3588
!
22138758483e protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 10008
diff changeset
  3589
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3590
isBuiltInClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3591
    "return true if this class is known by the run-time-system.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3592
     Here, false is returned as default.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3593
     Notice, this is instance protocol, which means that any class
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3594
     other than those special ones) are non-builtIn by default."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3595
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3596
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3597
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3598
    "Modified: 23.4.1996 / 15:55:52 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3599
    "Created: 28.10.1996 / 15:10:02 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3600
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3601
15103
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3602
isObsolete
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3603
    "return true, if the receiver is obsolete
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3604
     (i.e. has been replaced by a different class or was removed,
22441
e1bf343ab352 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22362
diff changeset
  3605
      but is still referenced by instances).
15103
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3606
     Not normally needed here, but added to allow for instances of anonymous behaviours
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3607
     to be inspected or browsed."
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3608
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3609
    ^ false
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3610
!
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3611
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3612
isPrivate
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3613
    "return true, if the receiver is some private class"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3614
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3615
    ^ self owningClass notNil
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3616
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3617
    "Modified: 12.10.1996 / 20:11:05 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3618
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3619
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3620
isStartableWithMain
20573
83f6414391b1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20555
diff changeset
  3621
    "return true, if this is an application class,
83f6414391b1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20555
diff changeset
  3622
     which can be started via #main / #main:"
83f6414391b1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20555
diff changeset
  3623
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3624
    ^ false
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3625
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3626
    "Created: / 06-08-2006 / 15:23:50 / cg"
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3627
!
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3628
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3629
isStartableWithStart
20573
83f6414391b1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20555
diff changeset
  3630
    "return true, if this is an application class,
83f6414391b1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20555
diff changeset
  3631
     which can be started via #start"
83f6414391b1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20555
diff changeset
  3632
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3633
    ^ false
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3634
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3635
    "Created: / 06-08-2006 / 15:23:57 / cg"
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3636
!
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3637
18910
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3638
isUtilityClass
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3639
    "a utility class is one which is not to be instantiated,
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3640
     but only provides a number of utility functions on the class side.
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3641
     It is usually also abstract"
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  3642
18910
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3643
    ^ false
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3644
!
815f8cba1f42 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18908
diff changeset
  3645
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3646
isVisualStartable
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3647
    ^ false
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3648
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3649
    "Created: / 06-08-2006 / 15:23:38 / cg"
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3650
!
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3651
21605
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3652
logFacility
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3653
    "the 'log facility';
24832
4b330af273ba #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24521
diff changeset
  3654
     this is used by the Logger both as a prefix to the log message, 
4b330af273ba #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24521
diff changeset
  3655
     and maybe (later) used to filter and/or control per-facility log thresholds."
21605
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3656
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3657
    ^ '???'
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3658
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3659
    "Created: / 01-03-2017 / 10:34:32 / cg"
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3660
!
806379005cac #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21532
diff changeset
  3661
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3662
name
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3663
    "although behaviors have no name, we return something
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3664
     useful here - there are many places (inspectors) where
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3665
     a classes name is asked for.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3666
     Implementing this message here allows anonymous classes
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3667
     and instances of them to be inspected."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3668
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3669
    ^ #'anonymous Behavior'
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3670
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3671
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3672
nameInBrowser
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3673
    "return a nameString as shown in browsers"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3674
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3675
    ^ self name ? '?'
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3676
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3677
18752
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3678
nameSpace
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3679
    "return the namespace I am contained in.
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3680
     Not normally needed here, but added to allow for instances of anonymous behaviours
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3681
     to be inspected or browsed."
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3682
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3683
    ^ nil
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3684
!
b15b10e33d28 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18570
diff changeset
  3685
7331
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3686
nameWithArticle
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3687
    "return a string consisting of classname preceeded by an article.
20785
d92576d9a18f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20780
diff changeset
  3688
     (don't expect me to write national variants for this ... :-)
7331
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3689
     If you have special preferences, redefine it..."
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3690
7331
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3691
    |classname|
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3692
7331
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3693
    classname := self name.
14259
8fb13e1dc43e changed: #nameWithArticle
Claus Gittinger <cg@exept.de>
parents: 14239
diff changeset
  3694
    classname isEmptyOrNil ifTrue:[ ^ 'an anonymous' ].
7331
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3695
    ^ classname article , ' ' , classname
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3696
7331
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3697
    "
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3698
     SmallInteger nameWithArticle
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3699
    "
9445
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  3700
14259
8fb13e1dc43e changed: #nameWithArticle
Claus Gittinger <cg@exept.de>
parents: 14239
diff changeset
  3701
    "Modified: / 13-06-2012 / 14:50:03 / cg"
7331
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3702
!
cd0f1492d540 code motion from ClassDescription
Claus Gittinger <cg@exept.de>
parents: 7269
diff changeset
  3703
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3704
owningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3705
    "return my owning class - nil if I am a public class"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3706
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3707
    "/ this information is in the metaclass ...
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3708
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3709
    ^ self class owningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3710
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3711
    "Created: 15.10.1996 / 21:19:32 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3712
    "Modified: 7.11.1996 / 13:49:28 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3713
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3714
6733
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3715
owningClassOrYourself
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3716
    "return my owning class if I am private, myself otherwise"
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3717
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3718
    self owningClass notNil ifTrue:[^ self topOwningClass].
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3719
    ^ self
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3720
!
6733
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3721
15103
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3722
privateClassesAt:aClassNameStringOrSymbol
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3723
    "return a private class if present; nil otherwise.
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3724
     Not normally needed here, but added to allow for instances of anonymous behaviours
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3725
     to be inspected or browsed."
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3726
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3727
    ^ nil
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3728
!
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3729
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3730
realSharedPoolNames
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3731
    "this returns the namespace aware pool names.
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3732
     Not normally needed here, but added to allow for instances of anonymous behaviours
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3733
     to be inspected or browsed."
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3734
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3735
    ^ #()
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3736
!
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3737
9469
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3738
revision
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3739
    ^ nil
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3740
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3741
    "Created: / 03-08-2006 / 01:53:44 / cg"
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3742
!
580edc421e81 support for lazy methods ceased.
Claus Gittinger <cg@exept.de>
parents: 9445
diff changeset
  3743
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3744
sourceCodeAt:aSelector
22362
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3745
    "return the method's source for given selector aSelector or nil.
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3746
     Only methods in the receiver - not in the superclass chain are considered."
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3747
7676
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3748
    ^ self sourceCodeAt:aSelector ifAbsent:nil
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3749
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3750
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3751
     True sourceCodeAt:#ifTrue:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3752
     Object sourceCodeAt:#==
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3753
     Behavior sourceCodeAt:#sourceCodeAt:
2053
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3754
    "
22362
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3755
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3756
    "Modified (comment): / 21-11-2017 / 12:57:22 / cg"
2053
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3757
!
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3758
7676
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3759
sourceCodeAt:aSelector ifAbsent:exceptionalValue
22362
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3760
    "return the method's source for given selector aSelector or exceptionalValue.
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3761
     Only methods in the receiver - not in the superclass chain are considered."
7676
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3762
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3763
    |method|
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3764
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3765
    method := self compiledMethodAt:aSelector.
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3766
    method isNil ifTrue:[^ exceptionalValue value].
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3767
    ^ method source
22362
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3768
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  3769
    "Modified (comment): / 21-11-2017 / 12:57:25 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3770
!
7676
132c48f4bef9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7605
diff changeset
  3771
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3772
sourceCodeManager
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3773
    "return the sourceCodeManager of the class.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3774
     Returning nil here, since Behavior does not define any sourceCode management.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3775
     (only Classes do). This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3776
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3777
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3778
    ^ nil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3779
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3780
    "Created: 16.4.1996 / 16:26:03 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3781
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3782
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3783
supportsMethodCategories
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3784
    "return true, if my methods are categorized.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3785
     This is a hook for the browser to allow alien classes
14154
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  3786
     to be handled (actually, this is not yet used)."
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  3787
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  3788
    ^ self class supportsMethodCategories
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  3789
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  3790
    "Created: / 30-07-1997 / 14:59:08 / cg"
2bbca940477e added: #supportsMethodCategories
Claus Gittinger <cg@exept.de>
parents: 14065
diff changeset
  3791
    "Modified: / 01-06-2012 / 20:38:03 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3792
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3793
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3794
theMetaclass
9696
aa90a58aae75 comment
Claus Gittinger <cg@exept.de>
parents: 9655
diff changeset
  3795
    "return the metaClass of the class-meta pair.
aa90a58aae75 comment
Claus Gittinger <cg@exept.de>
parents: 9655
diff changeset
  3796
     Here, return my metaclass object, because I am the class.
aa90a58aae75 comment
Claus Gittinger <cg@exept.de>
parents: 9655
diff changeset
  3797
     Also implemented in my metaclass, which returns itself."
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3798
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3799
    ^ self class
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3800
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3801
    "Created: / 30.1.2000 / 23:08:30 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3802
    "Modified: / 31.1.2000 / 16:16:52 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3803
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3804
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3805
theNonMetaclass
9696
aa90a58aae75 comment
Claus Gittinger <cg@exept.de>
parents: 9655
diff changeset
  3806
    "return the nonMetaClass of the class-meta pair.
aa90a58aae75 comment
Claus Gittinger <cg@exept.de>
parents: 9655
diff changeset
  3807
     Here, return myself, because I am the nonMetaclass.
17591
2a5e2a817c41 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17528
diff changeset
  3808
     Also implemented in my metaclass, which also returns me.
2a5e2a817c41 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 17528
diff changeset
  3809
     Sigh: ST/X naming; Squeak calls this theNonMetaClass"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3810
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3811
    ^ self
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3812
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3813
    "Created: / 30.1.2000 / 23:07:59 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3814
    "Modified: / 31.1.2000 / 16:17:46 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3815
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3816
15103
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3817
topNameSpace
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3818
    "return the nameSpace of my topOwningClass (if private) or my own nameSpace.
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3819
     Not normally needed here, but added to allow for instances of anonymous behaviours
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3820
     to be inspected or browsed."
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3821
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3822
    ^ nil
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3823
!
43643eb2e54f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15102
diff changeset
  3824
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3825
topOwningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3826
    "return my outermost owning class - nil if I am a public class"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3827
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3828
    "/ this information is in the metaclass ...
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3829
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3830
    ^ self class topOwningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3831
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3832
    "Created: 15.10.1996 / 21:19:32 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3833
    "Modified: 3.1.1997 / 19:18:49 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3834
! !
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3835
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3836
!Behavior methodsFor:'queries-inheritance'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3837
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3838
allSubclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3839
    "return a collection of all subclasses (direct AND indirect) of
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3840
     the receiver. There will be no specific order, in which entries
10172
5f08ff69a5a4 use isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10085
diff changeset
  3841
     are returned. NameSpaces are excluded from the list."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3842
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3843
    |newColl|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3844
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3845
    newColl := OrderedCollection new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3846
    self allSubclassesDo:[:aClass |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3847
	(aClass isRealNameSpace) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3848
	    newColl add:aClass
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3849
	]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3850
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3851
    ^ newColl
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3852
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3853
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3854
     Collection allSubclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3855
    "
10172
5f08ff69a5a4 use isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10085
diff changeset
  3856
5f08ff69a5a4 use isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10085
diff changeset
  3857
    "Modified: / 10-11-2006 / 17:22:58 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3858
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3859
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3860
allSubclassesInOrder
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3861
    "return a collection of all subclasses (direct AND indirect) of
10172
5f08ff69a5a4 use isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10085
diff changeset
  3862
     the receiver. Higher level subclasses will come before lower ones.
5f08ff69a5a4 use isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10085
diff changeset
  3863
     NameSpaces are excluded from the list."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3864
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3865
    |newColl|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3866
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3867
    newColl := OrderedCollection new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3868
    self allSubclassesInOrderDo:[:aClass |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3869
	(aClass isRealNameSpace) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3870
	    newColl add:aClass
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3871
	]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3872
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3873
    ^ newColl
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3874
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3875
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3876
     Collection allSubclassesInOrder
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3877
    "
10172
5f08ff69a5a4 use isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10085
diff changeset
  3878
5f08ff69a5a4 use isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10085
diff changeset
  3879
    "Modified: / 10-11-2006 / 17:23:06 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3880
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3881
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3882
allSuperclasses
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  3883
    "return a collection of the receiver's accumulated superclasses"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3884
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3885
    |aCollection theSuperClass|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3886
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3887
    theSuperClass := self superclass.
4451
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3888
    theSuperClass isNil ifTrue:[
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  3889
	^ #()
4451
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3890
    ].
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3891
    aCollection := OrderedCollection new.
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3892
    [theSuperClass notNil] whileTrue:[
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  3893
	aCollection add:theSuperClass.
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  3894
	theSuperClass := theSuperClass superclass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3895
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3896
    ^ aCollection
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3897
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3898
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3899
     String allSuperclasses
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3900
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3901
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3902
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3903
canBeSubclassed
21424
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  3904
    "return true, if it's allowed to create subclasses of the receiver.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3905
     This method is redefined in SmallInteger and UndefinedObject, since
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3906
     instances are detected by their pointer-fields, i.e. they do not have
7435
c5afb1b0fd1b Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  3907
     a class entry (you don't have to understand this :-)"
10
claus
parents: 5
diff changeset
  3908
claus
parents: 5
diff changeset
  3909
    ^ true
21424
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  3910
61a84a7236f8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21398
diff changeset
  3911
    "Modified (comment): / 13-02-2017 / 19:55:23 / cg"
10
claus
parents: 5
diff changeset
  3912
!
claus
parents: 5
diff changeset
  3913
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3914
commonSuperclass:aClass
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3915
    "Return the common superclass of the receiver and aClass.
6754
d9c0f178f091 commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents: 6733
diff changeset
  3916
     Assumes that there is a common superclass of any two classes.
14065
6f6d6223c947 changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents: 13862
diff changeset
  3917
     (might return nil, if either the receiver or the argument inherits from nil)"
6f6d6223c947 changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents: 13862
diff changeset
  3918
6f6d6223c947 changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents: 13862
diff changeset
  3919
    (aClass == self) ifTrue:[^ self].
6f6d6223c947 changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents: 13862
diff changeset
  3920
    (aClass isSubclassOf:self) ifTrue:[^ self].
6f6d6223c947 changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents: 13862
diff changeset
  3921
    (self isSubclassOf:aClass) ifTrue:[^ aClass].
6754
d9c0f178f091 commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents: 6733
diff changeset
  3922
    superclass isNil ifTrue:[^ nil].
d9c0f178f091 commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents: 6733
diff changeset
  3923
    ^ superclass commonSuperclass:aClass
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3924
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3925
    "
14688
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  3926
     Integer commonSuperclass:Fraction
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  3927
     SmallInteger commonSuperclass:Fraction
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  3928
     View commonSuperclass:Form
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  3929
     View commonSuperclass:Image
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  3930
     View commonSuperclass:View
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  3931
     Integer commonSuperclass:Autoload
a572f99cdbb3 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 14551
diff changeset
  3932
     Integer commonSuperclass:Object
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3933
    "
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3934
14065
6f6d6223c947 changed: #commonSuperclass:
Claus Gittinger <cg@exept.de>
parents: 13862
diff changeset
  3935
    "Modified (comment): / 17-03-2012 / 19:56:28 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3936
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3937
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3938
hasMultipleSuperclasses
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3939
    "Return true, if this class inherits from other classes
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3940
     (beside its primary superclass).
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  3941
     This method is a preparation for a future multiple inheritance extension
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3942
     - currently it is not supported by the VM"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3943
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3944
    ^ false
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3945
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3946
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3947
includesBehavior:aClass
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3948
    "return true, if the receiver includes the behavior of aClass;
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3949
     i.e. if is either identical to a class or inherits from it."
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3950
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3951
    ^ (self == aClass) or:[self isSubclassOf:aClass]
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3952
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3953
    "
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3954
     True includesBehavior:Object
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3955
     True includesBehavior:Boolean
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3956
     True includesBehavior:True
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3957
     True includesBehavior:False
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3958
    "
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3959
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3960
    "Modified: 19.6.1997 / 18:14:35 / cg"
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3961
!
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3962
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3963
inheritsFrom:aClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3964
    "return true, if the receiver inherits methods from aClass;
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  3965
     i.e. if aClass is on the receiver's superclass chain."
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3966
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3967
    ^ self isSubclassOf:aClass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3968
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3969
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3970
     True inheritsFrom:Object
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3971
     LinkedList inheritsFrom:Array
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3972
    "
1088
989f0e510a32 nicer message
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  3973
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3974
    "Modified: 19.6.1997 / 18:13:21 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  3975
!
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3976
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3977
isSubclassOf:aClass
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3978
    "return true, if I am a subclass of the argument, aClass"
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3979
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3980
%{  /* NOCONTEXT */
18364
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3981
#ifdef __SCHTEAM__
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3982
    STClass theClass = self.superClazz();
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3983
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3984
    while (theClass != null) {
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3985
	if (theClass == aClass) {
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3986
	    return __c__._RETURN_true();
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3987
	}
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3988
	theClass = theClass.superClazz();
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3989
    }
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3990
    return __c__._RETURN_false();
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3991
    /* NOTREACHED */
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  3992
#else
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3993
    OBJ __theClass = __INST(superclass);
16050
95fbf5838a55 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16042
diff changeset
  3994
    int n = 0;
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3995
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  3996
    while (__theClass != nil) {
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3997
	if (__theClass == aClass) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3998
	    RETURN(true);
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  3999
	}
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4000
	if (__isBehaviorLike(__theClass)) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4001
	    __theClass = __ClassInstPtr(__theClass)->c_superclass;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4002
	} else {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4003
	    __theClass = nil;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4004
	}
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4005
	if (++n > 100000) goto vmError;
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4006
    }
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4007
    RETURN (false);
16050
95fbf5838a55 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16042
diff changeset
  4008
vmError: ;
18364
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  4009
#endif /* not SCHTEAM */
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4010
%}.
16050
95fbf5838a55 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16042
diff changeset
  4011
    VMInternalError raiseErrorString:'deep inheritance'.
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4012
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4013
"/    |theClass|
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4014
"/
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4015
"/    theClass := superclass.
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4016
"/    [theClass notNil] whileTrue:[
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4017
"/        (theClass == aClass) ifTrue:[^ true].
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4018
"/%{
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4019
"/        if (__isBehaviorLike(theClass)) {
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4020
"/            theClass = __ClassInstPtr(theClass)->c_superclass;
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4021
"/        } else {
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4022
"/            theClass = nil;
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4023
"/        }
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4024
"/%}.
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4025
"/"/        theClass := theClass superclass.
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4026
"/    ].
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4027
"/    ^ false
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4028
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4029
    "
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4030
     String isSubclassOf:Collection
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4031
     LinkedList isSubclassOf:Array
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4032
     1 isSubclassOf:Number              <- will fail since 1 is no class
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4033
     Number isSubclassOf:1
13318
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4034
    "
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4035
!
6c7e2f0cf393 category of:
Claus Gittinger <cg@exept.de>
parents: 13260
diff changeset
  4036
23059
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4037
mutableClass
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4038
    "Return a version of me with mutable instances.
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4039
     Only redefined in the immutable collections 
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4040
     (of which instances are created by the compiler)"
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4041
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4042
    ^ self
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4043
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4044
    "Created: / 07-06-2018 / 20:26:46 / Claus Gittinger"
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4045
!
06812cac0b2b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23049
diff changeset
  4046
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4047
subclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4048
    "return a collection of the direct subclasses of the receiver"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4049
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4050
    |newColl|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4051
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4052
    newColl := OrderedCollection new.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4053
    self subclassesDo:[:aClass |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4054
	newColl add:aClass
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4055
    ].
7435
c5afb1b0fd1b Prepare for moving of SubclassInfo to subclass instcar in Class
Stefan Vogel <sv@exept.de>
parents: 7358
diff changeset
  4056
    ^ newColl.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4057
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4058
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4059
superclasses
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  4060
    "return a collection of the receiver's immediate superclasses.
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4061
     This method is a preparation for a future multiple inheritance extension
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4062
     - currently it is not supported by the VM"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4063
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4064
    ^ Array with:self superclass.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4065
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4066
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4067
     String superclasses
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4068
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4069
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4070
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4071
withAllSubclasses
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4072
    "return a collection containing the receiver and
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4073
     all subclasses (direct AND indirect) of the receiver"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4074
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4075
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4076
14414
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4077
    coll := OrderedCollection new.
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4078
    self withAllSubclassesDo:[:eachClass | coll add:eachClass].
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4079
    ^ coll
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4080
14414
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4081
"/ the following original code is slighly less efficient (makes big collections)
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4082
"/    coll := self allSubclasses asOrderedCollection.
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4083
"/    coll addFirst:self.
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4084
"/    ^ coll
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4085
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4086
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4087
     Collection withAllSubclasses
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4088
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4089
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4090
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4091
withAllSuperclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4092
    "return a collection containing the receiver and all
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  4093
     of the receiver's accumulated superclasses"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4094
14414
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4095
    |coll|
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4096
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4097
    coll := OrderedCollection new.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4098
    self withAllSuperclassesDo:[:cls |
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  4099
	coll add:cls
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4100
    ].
14414
5966c2554334 comment/format in: #withAllSuperclasses
Claus Gittinger <cg@exept.de>
parents: 14288
diff changeset
  4101
    ^ coll
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4102
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4103
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4104
     String withAllSuperclasses
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4105
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4106
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4107
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4108
!Behavior methodsFor:'queries-instances'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4109
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4110
allDerivedInstances
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4111
    "return a collection of all instances of myself and
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4112
     instances of all subclasses of myself.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4113
     This method is going to be removed for protocol compatibility with
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4114
     other STs; use allSubInstances"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4115
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4116
    <resource:#obsolete>
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4117
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4118
    self obsoleteMethodWarning:'use #allSubInstances'.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4119
    ^ self allSubInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4120
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4121
    "Modified: 31.7.1997 / 23:04:59 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4122
!
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  4123
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4124
allInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4125
    "return a collection of all my instances"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4126
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4127
    "Read the documentation on why there seem to be no
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4128
     instances of SmallInteger and UndefinedObject"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4129
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4130
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4131
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4132
    coll := OrderedCollection new:100.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4133
    self allInstancesDo:[:anObject |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4134
	coll add:anObject
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4135
    ].
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4136
    ^ coll
2713
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  4137
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  4138
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4139
     ScrollBar allInstances
2713
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  4140
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4141
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4142
18309
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4143
allInstancesForWhich:predicate do:action
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4144
    "perform action on all instances for which predicate returns true"
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4145
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4146
    "Read the documentation on why there seem to be no
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4147
     instances of SmallInteger and UndefinedObject"
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4148
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4149
    self allInstancesDo:[:anObject |
18364
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  4150
	(predicate value:anObject) ifTrue:[
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  4151
	    action value:anObject
a693511a7c46 commnts only
Claus Gittinger <cg@exept.de>
parents: 18353
diff changeset
  4152
	].
18309
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4153
    ].
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4154
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4155
    "
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4156
     ScrollBar allInstancesForWhich:[:s | s shown] do:[:s | Transcript showCR:s topView label]
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4157
    "
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4158
!
e26e632b80a7 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
  4159
22023
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4160
allInstancesSelect:predicate
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4161
    "return all instances for which predicate returns true"
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4162
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4163
    "Read the documentation on why there seem to be no
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4164
     instances of SmallInteger and UndefinedObject"
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4165
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4166
    |coll|
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4167
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4168
    coll := OrderedCollection new.
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4169
    self allInstancesForWhich:predicate do:[:someObject | coll add:someObject].
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4170
    ^ coll
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  4171
22023
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4172
    "
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4173
     ScrollBar allInstancesSelect:[:s | s shown]
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4174
    "
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4175
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4176
    "Created: / 16-07-2017 / 14:22:41 / cg"
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4177
!
1d1c95cbcb3d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22017
diff changeset
  4178
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4179
allInstancesWeakly:doWeakly
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4180
    "return a collection of all my instances.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4181
     If weakly is true, a weak collection is returned."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4182
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4183
    "Read the documentation on why there seem to be no
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4184
     instances of SmallInteger and UndefinedObject"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4185
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4186
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4187
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4188
    coll := self allInstances.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4189
    doWeakly ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4190
	coll := WeakArray withAll:coll
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4191
    ].
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4192
    ^ coll
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4193
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4194
    "Created: / 19.6.1998 / 02:17:20 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4195
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4196
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4197
allSubInstances
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4198
    "return a collection of all instances of myself and
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4199
     instances of all subclasses of myself."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4200
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4201
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4202
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4203
    coll := OrderedCollection new:100.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4204
    self allSubInstancesDo:[:anObject |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4205
	coll add:anObject
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4206
    ].
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4207
    ^ coll
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4208
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4209
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4210
     View allSubInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4211
    "
2713
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  4212
!
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  4213
10669
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4214
anyInstance
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4215
    "return any of my instances; raise an error, if there is none"
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4216
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4217
    "Read the documentation on why there seem to be no
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4218
     instances of SmallInteger and UndefinedObject"
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4219
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4220
    self allInstancesDo:[:anObject | ^ anObject].
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4221
    self errorNotFound
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4222
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4223
    "
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4224
     ScrollBar anyInstance
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4225
     SmallInteger anyInstance
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4226
    "
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4227
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4228
    "Created: / 24-07-2007 / 06:12:27 / cg"
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4229
!
66ef0d71cea2 changed #anyInstance
Claus Gittinger <cg@exept.de>
parents: 10667
diff changeset
  4230
15745
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4231
anySubInstance
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4232
    "return any of my or derived instances; raise an error, if there is none"
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4233
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4234
    "Read the documentation on why there seem to be no
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4235
     instances of SmallInteger and UndefinedObject"
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4236
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4237
    self allSubInstancesDo:[:anObject | ^ anObject].
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4238
    self errorNotFound
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4239
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4240
    "
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4241
     View anySubInstance
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4242
    "
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4243
!
752db6d03dd5 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15744
diff changeset
  4244
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4245
derivedInstanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4246
    "return the number of instances of myself and of subclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4247
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4248
    |count|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4249
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4250
    count := 0.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4251
    ObjectMemory allObjectsDo:[:anObject |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4252
	(anObject isKindOf:self) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4253
	    count := count + 1
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4254
	]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4255
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4256
    ^ count
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4257
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4258
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4259
     View derivedInstanceCount
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4260
     SequenceableCollection derivedInstanceCount
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4261
     Object derivedInstanceCount
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4262
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4263
!
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4264
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4265
hasDerivedInstances
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4266
    "return true, if there are any instances of myself or of any subclass"
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4267
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4268
    "Read the documentation on why there seem to be no
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4269
     instances of SmallInteger and UndefinedObject"
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4270
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4271
    ObjectMemory allObjectsDo:[:anObject |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4272
	(anObject isKindOf:self) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4273
	    ^ true
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4274
	]
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4275
    ].
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4276
    ^ false
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4277
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4278
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4279
     Object hasDerivedInstances         - certainly true
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4280
     SharedQueue hasDerivedInstances
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4281
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4282
!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4283
2674
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  4284
hasImmediateInstances
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4285
    "return true if this class has immediate instances
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4286
     i.e. if the instances are represented in the pointer itself and
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4287
     no real object header/storage is used for the object.
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4288
     Redefined in classes which have so (only SmallInteger and UndefinedObject)"
2674
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  4289
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  4290
    ^ false
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  4291
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  4292
    "Created: 3.6.1997 / 12:01:05 / cg"
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  4293
!
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  4294
17379
ebabe72794c3 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 17295
diff changeset
  4295
hasImmutableInstances
22017
cb3490989341 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21629
diff changeset
  4296
    "are this classes' instances immutable?"
17379
ebabe72794c3 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 17295
diff changeset
  4297
ebabe72794c3 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 17295
diff changeset
  4298
    ^ false
22017
cb3490989341 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21629
diff changeset
  4299
cb3490989341 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21629
diff changeset
  4300
    "Modified (comment): / 14-07-2017 / 13:27:07 / cg"
17379
ebabe72794c3 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 17295
diff changeset
  4301
!
ebabe72794c3 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 17295
diff changeset
  4302
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4303
hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4304
    "return true, if there are any instances of myself"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4305
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4306
    "Read the documentation on why there seem to be no
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4307
     instances of SmallInteger and UndefinedObject"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4308
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4309
"/    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4310
"/        (anObject class == self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4311
"/            ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4312
"/        ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4313
"/    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4314
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4315
    ObjectMemory allInstancesOf:self do:[:anObject |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4316
	^ true
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4317
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4318
    ^ false
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4319
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4320
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4321
     Object hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4322
     SequenceableCollection hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4323
     Float hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4324
     SmallInteger hasInstances
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4325
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4326
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4327
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4328
hasSharedInstances
25033
8e8e038e486e #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24921
diff changeset
  4329
    "return true if this class can share instances when stored binary, 
8e8e038e486e #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24921
diff changeset
  4330
     that is, instances with the same value can be stored by reference.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4331
     False is returned here, only redefined in classes which have unified
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4332
     instances (or should be treated so)."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4333
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4334
    ^ false
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4335
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4336
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4337
instanceCount
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4338
    "return the number of instances of myself."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4339
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4340
    "Read the documentation on why there seem to be no
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4341
     instances of SmallInteger and UndefinedObject"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4342
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4343
    |count|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4344
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4345
    count := 0.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4346
"/    ObjectMemory allObjectsDo:[:anObject |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4347
"/        (anObject class == self) ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4348
"/            count := count + 1
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4349
"/        ]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4350
"/    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4351
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4352
    ObjectMemory allInstancesOf:self do:[:anObject |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4353
	count := count + 1
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4354
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4355
    ^ count
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4356
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4357
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4358
     View instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4359
     Object instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4360
     Float instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4361
     SequenceableCollection instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4362
     SmallInteger instanceCount   .... mhmh - hear, hear
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4363
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4364
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4365
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4366
!Behavior methodsFor:'queries-instlayout'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4367
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4368
elementByteSize
16848
4ab0652eb947 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16734
diff changeset
  4369
    "for bit-like containers, return the number of bytes stored per element.
4ab0652eb947 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16734
diff changeset
  4370
     For pointer indexed classes, 0 is returned"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4371
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4372
    self isBitsExtended ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4373
	self isBytes ifTrue:[^ 1].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4374
	self isWords ifTrue:[^ 2].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4375
	self isSignedWords ifTrue:[^ 2].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4376
	self isLongs ifTrue:[^ 4].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4377
	self isSignedLongs ifTrue:[^ 4].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4378
	self isLongLongs ifTrue:[^ 8].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4379
	self isSignedLongLongs ifTrue:[^ 8].
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4380
    ].
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4381
    self isFloats ifTrue:[^ 4].
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4382
    self isDoubles ifTrue:[^ 8].
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4383
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4384
    ^ 0
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4385
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4386
15948
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4387
isAlienBehavior
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4388
    "Returns true iff I'm an alien behavior."
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4389
%{
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4390
    RETURN( ( (INT)(__INST(flags)) & __MASKSMALLINT(ALIENPOINTERS)) ? true : false )
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4391
%}.
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4392
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4393
!
d6862d44ae35 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15862
diff changeset
  4394
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4395
isBits
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4396
    "return true, if instances have indexed byte or short instance variables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4397
     Ignore long, float and double arrays, since ST-80 code using isBits are probably
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4398
     not prepared to handle them correctly."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4399
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4400
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4401
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4402
    REGISTER int what;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4403
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4404
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4405
    RETURN (( (what == __MASKSMALLINT(BYTEARRAY))
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4406
	     || (what == __MASKSMALLINT(WORDARRAY))) ? true : false );
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4407
%}.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4408
    ^ self isBytes or:[self isWords]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4409
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4410
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4411
isBitsExtended
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4412
    "return true, if instances have indexed byte, short, long or longlong instance variables.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4413
     Ignore float and double arrays.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4414
     This is really the thing we expect #isBits to return, however, #isBits
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4415
     is defined to only return true for byte- and wordIndexed instances.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4416
     This avoids confusion of ST80 code, which is not prepared for long or longLong
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4417
     instVars."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4418
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4419
%{  /* NOCONTEXT */
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4420
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4421
    REGISTER int what;
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4422
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4423
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4424
    RETURN (( (what == __MASKSMALLINT(BYTEARRAY))
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4425
	     || (what == __MASKSMALLINT(WORDARRAY))
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4426
	     || (what == __MASKSMALLINT(SWORDARRAY))
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4427
	     || (what == __MASKSMALLINT(LONGARRAY))
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4428
	     || (what == __MASKSMALLINT(SLONGARRAY))
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4429
	     || (what == __MASKSMALLINT(LONGLONGARRAY))
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4430
	     || (what == __MASKSMALLINT(SLONGLONGARRAY))) ? true : false );
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4431
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4432
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4433
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4434
isBytes
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4435
    "return true, if instances have indexed byte instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4436
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4437
    "this could also be defined as:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4438
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagBytes
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4439
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4440
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4441
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4442
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(BYTEARRAY)) ? true : false );
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4443
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4444
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4445
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4446
isDoubles
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4447
    "return true, if instances have indexed double instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4448
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4449
    "this could also be defined as:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4450
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagDoubles
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4451
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4452
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4453
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4454
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(DOUBLEARRAY)) ? true : false );
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4455
%}
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4456
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4457
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4458
isFixed
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4459
    "return true, if instances do not have indexed instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4460
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4461
    "this could also be defined as:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4462
	^ self isVariable not
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4463
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4464
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4465
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4466
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4467
    RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? false : true );
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4468
%}.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4469
    ^ self isVariable not
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4470
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4471
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4472
isFloats
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4473
    "return true, if instances have indexed float instance variables"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4474
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4475
    "this could also be defined as:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4476
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagFloats
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4477
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4478
%{  /* NOCONTEXT */
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4479
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4480
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(FLOATARRAY)) ? true : false );
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4481
%}
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4482
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4483
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4484
isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4485
    "return true, if instances have indexed float or double instance variables"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4486
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4487
%{  /* NOCONTEXT */
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4488
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4489
    int what;
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4490
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4491
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4492
    RETURN (( (what == __MASKSMALLINT(FLOATARRAY))
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4493
	     || (what == __MASKSMALLINT(DOUBLEARRAY))) ? true : false );
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4494
%}.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4495
    ^ self isFloats or:[self isDoubles]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4496
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4497
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4498
     (Object new) class isFloatsOrDoubles
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4499
     (Point new) class isFloatsOrDoubles
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4500
     (Array new) class isFloatsOrDoubles
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4501
     (ByteArray new) class isFloatsOrDoubles
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4502
     (FloatArray new) class isFloatsOrDoubles
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4503
     (DoubleArray new) class isFloatsOrDoubles
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4504
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4505
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4506
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4507
isLongLongs
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4508
    "return true, if instances have indexed long-long instance variables (8 byte uints)"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4509
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4510
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4511
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4512
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGLONGARRAY)) ? true : false );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4513
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4514
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4515
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4516
isLongs
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4517
    "return true, if instances have indexed long instance variables (4 byte uints)"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4518
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4519
%{  /* NOCONTEXT */
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4520
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4521
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGARRAY)) ? true : false );
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4522
%}
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4523
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4524
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4525
isPointers
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4526
    "return true, if instances have pointer instance variables
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4527
     i.e. are either non-indexed or have indexed pointer variables"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4528
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4529
    "QUESTION: should we ignore WeakPointers ?"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4530
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4531
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4532
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4533
    REGISTER int flags;
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4534
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4535
    flags = __intVal(__INST(flags)) & ARRAYMASK;
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4536
    switch (flags) {
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4537
	default:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4538
	    /* normal objects */
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4539
	    RETURN ( true );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4540
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4541
	case BYTEARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4542
	case WORDARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4543
	case LONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4544
	case SWORDARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4545
	case SLONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4546
	case SLONGLONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4547
	case LONGLONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4548
	case FLOATARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4549
	case DOUBLEARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4550
	    RETURN (false );
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4551
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4552
	case WKPOINTERARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4553
	    /* what about those ? */
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4554
	    RETURN (true );
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4555
    }
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4556
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4557
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4558
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4559
isSignedLongLongs
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4560
    "return true, if instances have indexed signed long-long instance variables (8 byte ints)"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4561
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4562
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4563
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4564
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGLONGARRAY)) ? true : false );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4565
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4566
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4567
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4568
isSignedLongs
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4569
    "return true, if instances have indexed signed long instance variables (4 byte ints)"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4570
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4571
%{  /* NOCONTEXT */
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4572
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4573
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGARRAY)) ? true : false );
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4574
%}
24848
8503275a091c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24832
diff changeset
  4575
8503275a091c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24832
diff changeset
  4576
    "
8503275a091c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24832
diff changeset
  4577
     #u16(1 2 3) class isSignedLongs 
8503275a091c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24832
diff changeset
  4578
     #s16(1 2 3) class isSignedWords   
8503275a091c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24832
diff changeset
  4579
     #s16(1 2 3) class isBytes   
8503275a091c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24832
diff changeset
  4580
     #s16(1 2 3) class isVariable   
8503275a091c #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24832
diff changeset
  4581
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4582
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4583
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4584
isSignedWords
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4585
    "return true, if instances have indexed signed short instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4586
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4587
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4588
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4589
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SWORDARRAY)) ? true : false );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4590
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4591
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4592
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4593
isVariable
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4594
    "return true, if instances have indexed instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4595
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4596
    "this could also be defined as:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4597
	^ (flags bitAnd:(Behavior maskIndexType)) ~~ 0
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4598
     "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4599
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4600
%{  /* NOCONTEXT */
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4601
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4602
    RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? true : false );
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4603
%}
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4604
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4605
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4606
isWeakPointers
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4607
    "return true, if instances have weak pointer instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4608
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4609
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4610
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4611
    REGISTER int flags;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4612
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4613
    flags = __intVal(__INST(flags)) & ARRAYMASK;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4614
    if (flags == WKPOINTERARRAY) {
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4615
	RETURN ( true );
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4616
    }
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4617
%}.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4618
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4619
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4620
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4621
isWords
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4622
    "return true, if instances have indexed short instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4623
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4624
    "this could also be defined as:
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4625
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagWords
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4626
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4627
%{  /* NOCONTEXT */
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4628
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4629
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(WORDARRAY)) ? true : false );
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4630
%}
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4631
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4632
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4633
sizeOfInst:n
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4634
    "return the number of bytes required for an instance of
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20024
diff changeset
  4635
     myself with n indexed instance variables.
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20024
diff changeset
  4636
     The argument n should be zero for classes without indexed instance variables.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4637
     See Behavior>>niceNew: for an application of this."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4638
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4639
    |nInstvars|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4640
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4641
    nInstvars := self instSize.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4642
%{
15986
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4643
    INT nBytes = __intVal(nInstvars) * sizeof(OBJ) + OHDR_SIZE;
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4644
    if (__isSmallInteger(n)) {
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4645
	int nIndex;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4646
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4647
	nIndex = __intVal(n);
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4648
	switch (__intVal(__INST(flags)) & ARRAYMASK) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4649
	    case BYTEARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4650
		nBytes += nIndex;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4651
		if (nBytes & (__ALIGN__ - 1)) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4652
		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4653
		}
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4654
		break;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4655
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4656
	    case WORDARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4657
	    case SWORDARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4658
		nBytes += nIndex * 2;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4659
		if (nBytes & (__ALIGN__ - 1)) {
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4660
		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4661
		}
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4662
		break;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4663
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4664
	    case LONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4665
	    case SLONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4666
		nBytes += nIndex * 4;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4667
		break;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4668
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4669
	    case LONGLONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4670
	    case SLONGLONGARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4671
		nBytes += nIndex * 8;
15986
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4672
#ifdef __NEED_LONGLONG_ALIGN
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4673
		nBytes = (nBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
15986
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4674
#endif
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4675
		break;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4676
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4677
	    case FLOATARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4678
		nBytes += nIndex * sizeof(float);
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20024
diff changeset
  4679
#ifdef __NEED_FLOATARRAY_ALIGN
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20024
diff changeset
  4680
		nBytes = (nBytes-1+__FLOATARRAY_ALIGN) &~ (__FLOATARRAY_ALIGN-1);
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20024
diff changeset
  4681
#endif
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4682
		break;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4683
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4684
	    case DOUBLEARRAY:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4685
		nBytes += nIndex * sizeof(double);
15986
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4686
#ifdef __NEED_DOUBLE_ALIGN
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4687
		nBytes = (nBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
15986
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4688
#endif
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4689
		break;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4690
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4691
	    default:
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4692
		nBytes += nIndex * sizeof(OBJ);
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4693
		break;
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4694
	}
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4695
    }
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4696
    RETURN (__mkSmallInteger(nBytes));
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4697
%}
15986
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4698
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4699
    "
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4700
	DoubleArray sizeOfInst:8
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4701
	IntegerArray sizeOfInst:8
15986
387eab176223 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15948
diff changeset
  4702
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4703
! !
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4704
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4705
!Behavior methodsFor:'queries-protocol'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4706
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4707
allSelectors
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4708
    "return a collection of all selectors understood by the receiver;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4709
     this includes my selectors and all superclass selectors
19194
fe23256ac349 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18910
diff changeset
  4710
     (i.e. the receiver's full protocol)"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4711
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4712
    |superclass|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4713
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4714
    superclass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4715
    superclass notNil ifTrue:[
19291
f40f9421cc9b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19270
diff changeset
  4716
	^ superclass allSelectors addAll:(self selectors); yourself.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4717
    ].
15027
f121f85b525a Refactoring:
Stefan Vogel <sv@exept.de>
parents: 14990
diff changeset
  4718
    ^ self selectors asNewIdentitySet
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4719
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4720
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4721
     Point allSelectors
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4722
     View allSelectors
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4723
     Array allSelectors
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4724
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4725
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4726
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4727
cachedLookupMethodFor:aSelector
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4728
    "return the method, which would be executed if aSelector was sent to
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4729
     an instance of the receiver. I.e. the selector arrays of the receiver
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4730
     and all of its superclasses are searched for aSelector.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4731
     Return the method, or nil if instances do not understand aSelector.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4732
     This interface provides exactly the same information as #lookupMethodFor:,
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4733
     but uses the lookup-cache in the VM for faster search.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4734
     However, keep in mind, that doing a lookup through the cache also adds new
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4735
     entries and can thus slow down the system by polluting the cache with
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4736
     irrelevant entries. (do NOT loop over all objects calling this method).
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4737
     Does NOT (currently) handle MI"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4738
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4739
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4740
    RETURN ( __lookup(self, aSelector) );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4741
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4742
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4743
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4744
     String cachedLookupMethodFor:#=
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4745
     String cachedLookupMethodFor:#asOrderedCollection
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4746
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4747
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4748
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4749
canUnderstand:aSelector
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4750
    "return true, if the receiver or one of its superclasses implements aSelector.
15744
24dd16858634 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15667
diff changeset
  4751
     (i.e. true if my instances understand aSelector).
19835
b83d86f537b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19833
diff changeset
  4752
     I think this is a bad name (it sounds more like instance protocol,
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  4753
     and something like #instancesRespondTo: would have been better),
19835
b83d86f537b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19833
diff changeset
  4754
     but well, we are compatible (sigh)."
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4755
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4756
    ^ (self lookupMethodFor:aSelector) notNil
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4757
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4758
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4759
     True canUnderstand:#ifTrue:
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4760
     True canUnderstand:#==
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4761
     True canUnderstand:#do:
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4762
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4763
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4764
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4765
compiledMethodAt:aSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4766
    "return the method for given selector aSelector or nil.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4767
     Only methods in the receiver - not in the superclass chain are tested."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4768
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4769
    ^ self compiledMethodAt:aSelector ifAbsent:nil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4770
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4771
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4772
     Object compiledMethodAt:#==
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4773
     (Object compiledMethodAt:#==) category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4774
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4775
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4776
    "Modified: / 7.6.1996 / 14:43:32 / stefan"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4777
    "Modified: / 27.10.1997 / 20:18:55 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4778
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4779
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4780
compiledMethodAt:aSelector ifAbsent:exceptionValue
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4781
    "return the method for given selector aSelector or the value
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4782
     of exceptionValue if not present.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4783
     Only methods in the receiver - not in the superclass chain are tested."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4784
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4785
    |dict|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4786
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4787
    dict := self methodDictionary.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4788
    dict isNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4789
	('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4790
	^ exceptionValue value
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4791
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4792
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4793
    ^ dict at:aSelector ifAbsent:exceptionValue
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4794
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4795
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4796
     Object compiledMethodAt:#==
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4797
     (Object compiledMethodAt:#==) category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4798
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4799
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4800
    "Modified: / 7.6.1996 / 14:43:32 / stefan"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4801
    "Modified: / 10.1.1997 / 17:27:21 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4802
    "Created: / 27.10.1997 / 20:18:28 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4803
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4804
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4805
compiledMethodNamed: methodName
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4806
    "Warning: this method is here to support multiple languages.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4807
     Do not use in code that works just with the smalltalk code.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4808
     Use compiledMethodAt: selector instead"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4809
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4810
    "Returns a method with given name. This differs from
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4811
    #compiledMethodAt:, since class may contain more methods
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4812
    with same names and different selectors.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4813
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4814
     Only methods in the receiver - not in the superclass chain are tested."
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4815
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4816
    ^ self compiledMethodNamed:methodName  ifAbsent:nil
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4817
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4818
    "
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4819
     Object compiledMethodNamed:#==
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4820
     (Object compiledMethodNamed:#==) category
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4821
    "
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4822
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4823
    "Created: / 24-08-2009 / 10:00:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4824
    "Modified: / 28-06-2011 / 14:16:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4825
!
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4826
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4827
compiledMethodNamed: name ifAbsent:exceptionValue
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4828
   "Warning: this method is here to support multiple languages.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4829
     Do not use in code that works just with the smalltalk code.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4830
     Use compiledMethodAt: selector instead"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4831
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4832
    "Returns a method with given name of value of exceptionValue
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4833
    if not present. This differs from #compiledMethodAt:, since class
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4834
    may contain more methods with same name and different selectors.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4835
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4836
    Only methods in the receiver - not in the superclass chain are tested."
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4837
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4838
    |dict mth|
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4839
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4840
    dict := self methodDictionary.
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4841
    dict isNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4842
	('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4843
	^ exceptionValue value
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4844
    ].
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4845
    "Quick check: look into method dictionary"
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4846
    mth := dict at: name asSymbol ifAbsent:nil.
13838
1d91d75691f0 changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 13600
diff changeset
  4847
    mth notNil ifTrue:[^mth].
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4848
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4849
    "Slow search..."
13838
1d91d75691f0 changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 13600
diff changeset
  4850
    dict do: [:each|
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4851
	(each isSynthetic not and:[each name = name])
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  4852
	    ifTrue:[^each]
13838
1d91d75691f0 changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 13600
diff changeset
  4853
    ].
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4854
    ^exceptionValue value
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4855
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4856
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4857
    "
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4858
     Object compiledMethodNamed:#==
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4859
     (Object compiledMethodNamed:#==) category
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4860
    "
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4861
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4862
    "Created: / 24-08-2009 / 10:02:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4863
    "Modified: / 28-06-2011 / 14:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13838
1d91d75691f0 changed: #compiledMethodNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 13600
diff changeset
  4864
    "Modified (format): / 29-11-2011 / 11:20:08 / cg"
13414
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4865
!
a366c72d27f2 comment/format in:
vrany
parents: 13413
diff changeset
  4866
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4867
containsMethod:aMethod
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4868
    "Return true, if the argument, aMethod is a method of myself"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4869
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4870
    |dict|
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4871
19718
c5c09bdf4f7b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19703
diff changeset
  4872
    dict := methodDictionary.
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4873
    dict isNil ifTrue:[^ false].  "degenerated class"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4874
    ^ (dict keyAtValue:aMethod ifAbsent:[0]) ~~ 0
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4875
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4876
    "Modified: 12.6.1996 / 13:33:53 / stefan"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4877
!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4878
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4879
hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4880
    "return true, if there are any (local) methods in this class"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4881
21315
6ce768918447 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21271
diff changeset
  4882
    ^ ("self " methodDictionary size ~~ 0)
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4883
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4884
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4885
     True hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4886
     True class hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4887
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4888
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4889
    "Modified: 7.6.1996 / 15:43:09 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4890
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4891
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4892
implements:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4893
    "return true, if the receiver implements aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4894
     (i.e. implemented in THIS class - NOT in a superclass).
18245
3923781828c2 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 18147
diff changeset
  4895
     This is semantically equivalent to includesSelector: (which is ST/80/Squeak compatibility).
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4896
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4897
     Caveat:
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  4898
	This simply checks for the selector being present in the classes
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  4899
	selector table - therefore, it does not care for ignoredMethods.
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  4900
	(but: you should not use this method for protocol-testing, anyway).
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4901
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4902
     Hint:
22311
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  4903
	Don't use this method to check if someone responds to a message -
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  4904
	use #canUnderstand: on the class or #respondsTo: on the instance
5331770c9388 varArg bug fix
Claus Gittinger <cg@exept.de>
parents: 22128
diff changeset
  4905
	to do this."
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4906
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4907
    ^ self includesSelector:aSelector
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4908
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4909
    "
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4910
     notice: this is class protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4911
12302
656c61777a20 comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents: 12195
diff changeset
  4912
       True includesSelector:#ifTrue:
656c61777a20 comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents: 12195
diff changeset
  4913
       True includesSelector:#==
656c61777a20 comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents: 12195
diff changeset
  4914
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4915
       True implements:#ifTrue:
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4916
       True implements:#==
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4917
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4918
     notice: this is instance protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4919
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4920
       true respondsTo:#ifTrue:
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4921
       true respondsTo:#==
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4922
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4923
     notice: this is class protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4924
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4925
       True canUnderstand:#ifTrue:
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  4926
       True canUnderstand:#==
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4927
    "
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4928
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4929
    "Modified: 10.2.1996 / 13:15:56 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4930
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4931
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4932
includesSelector:aSelector
9219
50eb13c217ac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9196
diff changeset
  4933
    "return true, if the methodDictionary of THIS class includes a method for aSelector.
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4934
     (i.e. if aSelector is implemented in THIS class - NOT in a superclass).
12302
656c61777a20 comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents: 12195
diff changeset
  4935
     This is semantically equivalent to implements: (ST/80/Squeak compatibility).
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4936
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4937
     Hint:
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  4938
	Don't use this method to check if someone responds to a message -
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  4939
	use #canUnderstand: on the class or #respondsTo: on the instance
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  4940
	to do this.
12302
656c61777a20 comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents: 12195
diff changeset
  4941
656c61777a20 comment/format in: #implements: #includesSelector:
Claus Gittinger <cg@exept.de>
parents: 12195
diff changeset
  4942
     Caveat:
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  4943
	This simply checks for the selector being present in the classes
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  4944
	selector table - therefore, it does not care for ignoredMethods.
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  4945
	(but: you should not use this method for protocol-testing, anyway)."
19718
c5c09bdf4f7b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19703
diff changeset
  4946
c5c09bdf4f7b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19703
diff changeset
  4947
    ^ methodDictionary includesIdenticalKey:aSelector
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4948
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4949
    "
9219
50eb13c217ac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9196
diff changeset
  4950
     Object includesSelector:#==
50eb13c217ac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9196
diff changeset
  4951
     Object includesSelector:#murks
13372
d2e9922a9791 comment/format in: #includesSelector:
Stefan Vogel <sv@exept.de>
parents: 13318
diff changeset
  4952
     Object includesSelector:nil
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4953
    "
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4954
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3870
diff changeset
  4955
    "Modified: / 7.6.1996 / 14:27:24 / stefan"
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3870
diff changeset
  4956
    "Modified: / 16.10.1998 / 13:00:15 / cg"
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4957
!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4958
10085
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  4959
instAndClassMethods
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  4960
    ^ (self theMetaclass methodDictionary values) , (self theNonMetaclass methodDictionary values)
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  4961
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  4962
    "Created: / 12-10-2006 / 18:36:57 / cg"
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  4963
    "Modified: / 12-10-2006 / 20:36:34 / cg"
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  4964
!
175a1e85492b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10043
diff changeset
  4965
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  4966
lookupMethodFor:aSelector
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4967
    "return the method, which would be executed if aSelector was sent to
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4968
     an instance of the receiver. I.e. the selector arrays of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4969
     and all of its superclasses are searched for aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4970
     Return the method, or nil if instances do not understand aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4971
     EXPERIMENTAL: take care of multiple superclasses."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4972
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4973
    |l m cls|
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4974
23240
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4975
    Error handle:[:ex |
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4976
    ] do:[        
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4977
        "JV @ 2010-08-22: Rewritten to respect lookup object."
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4978
        (l := self lookupObject) notNil ifTrue:[
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4979
            ^ (l
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4980
                lookupMethodForSelector:aSelector
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4981
                directedTo:self
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4982
                for: nil "Fake receiver"
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4983
                withArguments: nil "Fake arguments"
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4984
                from: thisContext methodHome sender
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4985
                ilc: nil "fake ilc")
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4986
        ].
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  4987
    ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4988
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4989
    cls := self.
15785
29fc93b8f5e4 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15769
diff changeset
  4990
    [
23240
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4991
        m := cls compiledMethodAt:aSelector.
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4992
        m notNil ifTrue:[^ m].
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4993
        cls hasMultipleSuperclasses ifTrue:[
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4994
            cls superclasses do:[:aSuperClass |
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4995
                m := aSuperClass lookupMethodFor:aSelector.
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4996
                m notNil ifTrue:[^ m].
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4997
            ].
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4998
            ^ nil
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  4999
        ] ifFalse:[
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  5000
            cls := cls superclass
ac2201656af9 #BUGFIX by Lukas Vogel
lukas
parents: 23164
diff changeset
  5001
        ]
15785
29fc93b8f5e4 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 15769
diff changeset
  5002
    ] doWhile:[cls notNil].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5003
    ^ nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5004
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5005
6460
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5006
responseTo:aSelector
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5007
    "return the method (from here or the inheritance chain),
6460
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5008
     which implements aSelector; return nil if none."
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5009
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5010
    |cls|
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5011
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5012
    cls := self whichClassIncludesSelector:aSelector.
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5013
    cls notNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5014
	^ cls compiledMethodAt:aSelector
6460
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5015
    ].
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5016
    ^ nil
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5017
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5018
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5019
     String responseTo:#==
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5020
     String responseTo:#collect:
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5021
     String responseTo:#,
6460
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5022
    "
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5023
!
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  5024
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5025
selectorAtMethod:aMethod
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5026
    "Return the selector for given method aMethod."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5027
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5028
    ^ self selectorAtMethod:aMethod ifAbsent:[nil]
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5029
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5030
    "
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5031
     |m|
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5032
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5033
     m := Object compiledMethodAt:#copy.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5034
     Fraction selectorAtMethod:m.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5035
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5036
    "
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5037
     |m|
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5038
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5039
     m := Object compiledMethodAt:#copy.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5040
     Object selectorAtMethod:m.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5041
    "
356
claus
parents: 345
diff changeset
  5042
!
claus
parents: 345
diff changeset
  5043
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5044
selectorAtMethod:aMethod ifAbsent:failBlock
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5045
    "return the selector for given method aMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5046
     or the value of failBlock, if not found."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5047
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  5048
    |md|
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  5049
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  5050
    md := self methodDictionary.
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  5051
    md isNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5052
	'OOPS - nil methodDictionary' errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5053
	^ failBlock value.
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  5054
    ].
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  5055
    ^ md keyAtValue:aMethod ifAbsent:failBlock.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  5056
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  5057
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5058
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5059
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5060
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5061
     Object selectorAtMethod:m ifAbsent:['oops'].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5062
    "
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  5063
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5064
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5065
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5066
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5067
     Fraction selectorAtMethod:m ifAbsent:['oops'].
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  5068
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  5069
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  5070
    "Modified: 7.6.1996 / 15:15:45 / stefan"
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  5071
!
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  5072
2
claus
parents: 1
diff changeset
  5073
whichClassImplements:aSelector
328
claus
parents: 325
diff changeset
  5074
    "obsolete interface;
claus
parents: 325
diff changeset
  5075
     use whichClassIncludesSelector: for ST-80 compatibility."
claus
parents: 325
diff changeset
  5076
9363
04d360482be4 Mark obsolete method
Stefan Vogel <sv@exept.de>
parents: 9219
diff changeset
  5077
    <resource:#obsolete>
04d360482be4 Mark obsolete method
Stefan Vogel <sv@exept.de>
parents: 9219
diff changeset
  5078
328
claus
parents: 325
diff changeset
  5079
    ^ self whichClassIncludesSelector:aSelector
claus
parents: 325
diff changeset
  5080
!
claus
parents: 325
diff changeset
  5081
claus
parents: 325
diff changeset
  5082
whichClassIncludesSelector:aSelector
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  5083
    "return the class in the inheritance chain, which implements the method
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  5084
     for aSelector; return nil if none.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  5085
     EXPERIMENTAL: handle multiple superclasses"
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  5086
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  5087
    |cls|
2
claus
parents: 1
diff changeset
  5088
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  5089
    cls := self.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  5090
    [cls notNil] whileTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5091
	(cls includesSelector:aSelector) ifTrue:[^ cls].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5092
	cls hasMultipleSuperclasses ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5093
	    cls superclasses do:[:aSuperClass |
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5094
		|implementingClass|
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5095
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5096
		implementingClass := aSuperClass whichClassIncludesSelector:aSelector.
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5097
		implementingClass notNil ifTrue:[^ implementingClass].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5098
	    ].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5099
	    ^ nil
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5100
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5101
	    cls := cls superclass
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5102
	]
2
claus
parents: 1
diff changeset
  5103
    ].
claus
parents: 1
diff changeset
  5104
    ^ nil
claus
parents: 1
diff changeset
  5105
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  5106
    "
328
claus
parents: 325
diff changeset
  5107
     String whichClassIncludesSelector:#==
claus
parents: 325
diff changeset
  5108
     String whichClassIncludesSelector:#collect:
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  5109
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5110
! !
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5111
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  5112
!Behavior methodsFor:'queries-variables'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5113
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5114
allClassVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5115
    "return a collection of all the class variable name-strings
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5116
     this includes all superclass-class variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5117
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5118
    ^ self addAllClassVarNamesTo:(OrderedCollection new)
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5119
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5120
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5121
     Float allClassVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5122
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5123
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5124
    "Modified: 16.4.1996 / 18:01:00 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5125
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5126
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5127
allInstVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5128
    "return a collection of all the instance variable name-strings
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5129
     this includes all superclass-instance variables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5130
     Instvars of superclasses come first (i.e. the position matches
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5131
     the instVarAt:-index)."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5132
24521
9e0ae8e51e4b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24505
diff changeset
  5133
    |mySuperclass|
9e0ae8e51e4b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24505
diff changeset
  5134
9e0ae8e51e4b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24505
diff changeset
  5135
    mySuperclass := self superclass.
9e0ae8e51e4b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24505
diff changeset
  5136
    (mySuperclass isNil or:[mySuperclass == Object]) ifTrue:[^ self instVarNames].
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5137
    ^ self addAllInstVarNamesTo:(OrderedCollection new)
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5138
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5139
    "
24521
9e0ae8e51e4b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24505
diff changeset
  5140
     Point allInstVarNames 
9e0ae8e51e4b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24505
diff changeset
  5141
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5142
     Dictionary instVarNames
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5143
     Dictionary allInstVarNames
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5144
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5145
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5146
    "Modified: 16.4.1996 / 18:03:55 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5147
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5148
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5149
allInstanceVariableNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5150
    "alias for allInstVarNames"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5151
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5152
    ^ self allInstVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5153
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5154
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5155
classVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5156
    "return a collection of the class variable name-strings.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5157
     Returning empty here, since Behavior does not define any classVariables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5158
     (only Classes do). This allows different Behavior-like objects
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5159
     (alien classes) to be handled by the browser as well.
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5160
     Traditionally, this was called classVarNames, but newer versions of squeak
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5161
     seem to have changed to use classVariableNames.
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5162
     So you probably should use the alias"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5163
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5164
    ^ #()
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5165
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5166
    "Created: 16.4.1996 / 17:57:31 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5167
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5168
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5169
classVariableNames
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5170
    "alias for classVarNames.
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5171
     Traditionally, this was called classVarNames, but newer versions of squeak
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5172
     seem to have changed to use classVariableNames.
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5173
     So you probably should use this alias"
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5174
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5175
    ^ self classVarNames
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5176
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5177
    "
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5178
     Infinity classVariableNames
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5179
    "
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5180
!
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5181
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5182
classVariableString
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5183
    "return a string of the class variables names.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5184
     Returning empty here, since Behavior does not define any classVariables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5185
     (only Classes do). This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5186
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5187
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5188
    ^ ''
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5189
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5190
    "Created: 16.4.1996 / 16:28:56 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5191
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5192
9445
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5193
instVarNameForIndex:index
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5194
    "Behavior does not provide this info - generate synthetic names."
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5195
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5196
    ^ '* instVar' , index printString , ' *'
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5197
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5198
    "Created: / 17-07-2006 / 00:28:24 / cg"
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5199
!
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5200
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5201
instVarNames
15667
3892295febb9 class: Behavior
Claus Gittinger <cg@exept.de>
parents: 15562
diff changeset
  5202
    "return a collection of the instance variable name-strings.
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5203
     Behavior does not provide this info - generate synthetic names.
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5204
     Traditionally, this was called instVarNames, but newer versions of squeak
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5205
     seem to have changed to use instanceVariableNames.
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5206
     So you probably should use the alias"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5207
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5208
    |superclass superInsts|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5209
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5210
    superclass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5211
    superclass isNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5212
	superInsts := 0
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5213
    ] ifFalse:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5214
	superInsts := superclass instSize
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5215
    ].
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5216
    ^ (superInsts+1 to:self instSize)
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5217
	collect:[:index | self instVarNameForIndex:index]
9445
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5218
d6715c1442aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9363
diff changeset
  5219
    "Modified: / 17-07-2006 / 00:28:40 / cg"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5220
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5221
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5222
instanceVariableNames
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5223
    "alias for instVarNames.
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5224
     Traditionally, this was called instVarNames, but newer versions of squeak
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5225
     seem to have changed to use instanceVariableNames.
16042
831832d82e5f class: Behavior
Claus Gittinger <cg@exept.de>
parents: 16016
diff changeset
  5226
     So you probably should use this alias"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5227
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5228
    ^ self instVarNames
12794
ccfaa18fac96 comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents: 12359
diff changeset
  5229
ccfaa18fac96 comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents: 12359
diff changeset
  5230
    "
ccfaa18fac96 comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents: 12359
diff changeset
  5231
     Point instanceVariableNames
ccfaa18fac96 comment/format in: #instanceVariableNames
Claus Gittinger <cg@exept.de>
parents: 12359
diff changeset
  5232
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5233
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5234
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5235
instanceVariableString
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5236
    "return a string with dummy names here - typically, your
8857
28edbb9a8da2 slight code cleanup
Claus Gittinger <cg@exept.de>
parents: 8838
diff changeset
  5237
     objects are instances of Class, not Behavior,
28edbb9a8da2 slight code cleanup
Claus Gittinger <cg@exept.de>
parents: 8838
diff changeset
  5238
     so this is only invoked for very artificial behaviors."
28edbb9a8da2 slight code cleanup
Claus Gittinger <cg@exept.de>
parents: 8838
diff changeset
  5239
28edbb9a8da2 slight code cleanup
Claus Gittinger <cg@exept.de>
parents: 8838
diff changeset
  5240
    |superclass s superInsts first n "{Class: SmallInteger }"|
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5241
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5242
    superclass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5243
    s := ''.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5244
    superclass isNil ifTrue:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5245
	superInsts := 0
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5246
    ] ifFalse:[
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5247
	superInsts := superclass instSize
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5248
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5249
    n := self instSize.
8857
28edbb9a8da2 slight code cleanup
Claus Gittinger <cg@exept.de>
parents: 8838
diff changeset
  5250
    first := true.
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5251
    superInsts+1 to:n do:[:i |
18289
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5252
	first ifFalse:[s := s , ' '] ifTrue:[first := false].
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5253
Claus Gittinger <cg@exept.de>
parents: 18245
diff changeset
  5254
	s := s , 'instvar' , i printString
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5255
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5256
    ^ s
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5257
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5258
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5259
     Behavior new instanceVariableString
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5260
     (Behavior new instSize:2) instanceVariableString
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5261
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5262
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5263
    "Modified: 7.5.1996 / 12:50:25 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5264
    "Modified: 3.6.1996 / 16:03:33 / stefan"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5265
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5266
12862
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  5267
whichClassDefinesClassVar:aStringOrText
19833
2c27676f3588 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19822
diff changeset
  5268
    "Behavior does not support classVariables"
2c27676f3588 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19822
diff changeset
  5269
2c27676f3588 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19822
diff changeset
  5270
    ^ nil
12862
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  5271
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  5272
    "
13419
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  5273
     TextView whichClassDefinesClassVar:'CachedScales'
Claus Gittinger <cg@exept.de>
parents: 13414
diff changeset
  5274
     TextView whichClassDefinesClassVar:'xxx'
12862
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  5275
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5276
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5277
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5278
whichClassDefinesInstVar: aString
12862
aab829fab334 comment/format in: #whichClassDefinesInstVar:
Claus Gittinger <cg@exept.de>
parents: 12858
diff changeset
  5279
    ^ self whichClassSatisfies: [:aClass | aClass instVarNames includes: aString]
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5280
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5281
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5282
whichSelectorsAssign: instVarName
20976
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5283
    "Answer a set of selectors whose methods write the argument, instVarName,
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5284
    as a named instance variable."
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5285
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5286
    ^ self whichSelectorsWrite: instVarName
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5287
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5288
    "Modified (comment): / 16-11-2016 / 20:16:53 / cg"
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5289
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  5290
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5291
whichSelectorsRead: instVarName
20976
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5292
    "Answer a set of selectors whose methods read the argument, instVarName,
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5293
    as a named instance variable."
14239
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5294
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5295
"/        | instVarIndex methodDict|
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5296
"/        instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new].
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5297
"/        methodDict := self methodDictionary.
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5298
"/        ^methodDict keys select: [:sel | (methodDict at: sel)
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5299
"/                        readsField: instVarIndex]
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5300
20976
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5301
    | methodDict |
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5302
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5303
    methodDict := self methodDictionary.
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5304
    ^ methodDict keys select: [:sel | (methodDict at: sel) readsInstVar: instVarName]
14239
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5305
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5306
    "Modified: / 23-07-2012 / 11:22:04 / cg"
20976
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5307
    "Modified (comment): / 16-11-2016 / 20:16:45 / cg"
2
claus
parents: 1
diff changeset
  5308
!
claus
parents: 1
diff changeset
  5309
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5310
whichSelectorsReferTo:someLiteralConstant
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5311
    "return a collection of selectors of methods which refer to the argument.
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5312
     Search the literal arrays of my methods to do this."
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5313
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5314
    |setOfSelectors|
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5315
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  5316
    self methodDictionary keysAndValuesDo:[:sel :mthd |
19943
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  5317
	(mthd referencesLiteral:someLiteralConstant) ifTrue:[
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  5318
	    setOfSelectors isNil ifTrue:[
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  5319
		setOfSelectors := IdentitySet new.
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  5320
	    ].
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  5321
	    setOfSelectors add:sel
6f8e2d23fdae another lookup cache
Claus Gittinger <cg@exept.de>
parents: 19904
diff changeset
  5322
	].
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5323
    ].
19703
a7baa61d347e #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 19649
diff changeset
  5324
    ^ setOfSelectors ? #()
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5325
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5326
    "
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5327
     String whichSelectorsReferTo:#at:
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5328
     String whichSelectorsReferTo:CharacterArray
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5329
    "
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5330
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5331
    "Modified: / 28.10.1997 / 13:13:18 / cg"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5332
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  5333
5297
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5334
whichSelectorsReferToClassVariable:nameOfClassVariable
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5335
    "return a collection of selectors of methods which refer to the argument.
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5336
     Search the literal arrays of my methods to do this."
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5337
10413
70670d59c2e9 *** empty log message ***
sr
parents: 10185
diff changeset
  5338
    ^ self whichSelectorsReferToGlobal:(self theNonMetaclass globalKeyForClassVar:nameOfClassVariable)
5297
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5339
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5340
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5341
     Object whichSelectorsReferToClassVariable:#Dependencies
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5342
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5343
10185
881875c8010e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10172
diff changeset
  5344
    "Modified: / 18-11-2006 / 17:14:08 / cg"
5297
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5345
!
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5346
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5347
whichSelectorsReferToGlobal:nameOfGlobal
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5348
    "return a collection of selectors of methods which refer to the argument.
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5349
     Search the literal arrays of my methods to do this."
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5350
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5351
    |internalNameOfVar|
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5352
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5353
    internalNameOfVar := nameOfGlobal asSymbol.
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5354
    ^ self whichSelectorsReferTo:internalNameOfVar
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5355
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5356
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5357
     Object whichSelectorsReferToGlobal:#Debugger
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5358
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5359
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5360
    "Modified: / 4.2.2000 / 00:41:10 / cg"
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5361
!
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  5362
12094
5279d6af23cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11990
diff changeset
  5363
whichSelectorsWrite: instVarName
20976
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5364
    "Answer a set of selectors whose methods write the argument, instVarName,
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5365
    as a named instance variable."
14239
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5366
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5367
"/        | instVarIndex methodDict |
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5368
"/        instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new].
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5369
"/        methodDict := self methodDictionary.
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5370
"/        ^methodDict keys select: [:sel | (methodDict at: sel)
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5371
"/                        writesField: instVarIndex]
20976
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5372
    | methodDict |
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5373
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5374
    methodDict := self methodDictionary.
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5375
    ^ methodDict keys select: [:sel | (methodDict at: sel) writesInstVar: instVarName]
14239
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5376
796e20cb9bc3 changed:
Claus Gittinger <cg@exept.de>
parents: 14154
diff changeset
  5377
    "Modified: / 23-07-2012 / 11:21:17 / cg"
20976
90ddac3f02ec #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20823
diff changeset
  5378
    "Modified (format): / 16-11-2016 / 20:17:17 / cg"
2
claus
parents: 1
diff changeset
  5379
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5380
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5381
!Behavior methodsFor:'snapshots'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5382
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5383
postSnapshot
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5384
    "sent by ObjectMemory to all classes, after a snapshot has been written.
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5385
     Nothing done here. This can be redefined in classes which like to know
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5386
     about snapshooting."
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5387
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5388
    "Modified: 16.4.1996 / 18:12:08 / cg"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5389
!
9189
3fbc934d46a9 readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents: 8962
diff changeset
  5390
3fbc934d46a9 readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents: 8962
diff changeset
  5391
preSnapshot
3fbc934d46a9 readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents: 8962
diff changeset
  5392
    "sent by ObjectMemory to all classes, before a snapshot is written.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  5393
     Nothing done here. This can be redefined in classes which like to know
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  5394
     about snapshooting."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  5395
9189
3fbc934d46a9 readFromString: - allow for whitespace following the string
Claus Gittinger <cg@exept.de>
parents: 8962
diff changeset
  5396
    "Modified: 16.4.1996 / 18:12:14 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5397
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  5398
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  5399
!Behavior methodsFor:'tracing'!
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  5400
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5401
traceInto:aRequestor level:level from:referrer
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5402
    "double dispatch into tracer, passing my type implicitely in the selector"
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5403
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5404
    ^ aRequestor traceBehavior:self level:level from:referrer
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5405
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5406
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  5407
! !
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  5408
9194
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5409
!Behavior methodsFor:'visiting'!
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5410
Claus Gittinger <cg@exept.de>
parents: 9189
diff changeset
  5411
acceptVisitor:aVisitor with:aParameter
16734
5184124214e2 comment/format only
Claus Gittinger <cg@exept.de>
parents: 16280
diff changeset
  5412
    "dispatch for visitor pattern; send #visitBehavior:with: to aVisitor"
8398
666ef609ec93 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8353
diff changeset
  5413
666ef609ec93 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8353
diff changeset
  5414
    ^ aVisitor visitBehavior:self with:aParameter
666ef609ec93 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8353
diff changeset
  5415
! !
666ef609ec93 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8353
diff changeset
  5416
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  5417
!Behavior class methodsFor:'documentation'!
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  5418
13839
95b353c4d5f1 changed: #setTraitComposition:
Claus Gittinger <cg@exept.de>
parents: 13838
diff changeset
  5419
version
18570
198c3622e7d6 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 18435
diff changeset
  5420
    ^ '$Header$'
13839
95b353c4d5f1 changed: #setTraitComposition:
Claus Gittinger <cg@exept.de>
parents: 13838
diff changeset
  5421
!
95b353c4d5f1 changed: #setTraitComposition:
Claus Gittinger <cg@exept.de>
parents: 13838
diff changeset
  5422
12113
6fbe0157e258 changed: #definitionSelectors
Claus Gittinger <cg@exept.de>
parents: 12094
diff changeset
  5423
version_CVS
18570
198c3622e7d6 class: Behavior
Stefan Vogel <sv@exept.de>
parents: 18435
diff changeset
  5424
    ^ '$Header$'
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  5425
! !
22362
271a6e5f7804 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22311
diff changeset
  5426