Behavior.st
author Claus Gittinger <cg@exept.de>
Sun, 26 Jan 2003 15:15:53 +0100
changeset 6968 5eb367934349
parent 6931 da671aa63926
child 7123 2af84f5b1447
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
    13
"{ Package: 'stx:libbasic' }"
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
    14
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#Behavior
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
    16
	instanceVariableNames:'superclass flags methodDictionary otherSuperclasses instSize'
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
    17
	classVariableNames:'SubclassInfo'
1088
989f0e510a32 nicer message
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
    18
	poolDictionaries:''
989f0e510a32 nicer message
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
    19
	category:'Kernel-Classes'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
    22
!Behavior class methodsFor:'documentation'!
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    23
88
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    24
copyright
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    25
"
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    26
 COPYRIGHT (c) 1988 by Claus Gittinger
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
    27
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    28
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    29
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    30
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    32
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    33
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    34
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    35
"
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    36
!
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    37
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    38
documentation
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    39
"
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    40
    Every class in the system inherits from Behavior (via Class, ClassDescription);
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    41
    so here is where most of the class messages end up being implemented.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    42
    (to answer a FAQ: 'Point basicNew' will be done here :-)
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    43
356
claus
parents: 345
diff changeset
    44
    Beginners should keep in mind, that all classes are instances (of subclasses)
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
    45
    of Behavior, therefore you will find the above mentioned 'basicNew:' method 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
    46
    under the 'instance'-methods of Behavior - NOT under the class methods 
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
    47
    ('Behavior new' will create and return a new class, while sending 'new' to 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
    48
    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
    49
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    50
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    51
    Behavior provides minimum support for all classes - additional stuff is
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    52
    found in ClassDescription and Class. Behaviors provides all mechanisms needed
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    53
    to create instances, and send messages to those. However, Behavior does not provide 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    54
    all the (symbolic) information needed to compile methods for a class or to get
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    55
    useful information in inspectors.
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    56
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    57
    for experts:
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    58
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    59
    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
    60
    message dispatch mechanism, these can be used as 'light weight' classes.
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    61
    I.e. it is possible, to generate completely anonymous classes (and instances thereof)
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    62
    on the fly - 'Behavior new new' is such a thingy.
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    63
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    64
    The selectors and Methods are organized in a MethodDictionary (which is not a true 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    65
    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
    66
    This avoids the need for knowledge about Dictionaries in the runtime library (VM)
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    67
    (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
    68
     hashed dictionary is almost void).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    69
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    70
    [Instance variables:]
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    71
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    72
	superclass        <Class>            the receivers superclass
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    73
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    74
	otherSuperclasses <Array of Class>   experimental: other superclasses
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    75
					     a hook for experimental multiple inheritance
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    76
					     implementations
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    77
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    78
	methodDictionary  <MethodDictionary> inst-selectors and methods
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    79
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    80
	instSize          <SmallInteger>     the number of instance variables
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    81
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    82
	flags             <SmallInteger>     special flag bits coded in a number
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    83
					     not for application use
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    84
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
    85
    flag bits (see stc.h):
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    86
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    87
    NOTICE: layout known by compiler and runtime system; be careful when changing
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    88
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1285
diff changeset
    89
    [author:]
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    90
	Claus Gittinger
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1285
diff changeset
    91
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    92
    [see also:]
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    93
	Class ClassDescription Metaclass
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    94
	Method MethodDictionary
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    95
"
356
claus
parents: 345
diff changeset
    96
!
claus
parents: 345
diff changeset
    97
claus
parents: 345
diff changeset
    98
virtualMachineRelationship 
claus
parents: 345
diff changeset
    99
"
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   100
    Expert info follows:
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   101
357
claus
parents: 356
diff changeset
   102
    NOTICE: 
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   103
	the stuff described below may not be available on other
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   104
	Smalltalk implementations; be aware that these error mechanisms
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   105
	are ST/X specials and applications using these (tricks) may
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   106
	not be portable to other systems.
357
claus
parents: 356
diff changeset
   107
claus
parents: 356
diff changeset
   108
    WARNING: 
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   109
	do not try the examples below on (some) other smalltalk systems;
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   110
	it has been reported, that some crash badly when doing this .... ;-)
357
claus
parents: 356
diff changeset
   111
356
claus
parents: 345
diff changeset
   112
    Instances of Behavior and subclasses (i.e. in sloppy words: classes)
claus
parents: 345
diff changeset
   113
    play a special role w.r.t. the VM. Only objects whose class-slot is marked
claus
parents: 345
diff changeset
   114
    as being behaviorLike (in the flag-instvar) are considered to be classLike
claus
parents: 345
diff changeset
   115
    and a message lookup will be done for it in the well known way.
claus
parents: 345
diff changeset
   116
    Thus, if an object has a class for which its class does NOT have
362
claus
parents: 360
diff changeset
   117
    this flag bit set, the VM will trigger an error on a message send.
356
claus
parents: 345
diff changeset
   118
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   119
356
claus
parents: 345
diff changeset
   120
    Why is this so:
claus
parents: 345
diff changeset
   121
claus
parents: 345
diff changeset
   122
    the above lets every object play the role of a class,
claus
parents: 345
diff changeset
   123
    which has been flagged as behaviorLike in its class's flag.
claus
parents: 345
diff changeset
   124
    Thus, you can create arbitrary new classLike objects and have the VM 
claus
parents: 345
diff changeset
   125
    play with them.
claus
parents: 345
diff changeset
   126
    This may offer the flexibility to create a totally different object scheme
362
claus
parents: 360
diff changeset
   127
    on top of ST/X (for example: Self like objects) where any object can play
claus
parents: 360
diff changeset
   128
    a classRole for another object.
356
claus
parents: 345
diff changeset
   129
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   130
    [A concrete application of this is found in the Structure class,
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   131
     which creates objects which are their own class !!
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   132
     This may look to be of theoretical value at first sight, 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   133
     however, such a construct saves memory, by not requiring an extra 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   134
     class object per Structure object.]
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   135
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   136
    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
   137
    object, the VM EXPECTS the object selector and methodDictionaries to be found
362
claus
parents: 360
diff changeset
   138
    at the instance positions as defined here.
claus
parents: 360
diff changeset
   139
    (i.e. instanceVariables with contents and semantic corresponding to
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   140
	superclass 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   141
	flags 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   142
	methodDictionary
362
claus
parents: 360
diff changeset
   143
     must be present and have the same instVar-index as here).
claus
parents: 360
diff changeset
   144
356
claus
parents: 345
diff changeset
   145
    The VM (and the system) may crash badly, if this is not the case.
362
claus
parents: 360
diff changeset
   146
356
claus
parents: 345
diff changeset
   147
    Since every class in the system derives from Behavior, the flag setting
357
claus
parents: 356
diff changeset
   148
    (and instance variable layout) is correct for all 'normal' classes.
claus
parents: 356
diff changeset
   149
    If you experiment by creating new behaviorLike objects, please take
claus
parents: 356
diff changeset
   150
    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
   151
    instVars  'superclass' and 'methodDictionary' are required
357
claus
parents: 356
diff changeset
   152
    and have to be at the same instVar index.
362
claus
parents: 360
diff changeset
   153
    (we suggest, you subclass Behavior, to make certain)
357
claus
parents: 356
diff changeset
   154
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   155
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   156
    Vice versa, defining 'dump classes', which have the behaviorLike bit turned
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   157
    of may be useful as well; if a message is sent to an instance of such
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   158
    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
   159
    #doesNotUnderstand: mechanism - however, since the instance is no good
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   160
    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
   161
    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
   162
    and arguments) along with the original receiver.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   163
    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
   164
    however, you may redefine this in your 'dum class' for recovery.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   165
    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
   166
    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
   167
    interface.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   168
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   169
    All of the above is pure expert stuff 
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   170
    - 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
   171
    ST-programmer, though (and even most of those will never use these features).
357
claus
parents: 356
diff changeset
   172
356
claus
parents: 345
diff changeset
   173
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   174
    Examples (only of theoretical interest):
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   175
	take away the behaviorLike-flag from a class.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   176
	-> The instances will not understand any messages, since the VM will
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   177
	   not recognize its class as being a class ...
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   178
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   179
	|newMeta notRecognizedAsClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   180
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   181
	newMeta := Metaclass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   182
	newMeta flags:0.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   183
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   184
	notRecognizedAsClass := newMeta new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   185
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   186
	someInstance := notRecognizedAsClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   187
	someInstance perform:#isNil
356
claus
parents: 345
diff changeset
   188
357
claus
parents: 356
diff changeset
   189
claus
parents: 356
diff changeset
   190
    Of course, this is an exception which can be handled ...:
claus
parents: 356
diff changeset
   191
    Example:
claus
parents: 356
diff changeset
   192
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   193
	|newMeta notRecognizedAsClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   194
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   195
	newMeta := Metaclass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   196
	newMeta flags:0.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   197
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   198
	notRecognizedAsClass := newMeta new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   199
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   200
	someInstance := notRecognizedAsClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   201
	Object errorSignal handle:[:ex |
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   202
	    ex return
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   203
	] do:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   204
	    someInstance perform:#isNil
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   205
	]
357
claus
parents: 356
diff changeset
   206
claus
parents: 356
diff changeset
   207
claus
parents: 356
diff changeset
   208
    likewise, a doesNotUnderstand-notUnderstood can be handled:
claus
parents: 356
diff changeset
   209
    Example:
claus
parents: 356
diff changeset
   210
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   211
	|newMeta funnyClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   212
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   213
	newMeta := Metaclass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   214
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   215
	funnyClass := newMeta new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   216
	funnyClass setSuperclass:nil.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   217
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   218
	someInstance := funnyClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   219
	Object errorSignal handle:[:ex |
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   220
	     ex return
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   221
	] do:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   222
	    someInstance perform:#isNil
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   223
	]
357
claus
parents: 356
diff changeset
   224
claus
parents: 356
diff changeset
   225
362
claus
parents: 360
diff changeset
   226
    more examples, which try to trick the VM ;-):
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   227
	badly playing around with a classes internals ...
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   228
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   229
	|newClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   230
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   231
	newClass := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   232
	newClass setSuperclass:nil.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   233
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   234
	someInstance inspect
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   235
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   236
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   237
	|newClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   238
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   239
	newClass := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   240
	newClass setSuperclass:newClass.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   241
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   242
	someInstance inspect
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   243
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   244
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   245
	|newClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   246
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   247
	newClass := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   248
	newClass setSuperclass:1.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   249
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   250
	someInstance inspect
357
claus
parents: 356
diff changeset
   251
claus
parents: 356
diff changeset
   252
356
claus
parents: 345
diff changeset
   253
    Example:
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   254
	creating totally anonymous classes:
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   255
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   256
	|newClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   257
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   258
	newClass := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   259
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   260
	someInstance inspect
356
claus
parents: 345
diff changeset
   261
357
claus
parents: 356
diff changeset
   262
356
claus
parents: 345
diff changeset
   263
    Example:
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   264
	creating totally anonymous metaclasses:
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   265
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   266
	|newMeta newClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   267
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   268
	newMeta := Metaclass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   269
	newClass := newMeta new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   270
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   271
	someInstance inspect
357
claus
parents: 356
diff changeset
   272
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   273
357
claus
parents: 356
diff changeset
   274
    PS: if you experiment with new behaviorLike objects, you may want 
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   275
	to turn off the VM's debugPrintouts
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   276
	with: 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   277
		'Smalltalk debugPrinting:false'
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   278
	and: 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   279
		'Smalltalk infoPrinting:false'
356
claus
parents: 345
diff changeset
   280
"
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
   281
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   282
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   283
!Behavior class methodsFor:'creating new classes'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   284
a27a279701f8 Initial revision
claus
parents:
diff changeset
   285
new
356
claus
parents: 345
diff changeset
   286
    "creates and return a new behavior (which is like a class,
claus
parents: 345
diff changeset
   287
     but without the symbolic & name information).
claus
parents: 345
diff changeset
   288
     Not for normal applications.
claus
parents: 345
diff changeset
   289
     Sending the returned behavior the #new message gives you
claus
parents: 345
diff changeset
   290
     an instance if it.
claus
parents: 345
diff changeset
   291
claus
parents: 345
diff changeset
   292
     Notice: the returned class is given a superclass of Object;
claus
parents: 345
diff changeset
   293
     this allows for its new instances to be inspected and the like."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   294
a27a279701f8 Initial revision
claus
parents:
diff changeset
   295
    |newClass|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   296
a27a279701f8 Initial revision
claus
parents:
diff changeset
   297
    newClass := self basicNew.
5906
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
   298
    newClass 
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
   299
        setSuperclass:Object
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
   300
        methodDictionary:(MethodDictionary new)
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
   301
        instSize:0
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
   302
        flags:(self flagBehavior).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   303
    ^ newClass
356
claus
parents: 345
diff changeset
   304
claus
parents: 345
diff changeset
   305
    "
claus
parents: 345
diff changeset
   306
     Behavior new               <- a new behavior
claus
parents: 345
diff changeset
   307
     Behavior new new           <- an instance of it
claus
parents: 345
diff changeset
   308
     ClassDescription new       <- a new classDescription
claus
parents: 345
diff changeset
   309
     ClassDescription new new   <- an instance of it
claus
parents: 345
diff changeset
   310
     Class new                  <- a new class
claus
parents: 345
diff changeset
   311
     Class new new              <- an instance of it
claus
parents: 345
diff changeset
   312
     Metaclass new              <- a new metaclass
claus
parents: 345
diff changeset
   313
     Metaclass new new          <- an instance (i.e. a class) of it
claus
parents: 345
diff changeset
   314
     Metaclass new new new      <- an instance of this new class
claus
parents: 345
diff changeset
   315
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   316
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   317
    "Modified: 7.6.1996 / 15:38:58 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   318
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   319
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   320
!Behavior class methodsFor:'flag bit constants'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   321
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   322
flagBehavior
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   323
    "return the flag code which marks Behavior-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   324
     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
   325
     checking for behaviors."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   326
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   327
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   328
    /* 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
   329
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   330
    RETURN ( __MKSMALLINT(BEHAVIOR_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   331
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   332
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   333
    "consistency check:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   334
     all class-entries must be behaviors;
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   335
     all behaviors must be flagged so (in its class's flags)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   336
     (otherwise, VM will bark)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   337
     all non-behaviors may not be flagged
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   338
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   339
     |bit|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   340
     bit := Class flagBehavior.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   341
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   342
     ObjectMemory allObjectsDo:[:o|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   343
       o isBehavior ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   344
	 (o class flags bitTest:bit) ifFalse:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   345
	     self halt
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   346
	 ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   347
       ] ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   348
	 (o class flags bitTest:bit) ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   349
	     self halt
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   350
	 ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   351
       ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   352
       o class isBehavior ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   353
	 self halt
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   354
       ] ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   355
	 (o class class flags bitTest:bit) ifFalse:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   356
	     self halt
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   357
	 ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   358
       ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   359
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   360
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   361
!
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
flagBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   364
    "return the flag code which marks Block-like instances.
2236
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   365
     The VM checks for either this bit or the blockLike bit in the flag 
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   366
     value when checking for blocks to be evaluated from bytecodes.
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   367
     However, compiled code only checks for the block bit."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   368
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   369
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   370
    /* 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
   371
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   372
    RETURN ( __MKSMALLINT(BLOCK_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   373
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   374
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   375
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   376
flagBlockContext
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   377
    "return the flag code which marks BlockContext-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   378
     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
   379
     checking for blockContexts."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   380
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   381
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   382
    /* 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
   383
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   384
    RETURN ( __MKSMALLINT(BCONTEXT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   385
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   386
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   387
2236
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   388
flagBlockLike
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   389
    "return the flag code which marks Block-like instances
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   390
     with respect to byteCode interpretation.
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   391
     The VM checks for either this bit or the block bit in the flag 
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   392
     value when checking for blocks to be evaluated from bytecodes.
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   393
     However, compiled code only checks for the block bit."
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   394
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   395
%{  /* NOCONTEXT */
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   396
    /* this is defined as a primitive to get defines from stc.h */
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   397
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   398
    RETURN ( __MKSMALLINT(BLOCKLIKE_INSTS) );
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   399
%}
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   400
!
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   401
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   402
flagBytes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   403
    "return the flag code for byte-valued indexed instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   404
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   405
     and compares it to this flag value, when checking for byte valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   406
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   407
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   408
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   409
    /* 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
   410
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   411
    RETURN ( __MKSMALLINT(BYTEARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   412
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   413
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   414
     Behavior flagBytes    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   415
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   416
!
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
flagContext
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   419
    "return the flag code which marks Context-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   420
     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
   421
     checking for contexts."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   422
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   423
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   424
    /* 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
   425
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   426
    RETURN ( __MKSMALLINT(CONTEXT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   427
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   428
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   429
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   430
flagDoubles
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   431
    "return the flag code for double-valued indexed instances (i.e. 8-byte reals).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   432
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   433
     and compares it to this flag value, when checking for double valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   434
     variable instances."
620
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
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   437
    /* 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
   438
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   439
    RETURN ( __MKSMALLINT(DOUBLEARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   440
%}
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
     Behavior flagDoubles    
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   443
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   444
     (ByteArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)    
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   445
     (DoubleArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)    
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   446
     (Object flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)    
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   447
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   448
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   449
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   450
flagFloat
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   451
    "return the flag code which marks Float-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   452
     The VM checks this single bit in the flag value when
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   453
     checking for a float."
620
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
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   456
    /* 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
   457
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   458
    RETURN ( __MKSMALLINT(FLOAT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   459
%}
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   462
flagFloats
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   463
    "return the flag code for float-valued indexed instances (i.e. 4-byte reals).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   464
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   465
     and compares it to this flag value, when checking for double valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   466
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   467
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   468
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   469
    /* 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
   470
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   471
    RETURN ( __MKSMALLINT(FLOATARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   472
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   473
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   474
     Behavior flagFloats    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   475
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   476
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   477
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   478
flagForSymbolic:aSymbol
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   479
    "return the flag code for indexed instances with aSymbolic type.
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   480
     The argument may be one of #float, #double, #long, #word, #signedWord,
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   481
     #signedLong or #byte.
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   482
     For VW compatibility, also accept:
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   483
        #objects, #bytes.
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   484
    "
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   485
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   486
%{   /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   487
    if (aSymbol == @symbol(float)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   488
        RETURN ( __MKSMALLINT(FLOATARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   489
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   490
    if (aSymbol == @symbol(double)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   491
        RETURN ( __MKSMALLINT(DOUBLEARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   492
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   493
    if (aSymbol == @symbol(long)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   494
        RETURN ( __MKSMALLINT(LONGARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   495
    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   496
    if (aSymbol == @symbol(longLong)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   497
        RETURN ( __MKSMALLINT(LONGLONGARRAY) );
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   498
    }
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   499
    if (aSymbol == @symbol(word)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   500
        RETURN ( __MKSMALLINT(WORDARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   501
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   502
    if (aSymbol == @symbol(signedWord)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   503
        RETURN ( __MKSMALLINT(SWORDARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   504
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   505
    if (aSymbol == @symbol(signedLong)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   506
        RETURN ( __MKSMALLINT(SLONGARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   507
    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   508
    if (aSymbol == @symbol(signedLongLong)) {
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   509
        RETURN ( __MKSMALLINT(SLONGLONGARRAY) );
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   510
    }
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   511
    if ((aSymbol == @symbol(byte)) || (aSymbol == @symbol(bytes))) {
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   512
        RETURN ( __MKSMALLINT(BYTEARRAY) );
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   513
    }
6104
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   514
    if (aSymbol == @symbol(objects)) {
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   515
        RETURN ( __MKSMALLINT(POINTERARRAY) );
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   516
    }
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   517
    if (aSymbol == @symbol(weakObjects)) {
c3466930ccd2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6099
diff changeset
   518
        RETURN ( __MKSMALLINT(WKPOINTERARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   519
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   520
%}.
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   521
    ^ 0         "/ not indexed
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   522
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   523
3141
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   524
flagJavaClass
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   525
    "return the flag code which marks JavaClass-like instances.
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   526
     The VM checks this single bit in the flag value when
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   527
     checking for a javaClass."
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   528
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   529
%{  /* NOCONTEXT */
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   530
    /* this is defined as a primitive to get defines from stc.h */
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   531
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   532
    RETURN ( __MKSMALLINT(JCLASS_INSTS) );
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   533
%}
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   534
!
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   535
2801
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   536
flagJavaMethod
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   537
    "return the flag code which marks JavaMethod-like instances.
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   538
     The VM checks this single bit in the flag value when
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   539
     checking for a method."
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   540
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   541
%{  /* NOCONTEXT */
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   542
    /* 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
   543
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   544
    RETURN ( __MKSMALLINT(JMETHOD_INSTS) );
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   545
%}
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   546
!
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   547
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   548
flagLongLongs
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   549
    "return the flag code for longlong-valued indexed instances (i.e. 8-byte).
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   550
     The VM masks the flag value with the indexMask (maskIndexType) 
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   551
     and compares it to this flag value, when checking for 
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   552
     unsigned long valued variable instances."
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   553
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   554
%{  /* NOCONTEXT */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   555
    /* this is defined as a primitive to get defines from stc.h */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   556
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   557
    RETURN ( __MKSMALLINT(LONGLONGARRAY) );
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   558
%}
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   559
    "
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   560
     Behavior flagLongLongs    
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   561
    "
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   562
!
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   563
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   564
flagLongs
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   565
    "return the flag code for long-valued indexed instances (i.e. 4-byte).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   566
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   567
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   568
     unsigned long valued variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   569
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   570
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   571
    /* 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
   572
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   573
    RETURN ( __MKSMALLINT(LONGARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   574
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   575
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   576
     Behavior flagLongs    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   577
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   578
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   579
5743
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   580
flagMetaMethod
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   581
    "return the flag code which marks MetaMethod-like instances.
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   582
     The VM checks this single bit in the flag value when
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   583
     about to evaluate a method."
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   584
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   585
%{  /* NOCONTEXT */
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   586
    /* 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
   587
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   588
    RETURN ( __MKSMALLINT(METAMETHOD_INSTS) );
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   589
%}
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   590
!
5332ba576615 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5727
diff changeset
   591
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   592
flagMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   593
    "return the flag code which marks Method-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   594
     The VM checks this single bit in the flag value when
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   595
     checking for a method."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   596
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   597
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   598
    /* 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
   599
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   600
    RETURN ( __MKSMALLINT(METHOD_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   601
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   602
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   603
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   604
flagNonObjectInst
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   605
    "return the flag code which marks instances which have a
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   606
     non-object instance variable (in slot 1).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   607
     (these are ignored by the garbage collector)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   608
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   609
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   610
    /* 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
   611
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   612
    RETURN ( __MKSMALLINT(NONOBJECT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   613
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   614
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   615
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   616
flagNotIndexed
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   617
    "return the flag code for non-indexed instances.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   618
     You have to mask the flag value with indexMask when comparing
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   619
     it with flagNotIndexed."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   621
    ^ 0
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   622
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   623
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   624
flagPointers
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   625
    "return the flag code for pointer indexed instances (i.e. Array of object).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   626
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   627
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   628
     pointer variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   629
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   630
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   631
    /* 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
   632
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   633
    RETURN ( __MKSMALLINT(POINTERARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   634
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   635
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   636
     Behavior flagPointers    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   637
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   638
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   639
1383
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   640
flagRegular
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   641
    "return the flag code which marks regular instances."
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   642
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   643
    ^ 0
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   644
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   645
    "Created: 12.5.1996 / 17:53:36 / cg"
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   646
!
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   647
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   648
flagSignedLongLongs
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   649
    "return the flag code for signed longlong-valued indexed instances (i.e. 8-byte).
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   650
     The VM masks the flag value with the indexMask (maskIndexType) 
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   651
     and compares it to this flag value, when checking for 
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   652
     signed long valued variable instances."
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   653
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   654
%{  /* NOCONTEXT */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   655
    /* this is defined as a primitive to get defines from stc.h */
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   656
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   657
    RETURN ( __MKSMALLINT(SLONGLONGARRAY) );
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   658
%}
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   659
    "
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   660
     Behavior flagSignedLongLongs
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   661
    "
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   662
!
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
   663
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   664
flagSignedLongs
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   665
    "return the flag code for signed long-valued indexed instances (i.e. 4-byte).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   666
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   667
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   668
     signed long valued variable instances."
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   669
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   670
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   671
    /* this is defined as a primitive to get defines from stc.h */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   672
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   673
    RETURN ( __MKSMALLINT(SLONGARRAY) );
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   674
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   675
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   676
     Behavior flagSignedLongs
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   677
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   678
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   679
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   680
flagSignedWords
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   681
    "return the flag code for signed word-valued indexed instances (i.e. 2-byte).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   682
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   683
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   684
     signed word valued variable instances."
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   685
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   686
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   687
    /* this is defined as a primitive to get defines from stc.h */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   688
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   689
    RETURN ( __MKSMALLINT(SWORDARRAY) );
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   690
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   691
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   692
     Behavior flagSignedWords
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   693
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   694
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   695
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   696
flagSymbol
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   697
    "return the flag code which marks Symbol-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   698
     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
   699
     checking for symbols."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   700
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   701
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   702
    /* 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
   703
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   704
    RETURN ( __MKSMALLINT(SYMBOL_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   705
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   706
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   707
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   708
flagWeakPointers
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   709
    "return the flag code for weak pointer indexed instances (i.e. WeakArray).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   710
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   711
     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
   712
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   713
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   714
    /* 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
   715
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   716
    RETURN ( __MKSMALLINT(WKPOINTERARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   717
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   718
!
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
flagWords
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   721
    "return the flag code for word-valued indexed instances (i.e. 2-byte).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   722
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   723
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   724
     unsigned word valued variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   725
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   726
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   727
    /* 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
   728
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   729
    RETURN ( __MKSMALLINT(WORDARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   730
%}
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
     Behavior flagWords    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   733
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   734
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   735
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   736
maskIndexType
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   737
    "return a mask to extract all index-type bits"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   738
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   739
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   740
    /* 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
   741
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   742
    RETURN ( __MKSMALLINT(ARRAYMASK) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   743
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   744
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   745
4964
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   746
!Behavior class methodsFor:'misc'!
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   747
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   748
autoload
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   749
    "for compatibility with autoloaded classes - dummy here"
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   750
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   751
    ^ self
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   752
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   753
! !
1169f19c9210 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4928
diff changeset
   754
6099
d501d6a49a48 category included a space
Claus Gittinger <cg@exept.de>
parents: 6076
diff changeset
   755
!Behavior class methodsFor:'private'!
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   756
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   757
flushSubclassInfo
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   758
    "throw away (forget) the cached subclass information, as created
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   759
     by #subclassInfo.
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   760
     This is private protocol"
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   761
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   762
    SubclassInfo := nil.
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
     Class flushSubclassInfo
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   766
    "
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   767
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   768
    "Modified: 22.1.1997 / 18:39:36 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   769
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   770
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   771
subclassInfo
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   772
    "build & return a dictionary, containing the set of subclass
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   773
     for each class. This information is kept until explicitely flushed
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   774
     by #flushSubclassInfo.
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   775
     This cache is used internally, for enumerators like #allSubclasses
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   776
     or #allSubclassesDo:, to avoid repeated recursive walks over the class
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   777
     hierarchy.
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   778
     This is private protocol."
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   779
357
claus
parents: 356
diff changeset
   780
    |d|
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   781
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   782
    SubclassInfo notNil ifTrue:[^ SubclassInfo].
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   783
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   784
    d := IdentityDictionary new.
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   785
    Smalltalk allClassesDo:[:aClass |
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   786
	|superCls|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   787
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   788
	aClass isMeta not ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   789
	    superCls := aClass superclass.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   790
	    superCls notNil ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   791
		(d includesKey: superCls) ifFalse:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   792
		    d at:superCls put:(IdentitySet with:aClass).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   793
		] ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   794
		    (d at:superCls ) add:aClass
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   795
		]
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   796
	    ]
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   797
	].
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   798
    ].
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   799
    SubclassInfo := d.
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   800
    ^ d
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   801
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   802
    "
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   803
     Class subclassInfo
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   804
    "
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   805
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   806
    "Modified: 22.1.1997 / 18:44:59 / cg"
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
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   809
!Behavior class methodsFor:'queries'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   810
4332
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
   811
definitionSelectorFirstParts
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
   812
    "return a collection of partial class-definition selectors"
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
   813
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
   814
    ^ #( #'subclass:'
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   815
	 #'variableSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   816
	 #'variableByteSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   817
	 #'variableWordSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   818
	 #'variableLongSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   819
	 #'variableSignedWordSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   820
	 #'variableSignedLongSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   821
	 #'variableLongLongSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   822
	 #'variableSignedLongLongSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   823
	 #'variableFloatSubclass:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   824
	 #'variableDoubleSubclass:'
4332
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
   825
      )  
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
   826
!
c672bf261fbd added query for class-def selectors.
Claus Gittinger <cg@exept.de>
parents: 4307
diff changeset
   827
4428
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
   828
definitionSelectors
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
   829
    "return a collection class-definition selectors"
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
   830
4579
848788d00ccf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4451
diff changeset
   831
    ^ #( 
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   832
	 #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   833
	 #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   834
	 #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   835
	 #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   836
	 #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   837
	 #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   838
	 #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   839
	 #'variableLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   840
	 #'variableSignedLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   841
	 #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   842
	 #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   843
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   844
	"/ ST/X private subclasses
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   845
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   846
	 #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   847
	 #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   848
	 #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   849
	 #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   850
	 #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   851
	 #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   852
	 #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   853
	 #'variableLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   854
	 #'variableSignedLongLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   855
	 #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   856
	 #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   857
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   858
	"/ ST/V subclass messages
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   859
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   860
	 #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   861
	 #'variableByteSubclass:classVariableNames:poolDictionaries:'
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
   862
	 #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:'
4428
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
   863
      )  
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
   864
!
d612ee1f2b32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4371
diff changeset
   865
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   866
isBuiltInClass
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
   867
    "return true if this class is known by the run-time-system.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
   868
     Here, true is returned for myself, false for subclasses."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   869
1179
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   870
    ^ (self == Behavior class) or:[self == Behavior]
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   871
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
   872
    "Modified: 23.4.1996 / 15:55:52 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   873
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   874
6733
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
   875
6329
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
   876
!Behavior methodsFor:'Compatibility - Dolphin'!
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
   877
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
   878
allSubinstances
6865
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
   879
    ^ self allSubInstances
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
   880
!
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
   881
6889
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
   882
fromString:aString
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
   883
    ^ self readFrom:aString
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
   884
!
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
   885
6865
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
   886
guid:aUUID
434e45411991 dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 6754
diff changeset
   887
    ^ self
6329
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
   888
! !
e6c32a251669 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6147
diff changeset
   889
4889
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   890
!Behavior methodsFor:'Compatibility - Squeak'!
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   891
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   892
defaultNameStemForInstances
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   893
    "Answer a basis for names of default instances of the receiver"
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   894
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   895
    ^ self name
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   896
5753
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
   897
!
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
   898
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
   899
lookupSelector:aSelector
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
   900
    "return the method for a selector - Squeak compatibility"
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
   901
65cce9486ee9 added #lookupSelector: for Squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 5743
diff changeset
   902
    ^ self lookupMethodFor:aSelector
6147
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   903
!
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   904
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   905
selectorsWithArgs:numberOfArgs 
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   906
    "Return all selectors defined in this class that take this number of arguments."
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   907
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   908
    ^ self selectors 
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   909
        select:[:sel | sel numArgs == numberOfArgs]
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   910
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   911
    "
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   912
     SmallInteger selectorsWithArgs:0  
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   913
     SmallInteger selectorsWithArgs:2  
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   914
     SmallInteger selectorsWithArgs:3
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   915
     SmallInteger selectorsWithArgs:4  
42cc230e5a9b selectorsWithArgs: (for squeak)
james
parents: 6140
diff changeset
   916
    "
4889
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   917
! !
aa8f6b9f7e28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4851
diff changeset
   918
5964
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   919
!Behavior methodsFor:'Compatibility - VW'!
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   920
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   921
>> aSelector
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   922
    "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
   923
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   924
    ^ self compiledMethodAt:aSelector
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   925
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   926
    "
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   927
     self compiledMethodAt:#compiledMethodAt:
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   928
     self >> #compiledMethodAt:
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   929
    "
6115
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   930
!
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   931
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   932
fixedFieldsMask
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   933
    "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
   934
     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
   935
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   936
    ^ 255
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   937
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   938
!
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   939
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   940
format
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   941
    "Answer an Integer that encodes the kinds and numbers of
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   942
    variables of instances of the receiver.
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   943
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   944
    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
   945
    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
   946
    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
   947
    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
   948
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   949
    "/ simulate a VW5i mask
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   950
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   951
    ^ (self instSize
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   952
      bitOr:( self isPointers ifTrue:[16384] ifFalse:[0]))
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   953
      bitOr:( self isVariable ifTrue:[ 4096] ifFalse:[0])
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   954
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   955
!
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   956
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   957
instanceBehavior
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   958
    "Answer the instance behavior of the receiver. 
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   959
     This is the receiver for non metaclasses. 
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   960
     Metaclass overrides this to answer a Metaclass's sole instance.
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   961
     Same as #theNonMetaclass - for VW compatibility
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   962
    "
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   963
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   964
    ^ self theNonMetaclass
b1af45aca054 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6104
diff changeset
   965
6968
5eb367934349 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6931
diff changeset
   966
!
5eb367934349 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6931
diff changeset
   967
5eb367934349 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6931
diff changeset
   968
shortName
5eb367934349 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6931
diff changeset
   969
    ^ self nameWithoutPrefix
5964
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   970
! !
0f748abc0c17 protocol rename
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
   971
4851
ff6ecefce66f skip namespaces in #allSubclasses / #withAllSubclasses
ca
parents: 4738
diff changeset
   972
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   973
!Behavior methodsFor:'accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   974
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   975
addSelector:newSelector withLazyMethod:newMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   976
    "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
   977
     1st argument to the methodDictionary. 
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   978
     Since it does not normally flush any caches,
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   979
     this is only allowed for lazy methods (which are for a new class)."
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   980
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   981
    |oldMethod|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   982
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   983
    newMethod isLazyMethod ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   984
	self error:'operation only allowed for lazy methods'.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   985
	^ false
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   986
    ].
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   987
    oldMethod := self compiledMethodAt:newSelector.
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   988
    "/
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   989
    "/ oops: we must flush, if this method already exists ...
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   990
    "/ otherwise, the old method would still be executed out of the caches.
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   991
    "/
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   992
    oldMethod notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   993
	newMethod privacy:(oldMethod privacy).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   994
	newMethod restricted:(oldMethod isRestricted).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   995
	ObjectMemory flushCaches
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   996
    ].
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   997
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   998
    (self primAddSelector:newSelector withMethod:newMethod) ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   999
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1000
	"/ pass the selector AND the old method as changeArg
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1001
	"/ - this allows for watchers to find out if its a new method or a method-change
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1002
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1003
	self changed:#methodDictionary with:(Array with:newSelector with:oldMethod).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1004
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1005
	"/ also notify a change of Smalltalk;
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1006
	"/ this allows a dependent of Smalltalk to watch all class
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1007
	"/ changes (no need for observing all classes)
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1008
	"/ - this allows for watchers to find out if its a new method or a method-change
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1009
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1010
	Smalltalk changed:#methodInClass with:(Array with:self with:newSelector with:oldMethod).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1011
	^ true
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1012
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1013
    ^ false
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1014
2095
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
  1015
    "Modified: 8.1.1997 / 23:02:10 / cg"
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1016
!
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1017
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1018
addSelector:newSelector withMethod:newMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1019
    "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
  1020
     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
  1021
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1022
    |nargs oldMethod|
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1023
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1024
    oldMethod := self compiledMethodAt:newSelector.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1025
    (self primAddSelector:newSelector withMethod:newMethod) ifFalse:[^ false].
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1026
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1027
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1028
     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
  1029
     data for myself ... (actually, in any case all that needs
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1030
     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
  1031
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1032
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1033
    problem: this is slower; since looking for all subclasses is (currently)
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1034
	     a bit slow :-(
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1035
	     We need the hasSubclasses-info bit in Behavior; now
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1036
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1037
    self withAllSubclassesDo:[:aClass |
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1038
	ObjectMemory flushInlineCachesFor:aClass withArgs:nargs.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1039
	ObjectMemory flushMethodCacheFor:aClass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1040
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1041
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1042
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1043
    nargs := newSelector numArgs.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1044
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1045
    ObjectMemory flushMethodCacheForSelector:newSelector.
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1046
"/    ObjectMemory flushMethodCache.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1047
    ObjectMemory flushInlineCachesWithArgs:nargs.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1048
3805
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1049
    oldMethod notNil ifTrue:[
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1050
	newMethod privacy:(oldMethod privacy).
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1051
	newMethod restricted:(oldMethod isRestricted).
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1052
    ].
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1053
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1054
    "/
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1055
    "/ pass the selector AND the old method as changeArg
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1056
    "/ - 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
  1057
    "/
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1058
    self changed:#methodDictionary with:(Array with:newSelector with:oldMethod).
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1059
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1060
    "/
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1061
    "/ 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
  1062
    "/ 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
  1063
    "/ 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
  1064
    "/ - 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
  1065
    "/
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1066
    Smalltalk changed:#methodInClass with:(Array with:self with:newSelector with:oldMethod).
d525b3acc091 flush cache first in addMethod - then do a change notification
Claus Gittinger <cg@exept.de>
parents: 3641
diff changeset
  1067
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1068
    ^ true
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1069
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1070
    "Created: 11.12.1995 / 13:59:37 / cg"
2095
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
  1071
    "Modified: 8.1.1997 / 22:43:13 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1072
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1073
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1074
addSuperclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1075
    "EXPERIMENTAL MI support: add aClass to the set of classes, from which instances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1076
     inherit protocol."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1077
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1078
    "first, check if the class is abstract - 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1079
     allows abstract mixins are allowed in the current implementation"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1080
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1081
    aClass instSize == 0 ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1082
	self error:'only abstract mixins allowed'.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1083
	^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1084
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1085
    otherSuperclasses isNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1086
	otherSuperclasses := Array with:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1087
    ] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1088
	otherSuperclasses := otherSuperclasses copyWith:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1089
    ].
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1090
    SubclassInfo := nil.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1091
    ObjectMemory flushCaches
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1092
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1093
4598
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1094
classPool
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1095
    "return something which allows access to my classVariables via
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1096
     #at: and #at:put: messages."
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1097
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1098
    ^ SimulatedClassPool new setClass:self
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1099
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1100
    "
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1101
     Button classPool
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1102
    "
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1103
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1104
    "Modified: 17.10.1997 / 12:12:14 / cg"
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1105
!
7bfc7f7c4c07 classPool simulation
Claus Gittinger <cg@exept.de>
parents: 4579
diff changeset
  1106
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1107
displayString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1108
    "although behaviors have no name, we return something
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1109
     useful here - there are many places (inspectors) where
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1110
     a classes name is asked for.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1111
     Implementing this message here allows instances of anonymous classes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1112
     to show a reasonable name."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1113
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1114
    ^ 'someBehavior'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1115
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1116
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1117
flags
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1118
    "return the receivers flag bits"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1119
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1120
    ^ flags
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1121
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1122
3327
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
  1123
getMethodDictionary
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
  1124
    "ST 80 compatibility: return the receivers method dictionary."
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
  1125
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1126
    ^ self methodDictionary
3327
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
  1127
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
  1128
    "Modified: / 6.3.1998 / 15:45:50 / stefan"
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
  1129
!
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
  1130
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1131
instSize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1132
    "return the number of instance variables of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1133
     This includes all superclass instance variables."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1134
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1135
    ^ instSize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1136
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1137
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1138
methodDictionary
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1139
    "return the receivers method dictionary."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1140
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1141
    ^ methodDictionary
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1142
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1143
    "Modified: 12.6.1996 / 13:47:08 / stefan"
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  1144
    "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
  1145
!
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1146
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1147
methodDictionary:dict
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1148
    "set the receivers method dictionary and flush inline caches." 
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1149
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1150
    dict isNil ifTrue:[
5484
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  1151
        self error:'attempt to set methodDictionary to nil.' mayProceed:true.
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  1152
        ^ self
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1153
    ].
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1154
    self setMethodDictionary:dict.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1155
    ObjectMemory flushCaches.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1156
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1157
    "Created: 5.6.1996 / 11:29:36 / stefan"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1158
    "Modified: 7.6.1996 / 08:39:51 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1159
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1160
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1161
removeSelector:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1162
    "remove the selector, aSelector and its associated method 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1163
     from the methodDictionary"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1164
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1165
    |dict newDict|
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1166
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1167
    dict := self methodDictionary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1168
    newDict := dict removeKeyAndCompress:aSelector.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1169
    newDict isNil ifTrue:[ 
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1170
	^ false.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1171
    ].
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1172
    self setMethodDictionary:newDict.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1173
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1174
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1175
    [
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1176
	|nargs|
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1177
	nargs := aSelector numArgs.
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1178
	ObjectMemory flushMethodCache.
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  1179
	ObjectMemory flushInlineCachesWithArgs:nargs.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1180
    ] value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1181
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1182
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1183
     actually, we would do better with less flushing ...
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1184
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1185
    ObjectMemory flushCaches.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1186
    ^ true
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1187
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1188
    "Modified: 12.6.1996 / 11:54:29 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1189
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1190
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1191
removeSuperclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1192
    "EXPERIMENTAL MI support: remove aClass from the set of classes, from which instances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1193
     inherit protocol."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1194
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1195
    otherSuperclasses notNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1196
	otherSuperclasses := otherSuperclasses copyWithout:aClass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1197
	otherSuperclasses isEmpty ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1198
	    otherSuperclasses := nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1199
	].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1200
	SubclassInfo := nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1201
	ObjectMemory flushCaches
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1202
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1203
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1204
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1205
selectors
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1206
    "return the receivers selector array as an orderedCollection.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1207
     Notice: this may not be compatible with ST-80.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1208
     (should we return a Set ?)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1209
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1210
    |md|
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1211
1967
e8a6fb1e14ce oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  1212
    (md := self methodDictionary) isNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1213
	'oops - nil methodDictionary' errorPrintCR.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1214
	^ #()
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1215
    ].
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  1216
    ^ md keys
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1217
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  1218
    "Modified: 7.6.1996 / 15:33:18 / stefan"
1967
e8a6fb1e14ce oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  1219
    "Modified: 12.11.1996 / 11:31:51 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1220
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1221
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1222
superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1223
    "return the receivers superclass"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1224
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1225
    ^ superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1226
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1227
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1228
superclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1229
    "set the superclass - this actually creates a new class,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1230
     recompiling all methods for the new one. The receiving class stays
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1231
     around anonymous to allow existing instances some life.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1232
     This may change in the future (adjusting existing instances)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1233
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1234
    |owner ns name|
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1235
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1236
    SubclassInfo := nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1237
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1238
    "must flush caches since lookup chain changes"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1239
    ObjectMemory flushCaches.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1240
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1241
    "/ for correct recompilation, just create a new class ...
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1242
    "/ but care to avoid a nameSpace change, by giving my
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1243
    "/ full name and answering with Smalltalk to a nameSpace query.
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1244
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1245
    (owner := self owningClass) notNil ifTrue:[
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1246
	ns := owner.
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1247
	name := self nameWithoutPrefix asSymbol
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1248
    ] ifFalse:[
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1249
	ns := Smalltalk.
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1250
	name := self name
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1251
    ].
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1252
3628
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1253
    Class classRedefinitionSignal answer:#keep do:[
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1254
	Class nameSpaceQuerySignal answer:ns
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1255
	do:[
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1256
	    aClass 
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1257
		perform:(self definitionSelector) 
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1258
		withArguments:(Array with:name 
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1259
			       with:(self instanceVariableString) 
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1260
			       with:(self classVariableString)
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1261
			       with:'' "/ pool 
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1262
			       with:(self category)).
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1263
	]
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1264
    ]
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  1265
3628
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1266
    "Modified: / 20.6.1998 / 18:17:37 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1267
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1268
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1269
!Behavior methodsFor:'autoload check'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1270
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1271
autoload
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1272
    "force autoloading - do nothing here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1273
     redefined in Autoload; see comment there"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1274
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1275
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1276
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1277
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1278
isLoaded
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1279
    "return true, if the class has been loaded; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1280
     redefined in Autoload; see comment there"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1281
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1282
    ^ true
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1283
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1284
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1285
wasAutoloaded
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1286
    "return true, if this class came into the system via an
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1287
     autoload; false otherwise.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1288
     Returning false here. This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1289
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1290
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1291
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1292
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1293
    "Created: 16.4.1996 / 16:27:16 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1294
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1295
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1296
!Behavior methodsFor:'binary storage'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1297
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1298
binaryDefinitionFrom:stream manager:manager
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1299
    "sent during a binary read by the input manager.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1300
     Read the definition on an empty instance (of my class) from stream.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1301
     All pointer instances are left nil, while all bits are read in here.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1302
     return the new object."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1303
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1304
    |obj t
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1305
     basicSize "{ Class: SmallInteger }" |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1306
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1307
    self isPointers ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1308
	"/
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1309
	"/ inst size not needed - if you uncomment the line below,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1310
	"/ also uncomment the corresponding line in
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1311
	"/ Object>>storeBinaryDefinitionOn:manager:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1312
	"/
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1313
	"/ stream next. "skip instSize"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1314
	self isVariable ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1315
	    ^ self basicNew:(stream nextNumber:3)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1316
	].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1317
	^ self basicNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1318
    ].
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1319
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1320
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1321
     an object with bit-valued instance variables.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1322
     These are read here.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1323
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1324
    basicSize := stream nextNumber:4.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1325
    obj := self basicNew:basicSize.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1326
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1327
    self isBytes ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1328
	stream nextBytes:basicSize into:obj
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1329
    ] ifFalse: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1330
	self isWords ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1331
	    1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1332
		obj basicAt:i put:(stream nextNumber:2)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1333
	    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1334
	] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1335
	    self isLongs ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1336
		1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1337
		    obj basicAt:i put:(stream nextNumber:4)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1338
		]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1339
	    ] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1340
		self isFloats ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1341
		    "could do it in one big read on machines which use IEEE floats ..."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1342
		    t := Float basicNew.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1343
		    1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1344
			Float readBinaryIEEESingleFrom:stream into:t.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1345
			obj basicAt:i put: t
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1346
		    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1347
		] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1348
		    self isDoubles ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1349
			"could do it in one big read on machines which use IEEE doubles ..."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1350
			t := Float basicNew.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1351
			1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1352
			    Float readBinaryIEEEDoubleFrom:stream into:t.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1353
			    obj basicAt:i put: t
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1354
			]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1355
		    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1356
		]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1357
	    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1358
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1359
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1360
    ^obj
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1361
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1362
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1363
canCloneFrom:anObject 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1364
    "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
  1365
     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
  1366
     be converted, should redefine this method to return false.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1367
     (However, conversion is never done silently in a binary load; you
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1368
      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
  1369
      request signal.)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1370
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1371
    ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1372
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1373
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1374
cloneFrom:aPrototype
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1375
    "return an instance of myself with variables initialized from
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1376
     a prototype. This is used when instances of obsolete classes are
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1377
     binary loaded and a conversion is done on the obsolete object. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1378
     UserClasses may redefine this for better conversions."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1379
4738
fe2a0f7d585e Remove unused method vars.
Stefan Vogel <sv@exept.de>
parents: 4728
diff changeset
  1380
    |newInst indexed|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1381
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1382
    indexed := false.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1383
    aPrototype class isVariable ifTrue:[
5321
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1384
	self isVariable ifTrue:[
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1385
	    indexed := true.
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1386
	].
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1387
	"otherwise, these are lost ..."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1388
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1389
    indexed ifTrue:[
5321
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1390
	newInst := self basicNew:aPrototype basicSize
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1391
    ] ifFalse:[
5321
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1392
	newInst := self basicNew
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1393
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1394
4692
055edf6e95af Redefine #cloneFrom: using #cloneInstanceVariablesFrom:.
Stefan Vogel <sv@exept.de>
parents: 4682
diff changeset
  1395
    newInst cloneInstanceVariablesFrom:aPrototype.
055edf6e95af Redefine #cloneFrom: using #cloneInstanceVariablesFrom:.
Stefan Vogel <sv@exept.de>
parents: 4682
diff changeset
  1396
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1397
    ^ newInst
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1398
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1399
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1400
     Class withoutUpdatingChangesDo:[
5321
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1401
	 Point subclass:#Point3D
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1402
	   instanceVariableNames:'z'
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1403
	   classVariableNames:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1404
	   poolDictionaries:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1405
	   category:'testing'.
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1406
	 (Point3D cloneFrom:1@2) inspect.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1407
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1408
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1409
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1410
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1411
     Class withoutUpdatingChangesDo:[
5321
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1412
	 Point variableSubclass:#Point3D
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1413
	   instanceVariableNames:'z'
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1414
	   classVariableNames:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1415
	   poolDictionaries:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1416
	   category:'testing'.
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1417
	 (Point3D cloneFrom:#(1 2 3)) inspect.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1418
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1419
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1420
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1421
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1422
     |someObject|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1423
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1424
     Class withoutUpdatingChangesDo:[
5321
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1425
	 Object subclass:#TestClass1 
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1426
	   instanceVariableNames:'foo bar'
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1427
	   classVariableNames:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1428
	   poolDictionaries:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1429
	   category:'testing'.
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1430
	 someObject := TestClass1 new.
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1431
	 someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1432
	 Object subclass:#TestClass2 
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1433
	   instanceVariableNames:'bar foo'
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1434
	   classVariableNames:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1435
	   poolDictionaries:''
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1436
	   category:'testing'.
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  1437
	 (TestClass2 cloneFrom:someObject) inspect.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1438
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1439
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1440
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1441
6889
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1442
fromBinaryStoreBytes:bytes
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1443
    ^ self readBinaryFrom:(bytes readStream)
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1444
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1445
    "
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1446
     Object fromBinaryStoreBytes:
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1447
        #[15 1 42 0 0 3 0 40 13 5 104 101 108 108 111 38 40 46 63 243 190 118 200 180 57 88]
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1448
    "
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1449
!
7efa6d375ef7 +fromBinaryStoreBytes; +fromString.
Claus Gittinger <cg@exept.de>
parents: 6865
diff changeset
  1450
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1451
readBinaryFrom:aStream
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1452
    "read an objects binary representation from the argument,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1453
     aStream and return it. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1454
     The read object must be a kind of myself, otherwise an error is raised. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1455
     To get any object, use 'Object readBinaryFrom:...',
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1456
     To get any number, use 'Number readBinaryFrom:...' and so on.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1457
     This is the reverse operation to 'storeBinaryOn:'. "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1458
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1459
    ^ self readBinaryFrom:aStream onError:[self error:('expected ' , self name)]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1460
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1461
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1462
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1463
     s := WriteStream on:(ByteArray new).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1464
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1465
     Object readBinaryFrom:(ReadStream on:s contents)  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1466
    "
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
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1469
     s := 'testFile' asFilename writeStream binary.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1470
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1471
     'hello world' storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1472
     s close.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1473
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1474
     s := 'testFile' asFilename readStream binary.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1475
     Transcript showCR:(Object readBinaryFrom:s).
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1476
     Transcript showCR:(Object readBinaryFrom:s).
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1477
     s close.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1478
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1479
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1480
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1481
readBinaryFrom:aStream onError:exceptionBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1482
    "read an objects binary representation from the argument,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1483
     aStream and return it. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1484
     The read object must be a kind of myself, otherwise the value of
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1485
     the exceptionBlock is returned.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1486
     To get any object, use 'Object readBinaryFrom:...',
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1487
     To get any number, use 'Number readBinaryFrom:...' and so on.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1488
     This is the reverse operation to 'storeBinaryOn:'. "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1489
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1490
    |newObject|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1491
3069
9a25834a3ef7 tuned binaryStorage
Claus Gittinger <cg@exept.de>
parents: 3053
diff changeset
  1492
    newObject := (BinaryInputManager new) readFrom:aStream.
1834
b46ca5e3f1ec allow readBinaryFrom ... to return a nonObject, if sent to
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1493
    (self ~~ Object
b46ca5e3f1ec allow readBinaryFrom ... to return a nonObject, if sent to
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1494
     and:[(newObject isKindOf:self) not]) ifTrue:[^ exceptionBlock value].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1495
    ^ newObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1496
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1497
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1498
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1499
     s := WriteStream on:(ByteArray new).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1500
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1501
     Object readBinaryFrom:(ReadStream on:s contents) onError:['oops'] 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1502
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1503
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1504
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1505
     s := WriteStream on:(ByteArray new).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1506
     #[1 2 3 4] storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1507
     Array readBinaryFrom:(ReadStream on:s contents)  onError:['oops']  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1508
    "
1834
b46ca5e3f1ec allow readBinaryFrom ... to return a nonObject, if sent to
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1509
3069
9a25834a3ef7 tuned binaryStorage
Claus Gittinger <cg@exept.de>
parents: 3053
diff changeset
  1510
    "Modified: / 1.11.1997 / 16:53:36 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1511
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1512
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1513
storeBinaryDefinitionOn: stream manager: manager
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1514
    "binary store of a classes definition.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1515
     Classes will store the name only and restore by looking for
1259
8c62958114ad commentary
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
  1516
     that name in the Smalltalk dictionary.
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1517
     This is an internal interface for the binary storage mechanism."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1518
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1519
    | myName |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1520
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1521
    myName := self name.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1522
    stream nextNumber:4 put:self signature.
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1523
    stream nextNumber:2 put:0.              "/ no instVarNames string here
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1524
    stream nextNumber:2 put:myName size.
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1525
    stream nextPutBytes:(myName size) from:myName startingAt:1.
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1526
"/    myName do:[:c| 
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1527
"/        stream nextPut:c asciiValue
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1528
"/    ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1529
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1530
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1531
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1532
     s := WriteStream on:ByteArray new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1533
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1534
     Object readBinaryFrom:(ReadStream on:s contents)  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1535
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1536
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1537
     s := WriteStream on:ByteArray new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1538
     Rectangle storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1539
     Object readBinaryFrom:(ReadStream on:s contents)  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1540
    "
1259
8c62958114ad commentary
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
  1541
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1542
    "Modified: 19.3.1997 / 19:49:59 / cg"
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1545
!Behavior methodsFor:'copying'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1546
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1547
deepCopyUsing:aDictionary
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1548
    "return a deep copy of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1549
     - return the receiver here - time will show if this is ok"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1550
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1551
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1552
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1553
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1554
simpleDeepCopy
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1555
    "return a deep copy of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1556
     - return the receiver here - time will show if this is ok"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1557
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1558
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1559
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1560
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1561
!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
  1562
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1563
addChangeRecordForClassRemove:aClassName
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1564
     "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
  1565
      Defined as dummy here, since Behavior does not know about change management.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1566
      (only Classes do). 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
  1567
      (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
  1568
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1569
    "Created: 16.4.1996 / 16:30:09 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1570
    "Modified: 16.4.1996 / 18:10:35 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1571
! !
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1572
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1573
!Behavior methodsFor:'dummy fileOut'!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1574
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1575
fileOutDefinitionOn:aStream
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1576
    "dummy fileOut defined here.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1577
     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
  1578
     (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
  1579
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1580
    ^ self
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1581
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1582
    "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
  1583
! !
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1584
6596
76f5c57a8734 Encoding
Stefan Vogel <sv@exept.de>
parents: 6590
diff changeset
  1585
!Behavior methodsFor:'encoding'!
76f5c57a8734 Encoding
Stefan Vogel <sv@exept.de>
parents: 6590
diff changeset
  1586
76f5c57a8734 Encoding
Stefan Vogel <sv@exept.de>
parents: 6590
diff changeset
  1587
encodeOn:anEncoder with:aParameter
76f5c57a8734 Encoding
Stefan Vogel <sv@exept.de>
parents: 6590
diff changeset
  1588
76f5c57a8734 Encoding
Stefan Vogel <sv@exept.de>
parents: 6590
diff changeset
  1589
    anEncoder encodeBehavior:self with:aParameter
76f5c57a8734 Encoding
Stefan Vogel <sv@exept.de>
parents: 6590
diff changeset
  1590
! !
76f5c57a8734 Encoding
Stefan Vogel <sv@exept.de>
parents: 6590
diff changeset
  1591
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1592
!Behavior methodsFor:'enumerating'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1593
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1594
allDerivedInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1595
    "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
  1596
     This method is going to be removed for protocol compatibility with
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1597
     other STs; use allSubInstancesDo:"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1598
5862
c0ca96f505d7 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5842
diff changeset
  1599
    <resource:#obsolete>
c0ca96f505d7 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5842
diff changeset
  1600
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1601
    self obsoleteMethodWarning:'use #allSubInstancesDo:'.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1602
    self allSubInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1603
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1604
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1605
     StandardSystemView allDerivedInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1606
    "
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1607
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1608
    "Modified: 31.7.1997 / 23:05:04 / cg"
620
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
allInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1612
    "evaluate aBlock for all of my instances"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1613
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1614
    ObjectMemory allInstancesOf:self do:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1615
	aBlock value:anObject
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1618
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1619
     StandardSystemView allInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1620
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1621
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1622
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  1623
allSelectorsAndMethodsDo:aTwoArgBlock
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  1624
    "evaluate the argument, aBlock for all selectors of mySelf and my metaclass,
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  1625
     passing the corresponding method as second argument"
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  1626
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1627
    self obsoleteMethodWarning:'use #instAndClassSelectorsAndMethodsDo:'.
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1628
6022
112a2f86608d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6015
diff changeset
  1629
    self selectorsAndMethodsDo:aTwoArgBlock.
112a2f86608d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6015
diff changeset
  1630
    self class selectorsAndMethodsDo:aTwoArgBlock.
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  1631
!
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  1632
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1633
allSubInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1634
    "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
  1635
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1636
    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1637
	(anObject isKindOf:self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1638
	    aBlock value:anObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1639
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1640
    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1641
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1642
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1643
     StandardSystemView allSubInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1644
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1645
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1646
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1647
allSubclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1648
    "evaluate aBlock for all of my subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1649
     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
  1650
     Warning:
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1651
        This will only enumerate globally known classes - for anonymous
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1652
        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
  1653
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1654
    self allSubclassesInOrderDo:aBlock
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1655
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1656
"/    self isMeta ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1657
"/        "/ metaclasses are not found via Smalltalk allClassesDo:
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1658
"/        "/ here, walk over classes and enumerate corresponding metas.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1659
"/        self soleInstance allSubclassesDo:[:aSubClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1660
"/            aBlock value:(aSubClass class)
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1661
"/        ].
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1662
"/    ] ifFalse:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1663
"/        Smalltalk allClassesDo:[:aClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1664
"/            (aClass isSubclassOf:self) ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1665
"/                aBlock value:aClass
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1666
"/            ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1667
"/        ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1668
"/    ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1669
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1670
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1671
     Collection allSubclassesDo:[:c | Transcript showCR:(c name)]
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1672
     Collection class allSubclassesDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1673
    "
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1674
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1675
    "Modified: / 25.10.1997 / 21:17:13 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1676
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1677
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1678
allSubclassesInOrderDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1679
    "evaluate aBlock for all of my subclasses.
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1680
     There is no specific order, in which the entries are enumerated.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1681
     Warning:
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1682
        This will only enumerate globally known classes - for anonymous
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1683
        behaviors, you have to walk over all instances of Behavior."
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1684
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1685
    |meta toDo cls|
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1686
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1687
    meta := self isMeta.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1688
        
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1689
    toDo := OrderedCollection new.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1690
    toDo addAll:self theNonMetaclass subclasses.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1691
    [toDo notEmpty] whileTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1692
        cls := toDo removeFirst.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1693
        toDo addAll:(cls subclasses).
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1694
        meta ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1695
            aBlock value:cls class.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1696
        ] ifFalse:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1697
            aBlock value:cls.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1698
        ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1699
    ].
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1700
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1701
"/    self isMeta ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1702
"/        "/ metaclasses are not found via Smalltalk allClassesDo:
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1703
"/        "/ here, walk over classes and enumerate corresponding metas.
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1704
"/        self soleInstance allSubclassesDo:[:aSubClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1705
"/            aBlock value:(aSubClass class)
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1706
"/        ].
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1707
"/    ] ifFalse:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1708
"/        Smalltalk allClassesDo:[:aClass |
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1709
"/            (aClass isSubclassOf:self) ifTrue:[
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1710
"/                aBlock value:aClass
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1711
"/            ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1712
"/        ]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1713
"/    ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1714
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1715
    "
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1716
     Collection allSubclassesDo:[:c | Transcript showCR:(c name)]
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1717
     Collection class allSubclassesDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1718
    "
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1719
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  1720
    "Modified: / 25.10.1997 / 21:17:13 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1721
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1722
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1723
allSuperclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1724
    "evaluate aBlock for all of my superclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1725
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1726
    |theClass|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1727
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1728
    theClass := self superclass.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1729
    [theClass notNil] whileTrue:[
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1730
        aBlock value:theClass.
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1731
        theClass := theClass superclass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1732
    ]
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
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1735
     String allSuperclassesDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1736
    "
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
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1739
instAndClassMethodsDo:aOneArgBlock
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1740
    "evaluate the argument, aBlock for all methods of mySelf and my metaclass
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1741
     (i.e. for both instance- and class methods)"
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1742
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1743
    self theNonMetaclass methodsDo:aOneArgBlock.
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1744
    self theMetaclass    methodsDo:aOneArgBlock.
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1745
!
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1746
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1747
instAndClassSelectorsAndMethodsDo:aTwoArgBlock
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1748
    "evaluate the argument, aBlock for all selectors of mySelf and my metaclass,
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1749
     passing the corresponding method as second argument"
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1750
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1751
    self selectorsAndMethodsDo:aTwoArgBlock.
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1752
    self class selectorsAndMethodsDo:aTwoArgBlock.
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1753
!
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1754
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1755
methodsDo:aOneArgBlock
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1756
    "evaluate the argument, aBlock for all my methods"
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1757
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1758
    self methodDictionary do:aOneArgBlock
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1759
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1760
    "
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1761
     UndefinedObject methodsDo:[:m | Transcript showCR:m whoString]
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1762
     UndefinedObject selectorsDo:[:sym | Transcript showCR:sym]
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1763
    "
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1764
!
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1765
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1766
selectorsAndMethodsDo:aTwoArgBlock
5368
192acdc335e6 added #allSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 5327
diff changeset
  1767
    "evaluate the argument, aBlock for all my selectors,
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1768
     passing the corresponding method as second argument"
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1769
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1770
    self methodDictionary keysAndValuesDo:aTwoArgBlock
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1771
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1772
    "Created: / 27.10.1997 / 14:09:27 / cg"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1773
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1774
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1775
selectorsDo:aOneArgBlock
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1776
    "evaluate the argument, aBlock for all my selectors"
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1777
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  1778
    self methodDictionary keysDo:aOneArgBlock
6076
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1779
!
2f75076b5597 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6030
diff changeset
  1780
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1781
subclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1782
    "evaluate the argument, aBlock for all immediate subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1783
     This will only enumerate globally known classes - for anonymous
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1784
     behaviors, you have to walk over all instances of Behavior."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1785
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1786
    |coll|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1787
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1788
    self isMeta ifTrue:[
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1789
        "/ metaclasses are not found via Smalltalk allClassesDo:
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1790
        "/ here, walk over classes and enumerate corresponding metas.
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1791
        self soleInstance subclassesDo:[:aSubClass |
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1792
            aBlock value:(aSubClass class)
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1793
        ].
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1794
        ^ self
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1795
    ].
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1796
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1797
    "/ use cached information (avoid class hierarchy search)
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1798
    "/ if possible
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1799
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1800
    SubclassInfo isNil ifTrue:[
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1801
        Behavior subclassInfo
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1802
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1803
    SubclassInfo notNil ifTrue:[
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1804
        coll := SubclassInfo at:self ifAbsent:nil.
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1805
        coll notNil ifTrue:[
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1806
            coll do:aBlock.
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1807
        ].
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1808
        ^ self
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1809
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1810
5581
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1811
    Smalltalk allClassesDo:[:aClass |
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1812
        (aClass superclass == self) ifTrue:[
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1813
            aBlock value:aClass
7bef1c75fb06 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 5561
diff changeset
  1814
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1815
    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1816
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1817
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1818
     Collection subclassesDo:[:c | Transcript showCR:(c name)]
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1819
    "
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1820
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1821
    "Modified: 22.1.1997 / 18:44:01 / cg"
5638
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1822
!
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1823
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1824
whichClassSatisfies: aBlock 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1825
    |superclass|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1826
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1827
    (aBlock value: self) ifTrue: [^self].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1828
    superclass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1829
    ^ superclass isNil 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1830
                ifTrue: [nil]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1831
                ifFalse: [superclass whichClassSatisfies: aBlock]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1832
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  1833
5638
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1834
withAllSubclassesDo:aBlock
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1835
    "evaluate aBlock for mySelf and all of my subclasses.
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1836
     There is no specific order, in which the entries are enumerated.
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1837
     Warning:
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1838
        This will only enumerate globally known classes - for anonymous
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1839
        behaviors, you have to walk over all instances of Behavior."
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1840
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1841
    aBlock value:self.
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1842
    self allSubclassesDo:aBlock
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1843
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1844
    "
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1845
     Collection withAllSubclassesDo:[:c | Transcript showCR:(c name)]
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1846
     Collection class withAllSubclassesDo:[:c | Transcript showCR:(c name)]
02e3fcf34e3a added #withAllSubclassesDo:
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1847
    "
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1848
! !
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1849
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1850
!Behavior methodsFor:'initialization'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1851
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1852
deinitialize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1853
    "deinitialize is sent to a class before it is physically unloaded.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1854
     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
  1855
     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
  1856
     not visible to smalltalk (for example, release internal memory).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1857
     The default action here is to do nothing."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1858
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1859
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1860
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1861
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1862
initialize
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1863
    "initialize is sent to a class either during startup,
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1864
     (for all statically compiled-in classes) or after a class
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1865
     has been loaded into the system (either bytecodes or machinecode).
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1866
     The default action here is to do nothing."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1867
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1868
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1869
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1870
3442
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1871
initializeWithAllPrivateClasses
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1872
    "if implemented, send #initialize to myself and any private
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1873
     class which does so.
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1874
     This is sent to a class after it
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1875
     has been loaded into the system.
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1876
     Statically compiled classes are initialized by the VM"
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1877
6412
4d6aaac56707 implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 6395
diff changeset
  1878
    (self class includesSelector:#initialize) ifTrue:[
4d6aaac56707 implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 6395
diff changeset
  1879
        self initialize.
3442
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1880
    ].
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1881
    self privateClassesSorted do:[:aPrivateClass |
6412
4d6aaac56707 implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 6395
diff changeset
  1882
        aPrivateClass initializeWithAllPrivateClasses.
3442
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1883
    ].
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1884
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1885
    "Created: / 13.5.1998 / 23:33:16 / cg"
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1886
    "Modified: / 13.5.1998 / 23:34:06 / cg"
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1887
!
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1888
328
claus
parents: 325
diff changeset
  1889
postAutoload
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1890
    "postAutoload is sent to a class after it has been autoloaded.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1891
     This gives it a chance to arrange for automatic unloading to be done
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1892
     after a while ...
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1893
     This is NOT sent to statically compiled in or explicitely filedIn
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1894
     classes.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1895
     The default action here is to do nothing."
328
claus
parents: 325
diff changeset
  1896
claus
parents: 325
diff changeset
  1897
    ^ self
claus
parents: 325
diff changeset
  1898
!
claus
parents: 325
diff changeset
  1899
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1900
reinitialize
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1901
    "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
  1902
     I.e. when the system is restarted.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1903
     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
  1904
     obsolete data which may be a leftover from the previous live.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1905
     The default action here is to do nothing."
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1906
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1907
    ^ self
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  1908
! !
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  1909
492
fa23b14f444b renamed instance creation category
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
  1910
!Behavior methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1911
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1912
basicNew
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1913
    "return an instance of myself without indexed variables.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1914
     If the receiver-class has indexed instvars, the new object will have
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1915
     a basicSize of zero - 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1916
     i.e. 'aClass basicNew' is equivalent to 'aClass basicNew:0'.
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1917
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1918
     ** Do not redefine this method in any class **"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1919
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1920
%{  /* NOCONTEXT */
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1921
    REGISTER OBJ newobj;
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1922
    REGISTER char *nextPtr;
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1923
    unsigned int instsize;
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1924
    REGISTER unsigned int nInstVars;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1925
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1926
    /*
369
claus
parents: 362
diff changeset
  1927
     * the following ugly code is nothing more than a __new() followed
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1928
     * by a nilling of the new instance.
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1929
     * Unrolled for a bit more speed since this is one of the central object 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1930
     * allocation methods in the system
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1931
     */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1932
    nInstVars = __intVal(__INST(instSize));
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1933
    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1934
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1935
    newobj = (OBJ) __newNextPtr;
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1936
    nextPtr = ((char *)newobj) + instsize;
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1937
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1938
    /*
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1939
     * dont argue about the goto and the arrangement below - it saves 
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1940
     * an extra nil-compare and branch in the common case ...
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1941
     * (i.e. if no GC is needed, we fall through without a branch)
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1942
     */
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1943
    if (nextPtr < __newEndPtr) {
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1944
	_objPtr(newobj)->o_size = instsize;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1945
	/* o_allFlags(newobj) = 0;              */
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1946
	/* _objPtr(newobj)->o_space = __newSpace; */
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1947
	o_setAllFlags(newobj, __newSpace);
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1948
#ifdef __HAS_ALIGN4__
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1949
	/*
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1950
	 * if the alignment is 4, we are already sat,
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1951
	 * since a non-indexed object always has a word-aligned size.
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1952
	 */
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1953
	__newNextPtr = nextPtr;
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1954
#else
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1955
	if (instsize & (__ALIGN__-1)) {
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1956
	    __newNextPtr = (char *)newobj + (instsize & ~(__ALIGN__-1)) + __ALIGN__;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1957
	} else {
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1958
	    __newNextPtr = nextPtr;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1959
	}
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1960
#endif
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1961
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1962
ok:
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1963
	__InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  1964
	__qSTORE(newobj, self);
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1965
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1966
	if (nInstVars) {
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1967
#if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1968
	    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1969
#else
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1970
	    REGISTER OBJ *op;
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1971
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1972
	    op = __InstPtr(newobj)->i_instvars;
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1973
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1974
	    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1975
	     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1976
	     */
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1977
# if defined(FAST_OBJECT_MEMSET_DOUBLES_UNROLLED)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1978
	    if (nInstVars > 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1979
		*op++ = nil;    /* for alignment */
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1980
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1981
		while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1982
		    *(double *)op = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1983
		    ((double *)op)[1] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1984
		    ((double *)op)[2] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1985
		    ((double *)op)[3] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1986
		    op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1987
		    nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1988
		}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1989
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1990
	    while (nInstVars != 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1991
		*op++ = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1992
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1993
	    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1994
# else
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  1995
#  if defined(FAST_OBJECT_MEMSET_LONGLONG_UNROLLED)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1996
	    if (nInstVars > 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1997
		*op++ = nil;    /* for alignment */
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1998
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1999
		while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2000
		    *(long long *)op = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2001
		    ((long long *)op)[1] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2002
		    ((long long *)op)[2] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2003
		    ((long long *)op)[3] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2004
		    op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2005
		    nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2006
		}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2007
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2008
	    while (nInstVars != 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2009
		*op++ = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2010
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2011
	    }
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2012
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2013
#  else
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2014
#   if defined(FAST_OBJECT_MEMSET_WORDS_UNROLLED)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2015
	    while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2016
		*op = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2017
		*(op+1) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2018
		*(op+2) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2019
		*(op+3) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2020
		*(op+4) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2021
		*(op+5) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2022
		*(op+6) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2023
		*(op+7) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2024
		op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2025
		nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2026
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2027
	    while (nInstVars != 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2028
		*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2029
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2030
	    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2031
#   else
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2032
#    if defined(FAST_MEMSET)
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2033
	    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2034
#    else
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2035
	    do {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2036
		*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2037
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2038
	    } while (nInstVars != 0);
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2039
#    endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2040
#   endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2041
#  endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2042
# endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2043
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2044
	}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2045
	RETURN ( newobj );
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  2046
    }
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2047
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2048
    /*
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2049
     * the slow case - a GC will occur
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2050
     */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2051
    __PROTECT_CONTEXT__
3980
8f9443e37693 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3935
diff changeset
  2052
    newobj = __STX___new(instsize);
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2053
    __UNPROTECT_CONTEXT__
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2054
    if (newobj != nil) goto ok;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2055
%}
2
claus
parents: 1
diff changeset
  2056
.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2057
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2058
     memory allocation failed.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2059
     When we arrive here, there was no memory, even after
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2060
     a garbage collect. 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2061
     This means, that the VM wanted to get some more memory from the 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2062
     Operatingsystem, which was not kind enough to give it.
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2063
     Bad luck - you should increase the swap space on your machine.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2064
    "
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  2065
    ^ ObjectMemory allocationFailureSignal raise.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2066
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2067
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2068
basicNew:anInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2069
    "return an instance of myself with anInteger indexed variables.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2070
     If the receiver-class has no indexed instvars, this is only allowed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2071
     if the argument, anInteger is zero.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2072
     ** Do not redefine this method in any class **"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2073
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2074
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2075
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2076
    OBJ newobj;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2077
    unsigned INT instsize, nInstVars;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2078
    INT nindexedinstvars;
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2079
    unsigned INT flags;
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2080
#if ! defined(FAST_ARRAY_MEMSET)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2081
    REGISTER char *cp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2082
    short *sp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2083
    long *lp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2084
#endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2085
    REGISTER OBJ *op;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2086
    float *fp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2087
    double *dp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2088
249
claus
parents: 216
diff changeset
  2089
    if (__isSmallInteger(anInteger)) {
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2090
	nindexedinstvars = __intVal(anInteger);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2091
	if (nindexedinstvars >= 0) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2092
	    nInstVars = __intVal(__INST(instSize));
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2093
	    flags = __intVal(__INST(flags)) & ARRAYMASK;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2094
	    switch (flags) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2095
		case BYTEARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2096
		    instsize = OHDR_SIZE + nindexedinstvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2097
		    if (nInstVars == 0) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2098
			if (__CanDoQuickNew(instsize)) {        /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2099
			    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2100
			     * the most common case
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2101
			     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2102
			    __qCheckedNew(newobj, instsize);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2103
			    __InstPtr(newobj)->o_class = self;
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2104
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2105
			    nInstVars = nindexedinstvars >> 2;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2106
			    if (nindexedinstvars & 3) nInstVars++;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2107
			    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
357
claus
parents: 356
diff changeset
  2108
#else
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2109
# if defined(FAST_ARRAY_MEMSET)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2110
			    memset(__InstPtr(newobj)->i_instvars, 0, nindexedinstvars);
357
claus
parents: 356
diff changeset
  2111
# else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2112
			    cp = (char *)__InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2113
			    while (nindexedinstvars >= sizeof(long)) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2114
				*(long *)cp = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2115
				cp += sizeof(long);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2116
				nindexedinstvars -= sizeof(long);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2117
			    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2118
			    while (nindexedinstvars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2119
				*cp++ = '\0';
357
claus
parents: 356
diff changeset
  2120
# endif
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2121
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2122
			    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2123
			}
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2124
		    } else {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2125
			instsize += __OBJS2BYTES__(nInstVars);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2126
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2127
		    __PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2128
		    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2129
		    __UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2130
		    if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2131
			break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2132
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2133
		    __InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2134
		    __qSTORE(newobj, self);
369
claus
parents: 362
diff changeset
  2135
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2136
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2137
		    nInstVars = (instsize-OHDR_SIZE) >> 2;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2138
		    if (instsize & 3) nInstVars++;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2139
		    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
357
claus
parents: 356
diff changeset
  2140
#else
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2141
# if defined(FAST_ARRAY_MEMSET)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2142
		    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2143
		     * knowing that nil is 0
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2144
		     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2145
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
357
claus
parents: 356
diff changeset
  2146
# else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2147
		    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2148
		    while (nInstVars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2149
			*op++ = nil;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2150
		    cp = (char *)op;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2151
		    while (nindexedinstvars >= sizeof(long)) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2152
			*(long *)cp = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2153
			cp += sizeof(long);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2154
			nindexedinstvars -= sizeof(long);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2155
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2156
		    while (nindexedinstvars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2157
			*cp++ = '\0';
357
claus
parents: 356
diff changeset
  2158
# endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2159
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2160
		    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2161
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2162
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2163
		case WORDARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2164
		case SWORDARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2165
		    instsize = OHDR_SIZE + 
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2166
			       __OBJS2BYTES__(nInstVars) + 
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2167
			       nindexedinstvars * 2;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2168
		    __PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2169
		    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2170
		    __UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2171
		    if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2172
			break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2173
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2174
		    __InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2175
		    __qSTORE(newobj, self);
369
claus
parents: 362
diff changeset
  2176
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2177
#if defined(FAST_ARRAY_MEMSET)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2178
		    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2179
		     * knowing that nil is 0
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2180
		     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2181
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2182
#else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2183
		    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2184
		    while (nInstVars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2185
			*op++ = nil;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2186
		    sp = (short *)op;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2187
		    while (nindexedinstvars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2188
			*sp++ = 0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2189
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2190
		    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2191
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2192
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2193
	       case LONGARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2194
	       case SLONGARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2195
		    instsize = OHDR_SIZE + 
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2196
			       __OBJS2BYTES__(nInstVars) + 
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2197
			       nindexedinstvars * 4;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2198
		    __PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2199
		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2200
		    __UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2201
		    if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2202
			break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2203
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2204
		    __InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2205
		    __qSTORE(newobj, self);
369
claus
parents: 362
diff changeset
  2206
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2207
#if defined(memset4)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2208
		    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2209
		     * knowing that nil is 0
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2210
		     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2211
		    {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2212
			int n4 = nInstVars + nindexedinstvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2213
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2214
			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2215
		    }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2216
#else
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2217
# if defined(FAST_ARRAY_MEMSET)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2218
		    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2219
		     * knowing that nil is 0
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2220
		     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2221
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2222
# else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2223
		    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2224
		    while (nInstVars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2225
			*op++ = nil;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2226
		    lp = (long *)op;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2227
		    while (nindexedinstvars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2228
			*lp++ = 0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2229
# endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2230
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2231
		    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2232
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2233
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2234
	       case LONGLONGARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2235
	       case SLONGLONGARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2236
		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2237
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2238
#ifdef __NEED_LONGLONG_ALIGN
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2239
		    instsize = ((instsize-1) + __LONGLONG_ALIGN) & ~(__LONGLONG_ALIGN-1);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2240
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2241
		    instsize += nindexedinstvars * 8;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2242
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2243
		    __PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2244
		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2245
		    __UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2246
		    if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2247
			break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2248
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2249
		    __InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2250
		    __qSTORE(newobj, self);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2251
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2252
#if defined(memset4)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2253
		    {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2254
			int n4 = (instsize-OHDR_SIZE) / 4;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2255
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2256
			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2257
		    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2258
#else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2259
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2260
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2261
		    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2262
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2263
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2264
	       case FLOATARRAY:
5321
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  2265
		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
c21a89ffdea4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5297
diff changeset
  2266
		    instsize += nindexedinstvars * sizeof(float);
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2267
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2268
		    __PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2269
		    __qNew(newobj, instsize);   /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2270
		    __UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2271
		    if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2272
			break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2273
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2274
		    __InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2275
		    __qSTORE(newobj, self);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2276
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2277
		    op = __InstPtr(newobj)->i_instvars;
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2278
#if defined(__FLOAT0_IS_INT0) /* knowin that float 0.0 is all-zeros */
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2279
# if defined(memset4)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2280
		    {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2281
			int n4 = (instsize-OHDR_SIZE) / 4;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2282
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2283
			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2284
		    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2285
# else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2286
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2287
# endif
3870
ea7a0f0db4be use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents: 3805
diff changeset
  2288
#else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2289
		    while (nInstVars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2290
			*op++ = nil;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2291
		    fp = (float *)op;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2292
		    while (nindexedinstvars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2293
			*fp++ = 0.0;
3870
ea7a0f0db4be use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents: 3805
diff changeset
  2294
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2295
		    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2296
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2297
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2298
	       case DOUBLEARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2299
		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2300
#ifdef __NEED_DOUBLE_ALIGN
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2301
		    instsize = ((instsize-1) + __DOUBLE_ALIGN) & ~(__DOUBLE_ALIGN-1);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2302
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2303
		    instsize += nindexedinstvars * sizeof(double);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2304
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2305
		    __PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2306
		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2307
		    __UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2308
		    if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2309
			break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2310
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2311
		    __InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2312
		    __qSTORE(newobj, self);
369
claus
parents: 362
diff changeset
  2313
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2314
#if defined(__DOUBLE0_IS_INT0) /* knowin that double 0.0 is all-zeros */
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2315
# ifdef memset4
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2316
		    {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2317
			int n4 = (instsize-OHDR_SIZE) / 4;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2318
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2319
			memset4(__InstPtr(newobj)->i_instvars, 0, n4);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2320
		    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2321
# else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2322
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2323
# endif
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2324
#else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2325
		    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2326
		    while (nInstVars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2327
			*op++ = nil;
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2328
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2329
# ifdef __NEED_DOUBLE_ALIGN
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2330
		    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2331
		     * care for double alignment
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2332
		     * add filler.
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2333
		     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2334
		    if ((INT)op & (__DOUBLE_ALIGN-1)) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2335
			*op++ = nil;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2336
		    }
3870
ea7a0f0db4be use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents: 3805
diff changeset
  2337
# endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2338
		    dp = (double *)op;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2339
		    while (nindexedinstvars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2340
			*dp++ = 0.0;
3870
ea7a0f0db4be use memset to initialize float- and doubleArrays, if float0/double0 is int0
Claus Gittinger <cg@exept.de>
parents: 3805
diff changeset
  2341
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2342
		    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2343
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2344
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2345
		case WKPOINTERARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2346
		case POINTERARRAY:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2347
		    nInstVars += nindexedinstvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2348
		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2349
		    __PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2350
		    __qAlignedNew(newobj, instsize);    /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2351
		    __UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2352
		    if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2353
			break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2354
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2355
		    __InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2356
		    __qSTORE(newobj, self);
369
claus
parents: 362
diff changeset
  2357
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2358
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2359
		    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2360
#else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2361
		    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2362
		     * knowing that nil is 0
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2363
		     */
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2364
# ifdef sparc
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2365
#  define FAST_ARRAY_MEMSET_DOUBLES_UNROLLED
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2366
# endif
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2367
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2368
# if defined(FAST_ARRAY_MEMSET_DOUBLES_UNROLLED)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2369
		    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2370
		    if (nInstVars > 8) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2371
			*op++ = nil;    /* for alignment */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2372
			nInstVars--;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2373
			while (nInstVars >= 8) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2374
			    *(double *)op = 0.0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2375
			    ((double *)op)[1] = 0.0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2376
			    ((double *)op)[2] = 0.0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2377
			    ((double *)op)[3] = 0.0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2378
			    op += 8;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2379
			    nInstVars -= 8;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2380
			}
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2381
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2382
		    while (nInstVars) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2383
			*op++ = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2384
			nInstVars--;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2385
		    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2386
# else
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2387
#  if defined(FAST_ARRAY_MEMSET_LONGLONG_UNROLLED)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2388
		    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2389
		    if (nInstVars > 8) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2390
			*op++ = nil;    /* for alignment */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2391
			nInstVars--;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2392
			while (nInstVars >= 8) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2393
			    *(long long *)op = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2394
			    ((long long *)op)[1] = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2395
			    ((long long *)op)[2] = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2396
			    ((long long *)op)[3] = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2397
			    op += 8;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2398
			    nInstVars -= 8;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2399
			}
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2400
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2401
		    while (nInstVars) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2402
			*op++ = 0;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2403
			nInstVars--;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2404
		    }
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2405
#  else
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2406
#   if defined(FAST_ARRAY_MEMSET)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2407
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2408
#   else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2409
		    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2410
		    while (nInstVars--)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2411
			*op++ = nil;
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2412
#   endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2413
#  endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2414
# endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2415
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2416
		    RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2417
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2418
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2419
		default:
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2420
		    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2421
		     * new:n for non-variable classes only allowed if
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2422
		     * n == 0
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2423
		     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2424
		    if (nindexedinstvars == 0) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2425
			instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2426
			__PROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2427
			__qAlignedNew(newobj, instsize);        /* OBJECT ALLOCATION */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2428
			__UNPROTECT_CONTEXT__
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2429
			if (newobj == nil) {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2430
			    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2431
			}
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2432
			__InstPtr(newobj)->o_class = self;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2433
			__qSTORE(newobj, self);
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2434
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2435
			if (nInstVars) {
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2436
#if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2437
			    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2438
#else
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2439
# if defined(FAST_MEMSET)
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2440
			    /*
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2441
			     * knowing that nil is 0
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2442
			     */
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2443
			    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2444
# else
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2445
			    op = __InstPtr(newobj)->i_instvars;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2446
			    do {
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2447
				*op++ = nil;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2448
			    } while (--nInstVars);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2449
# endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2450
#endif
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2451
			}
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2452
			RETURN ( newobj );
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2453
		    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2454
		    break;
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2455
	    }
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2456
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2457
    }
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2458
%}.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2459
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2460
     arrive here if something went wrong ...
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2461
     figure out what it was
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2462
    "
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2463
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2464
    (anInteger isMemberOf:SmallInteger) ifFalse:[
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2465
	"
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2466
	 the argument is either not an integer,
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2467
	 or a LargeInteger (which means that its definitely too big)
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2468
	"
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2469
	self error:'argument to new: must be Integer' mayProceed:true.
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2470
	^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2471
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2472
    (anInteger < 0) ifTrue:[
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2473
	"
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2474
	 the argument is negative,
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2475
	"
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2476
	self error:'bad (negative) argument to new:'.
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2477
	^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2478
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2479
    self isVariable ifFalse:[
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2480
	"
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2481
	 this class does not have any indexed instance variables
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2482
	"
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2483
	self error:'class has no indexed instvars - cannot create with new:'.
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2484
	^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2485
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2486
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2487
     memory allocation failed.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2488
     When we arrive here, there was no memory, even after
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2489
     a garbage collect. 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2490
     This means, that the VM wanted to get some more memory from the 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2491
     Operatingsystem, which was not kind enough to give it.
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2492
     Bad luck - you should increase the swap space on your machine.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2493
    "
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  2494
    ^ ObjectMemory allocationFailureSignal raise.
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2495
!
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2496
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2497
decodeFromLiteralArray:anArray
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2498
    "create & return a new instance from information encoded in anArray."
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2499
3237
5c3d09b9239d use #new instead of #basicNew when decoding from a literal array;
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  2500
    ^ self new fromLiteralArrayEncoding:anArray.
2370
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2501
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2502
    "
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2503
     Rectangle
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2504
	decodeFromLiteralArray:#(Rectangle 10 10 100 100)
2370
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2505
    "
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2506
3237
5c3d09b9239d use #new instead of #basicNew when decoding from a literal array;
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  2507
    "Modified: / 28.1.1998 / 17:40:30 / cg"
2370
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2508
!
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2509
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2510
new
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2511
    "return an instance of myself without indexed variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2512
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2513
    ^ self basicNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2514
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2515
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2516
new:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2517
    "return an instance of myself with anInteger indexed variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2518
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2519
    ^ self basicNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2520
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2521
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2522
niceBasicNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2523
    "same as basicNew:anInteger, but tries to avoid long pauses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2524
     due to garbage collection. This method checks to see if
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2525
     allocation is possible without a pause, and does a background
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2526
     incremental garbage collect first if there is not enough memory
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2527
     available at the moment for fast allocation. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2528
     This is useful in low-priority background processes which like to 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2529
     avoid disturbing any higher priority foreground process while allocating
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2530
     big amounts of memory. Of course, using this method only makes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2531
     sense for big or huge objects (say > 200k).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2532
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2533
     EXPERIMENTAL: this is a non-standard interface and should only 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2534
     be used for special applications. There is no guarantee, that this
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2535
     method will be available in future ST/X releases."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2536
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2537
    |size|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2538
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2539
    size := self sizeOfInst:anInteger.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2540
    (ObjectMemory checkForFastNew:size) ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2541
	"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2542
	 incrementally collect garbage
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2543
	"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2544
	ObjectMemory incrementalGC.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2545
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2546
    ^ self basicNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2547
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2548
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2549
readFrom:aStream
43
00ca34676cbf *** empty log message ***
claus
parents: 25
diff changeset
  2550
    "read an objects printed representation from the argument, aStream 
00ca34676cbf *** empty log message ***
claus
parents: 25
diff changeset
  2551
     and return it. 
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2552
     The read object must be a kind of myself if its not, an error is raised.
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2553
     This is the reverse operation to 'storeOn:'.
43
00ca34676cbf *** empty log message ***
claus
parents: 25
diff changeset
  2554
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2555
     WARNING: storeOn: does not handle circular references and multiple 
3920
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2556
	      references to the same object.
0c1b9b2fa23b added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
  2557
	      Use #storeBinary:/readBinaryFrom: for this."
3480
aa538a7438ba conversion error string
Claus Gittinger <cg@exept.de>
parents: 3442
diff changeset
  2558
aa538a7438ba conversion error string
Claus Gittinger <cg@exept.de>
parents: 3442
diff changeset
  2559
    ^ self readFrom:aStream onError:[self error:'conversion error for: ' , self name]
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2560
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2561
    "
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2562
     |s|
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2563
     s := WriteStream on:String new.
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2564
     #(1 2 3 4) storeOn:s.
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2565
     Object readFrom:(ReadStream on:s contents)  
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2566
    "
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2567
!
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2568
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2569
readFrom:aStream onError:exceptionBlock
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2570
    "read an objects printed representation from the argument, aStream 
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2571
     and return it (i.e. the stream should contain some representation of
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2572
     the object which was created using #storeOn:). 
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2573
     The read object must be a kind of myself if its not, the value of
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2574
     exceptionBlock is returned.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2575
     To get any object, use 'Object readFrom:...',
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2576
     To get any number, use 'Number readFrom:...' and so on.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2577
     This is the reverse operation to 'storeOn:'.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2578
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2579
     WARNING: storeOn: does not handle circular references and multiple 
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  2580
              references to the same object.
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  2581
              Use #storeBinary:/readBinaryFrom: for this."
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2582
6627
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  2583
    ^ [
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  2584
        |newObject|
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  2585
        newObject := self evaluatorClass evaluate:aStream ifFail:exceptionBlock.
6627
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  2586
        (newObject isKindOf:self) ifTrue:[newObject] ifFalse:[exceptionBlock value].
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  2587
    ] on:Error do:exceptionBlock.
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2588
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2589
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2590
     |s|
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2591
     s := WriteStream on:String new.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2592
     #(1 2 3 4) storeOn:s.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  2593
     Transcript showCR:(
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  2594
        Array readFrom:(ReadStream on:s contents) onError:'not an Array'
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  2595
     )
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2596
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2597
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2598
     |s|
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2599
     s := WriteStream on:String new.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2600
     #[1 2 3 4] storeOn:s.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  2601
     Transcript showCR:(
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  2602
         Array readFrom:(ReadStream on:s contents) onError:'not an Array'
345
claus
parents: 343
diff changeset
  2603
     )
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2604
    "
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  2605
    "
6627
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  2606
     Object readFrom:'illegal' onError:['bla']
685ab6f994f0 Avoid block creation in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 6596
diff changeset
  2607
     String readFrom:'illegal' onError:'bla'
5842
720736f72cb4 exceptionBlock handling in #readFrom:onError:
Stefan Vogel <sv@exept.de>
parents: 5753
diff changeset
  2608
    "
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2609
!
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2610
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2611
readFromString:aString
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2612
    "create an object from its printed representation.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2613
     For most classes, the string is expected to be in a format created by
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2614
     storeOn: or storeString; however, some (Time, Date) expect a user
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2615
     readable string here.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2616
     See comments in Behavior>>readFromString:onError:,
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2617
     Behavior>>readFrom: and Behavior>>readFrom:onError:"
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2618
345
claus
parents: 343
diff changeset
  2619
    ^ self readFromString:aString onError:[self error:'expected: ' , self name]
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2620
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2621
    "
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2622
     Integer readFromString:'12345678901234567890' 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2623
     Point readFromString:'1@2'  
345
claus
parents: 343
diff changeset
  2624
     Point readFromString:'1'  
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2625
    "
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2626
!
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2627
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2628
readFromString:aString onError:exceptionBlock
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2629
    "create an object from its printed representation.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2630
     Here, the string is expected to be in a format created by
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2631
     storeOn: or storeString; however, some classes (Time, Date) may redefine
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2632
     it to expect a user readable string here.
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2633
     See comments in Behavior>>readFrom: and Behavior>>readFrom:onError:"
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2634
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2635
    ^ self readFrom:(ReadStream on:aString) onError:exceptionBlock
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2636
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2637
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2638
     Integer readFromString:'12345678901234567890' 
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2639
     Integer readFromString:'abc' 
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2640
     Integer readFromString:'abc' onError:0
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2641
     Point readFromString:'1@2'  
345
claus
parents: 343
diff changeset
  2642
     Point readFromString:'0'   
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2643
     Point readFromString:'0' onError:[0@0]  
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2644
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2645
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2646
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2647
uninitializedNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2648
    "create an instance of myself with uninitialized contents.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2649
     For all classes except ByteArray, this is the same as #basicNew."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2650
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2651
    ^ self basicNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2652
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2653
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2654
uninitializedNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2655
    "create an instance of myself with uninitialized contents.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2656
     For all classes except ByteArray, this is the same as #basicNew:."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2657
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2658
    ^ self basicNew:anInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2659
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2660
3619
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2661
!Behavior methodsFor:'misc'!
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2662
4928
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  2663
browse
5727
b97b7c5c7ab9 comments added
Claus Gittinger <cg@exept.de>
parents: 5709
diff changeset
  2664
    "open a browser showing the receiver"
b97b7c5c7ab9 comments added
Claus Gittinger <cg@exept.de>
parents: 5709
diff changeset
  2665
5517
81558c304485 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5513
diff changeset
  2666
    self browserClass openInClass:self 
4928
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  2667
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  2668
    "
5546
934ca7bfecc6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5517
diff changeset
  2669
     Array browserClass
4928
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  2670
     Array browse
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  2671
    "
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  2672
!
1c8c123fb3d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4889
diff changeset
  2673
3619
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2674
sourceCodeTemplate
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2675
    ^ 'messageSelector and arguments
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2676
    "method comment - purpose of message"
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2677
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2678
    |temporaries|
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2679
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2680
    statements
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2681
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2682
    "
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2683
     example uses
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2684
    "
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2685
'
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2686
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2687
    "Created: / 19.6.1998 / 02:14:02 / cg"
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2688
! !
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2689
6590
53ad98dc93ef *** empty log message ***
penk
parents: 6589
diff changeset
  2690
!Behavior methodsFor:'printing & storing'!
53ad98dc93ef *** empty log message ***
penk
parents: 6589
diff changeset
  2691
53ad98dc93ef *** empty log message ***
penk
parents: 6589
diff changeset
  2692
printOn:aStream
53ad98dc93ef *** empty log message ***
penk
parents: 6589
diff changeset
  2693
    aStream nextPutAll:(self name).
53ad98dc93ef *** empty log message ***
penk
parents: 6589
diff changeset
  2694
! !
6589
cf52ed7e5601 *** empty log message ***
penk
parents: 6477
diff changeset
  2695
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2696
!Behavior methodsFor:'private accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2697
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2698
flags:aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2699
    "set the flags.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2700
     this method is for special uses only - there will be no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2701
     and no change record written here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2702
     Do NOT use it."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2703
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2704
    flags := aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2705
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2706
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2707
instSize:aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2708
    "set the instance size.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2709
     this method is for special uses only - there will be no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2710
     and no change record written here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2711
     Do NOT use it."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2712
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2713
    instSize := aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2714
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2715
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2716
primAddSelector:newSelector withMethod:newMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2717
    "add the method given by 2nd argument under the selector given by
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2718
     the 1st argument to the methodDictionary. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2719
     Does NOT flush any caches, does NOT write a change record.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2720
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2721
     Do not use this in normal situations, strange behavior will be
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2722
     the consequence.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2723
     I.e. executing obsolete methods, since the old method will still 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2724
     be executed out of the caches."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2725
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2726
    |dict|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2727
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2728
    (newSelector isMemberOf:Symbol) ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2729
	self error:'invalid selector'. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2730
	^ false
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2731
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2732
    newMethod isNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2733
	self error:'invalid method'. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2734
	^ false
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2735
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2736
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2737
    dict := self methodDictionary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2738
    self setMethodDictionary:(dict at:newSelector putOrAppend:newMethod).
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2739
    ^ true.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2740
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2741
    "Modified: 7.6.1996 / 14:48:45 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2742
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2743
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2744
setMethodDictionary:dict
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2745
    "set the receivers method dictionary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2746
     Convert dict to a MethodDictionary if necessary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2747
     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
  2748
     after this call"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2749
2228
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2750
    "/ since the only thing the VM is prepared to deal with are
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2751
    "/ proper methodDictionaries (it cannot do another message send, to
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2752
    "/ find any methods ...), we convert it here if required.
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2753
    "/ No other classes instances are allowed.
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2754
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  2755
    dict class ~~ MethodDictionary ifTrue:[
5484
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2756
        methodDictionary := MethodDictionary withAll:dict.
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2757
        methodDictionary isNil ifTrue:[
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2758
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2759
            "/ refuse to do this 
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2760
            "/ (can only happen in case of memory allocation trouble,
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2761
            "/  where the allocation failed and some exception handler returned
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2762
            "/  nil ...)
2228
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2763
        
5484
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2764
            self error:'cannot set methodDictionary to nil' mayProceed:true.
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2765
            ^ self.
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2766
        ]
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  2767
    ] ifFalse:[
5484
7dbf2507f262 halt vs. error
Claus Gittinger <cg@exept.de>
parents: 5428
diff changeset
  2768
        methodDictionary := dict.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2769
    ].
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  2770
    ^ self.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2771
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2772
    "Created: 5.6.1996 / 11:29:36 / stefan"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2773
    "Modified: 12.6.1996 / 13:58:55 / stefan"
2228
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2774
    "Modified: 22.1.1997 / 21:10:48 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2775
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2776
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2777
setOtherSuperclasses:anArrayOfClasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2778
    "EXPERIMENTAL: set the other superclasses of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2779
     this method is for special uses only - there will be no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2780
     and no change record written here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2781
     Do NOT use it."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2782
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2783
    SubclassInfo := nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2784
    otherSuperclasses := anArrayOfClasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2785
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2786
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2787
setSuperclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2788
    "set the superclass of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2789
     this method is for special uses only - there will be no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2790
     and no change record written here. Also, if the receiver class has
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2791
     already been in use, future operation of the system is not guaranteed to
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2792
     be correct, since no caches are flushed.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2793
     Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2794
2438
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2795
    |info|
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2796
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2797
    SubclassInfo notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2798
	"/ flush/update the subclass information
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2799
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2800
	"/ if my class is already contained
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2801
	(info := SubclassInfo at:aClass ifAbsent:nil) notNil ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2802
	    info add:self
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2803
	] ifFalse:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2804
	    SubclassInfo := nil.  "/ flush it
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2805
	]
2438
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2806
    ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2807
    superclass := aClass
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2808
2438
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2809
    "Modified: 3.3.1997 / 13:27:00 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2810
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2811
5906
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2812
setSuperclass:aClass instSize:i 
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2813
    "set some inst vars. 
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2814
     this method is for special uses only - there will be no recompilation
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2815
     and no change record is written here. Also, if the receiver class has 
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2816
     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
  2817
     be correct, since no caches are flushed.
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2818
     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
  2819
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2820
    self setSuperclass:aClass.
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2821
    instSize := i.
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2822
!
4fdd3f36bfff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5862
diff changeset
  2823
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2824
setSuperclass:aClass methodDictionary:d instSize:i flags:f
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2825
    "set some inst vars. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2826
     this method is for special uses only - there will be no recompilation
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2827
     and no change record is written here. Also, if the receiver class has 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2828
     already been in use, future operation of the system is not guaranteed to
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2829
     be correct, since no caches are flushed.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2830
     Therefore: do NOT use it; use Behavior>>superclass: (or flush the caches, at least)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2831
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2832
    self setSuperclass:aClass.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2833
    self setMethodDictionary:d.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2834
    instSize := i.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2835
    flags := f
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2836
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2837
    "Created: 7.6.1996 / 08:41:20 / stefan"
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2838
    "Modified: 22.1.1997 / 18:42:12 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2839
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2840
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2841
!Behavior methodsFor:'private helpers'!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2842
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2843
addAllClassVarNamesTo:aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2844
    "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
  2845
     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
  2846
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2847
    |classvars superclass|
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2848
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2849
    superclass := self superclass.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2850
    (superclass notNil) ifTrue:[
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2851
        superclass addAllClassVarNamesTo:aCollection
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2852
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2853
    (classvars := self classVariableString) notNil ifTrue:[
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2854
        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
  2855
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2856
    ^ aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2857
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2858
    "Created: 16.4.1996 / 18:00:38 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2859
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2860
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2861
addAllInstVarNamesTo:aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2862
    "helper for allInstVarNames - add the name-strings of the instance variables
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2863
     and of the inst-vars of all superclasses to the argument, aCollection. 
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2864
     Return aCollection."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2865
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2866
    |superclass|
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2867
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  2868
    superclass := self superclass.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2869
    (superclass notNil) ifTrue:[
5512
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2870
        superclass addAllInstVarNamesTo:aCollection
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2871
    ].
5512
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2872
    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
  2873
    ^ aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2874
5512
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2875
    "
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2876
     SortedCollection allInstVarNames
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2877
     SortedCollection instVarNames
45dc420fd76f tuned #allInstVarNames
Claus Gittinger <cg@exept.de>
parents: 5484
diff changeset
  2878
    "
4371
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  2879
!
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  2880
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  2881
addAllPrivateClassesTo:aCollection
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  2882
    "add all of my private classes to aCollection"
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  2883
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  2884
    self privateClassesDo:[:aPrivateClass |
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2885
	aCollection add:aPrivateClass.
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  2886
	aPrivateClass addAllPrivateClassesTo:aCollection
4371
dc83645cc903 support to recursively enumerate all private classes
Claus Gittinger <cg@exept.de>
parents: 4366
diff changeset
  2887
    ].
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2888
! !
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2889
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2890
!Behavior methodsFor:'queries'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2891
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2892
category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2893
    "return the category of the class. 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2894
     Returning nil here, since Behavior does not define a category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2895
     (only ClassDescriptions do)."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2896
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2897
    ^ nil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2898
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2899
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2900
     Point category                
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2901
     Behavior new category           
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2902
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2903
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2904
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2905
comment
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2906
    "return the comment of the class. 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2907
     Returning nil here, since Behavior does not define a category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2908
     (only Classes do). This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2909
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2910
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2911
    ^ nil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2912
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2913
    "Modified: 16.4.1996 / 16:25:23 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2914
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2915
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2916
definitionSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2917
    "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
  2918
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2919
    ^ (self firstDefinitionSelectorPart
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2920
      ,
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2921
      'instanceVariableNames:classVariableNames:poolDictionaries:category:') asSymbol
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2922
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2923
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2924
     Object definitionSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2925
     Array definitionSelector  
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2926
     ByteArray definitionSelector 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2927
     FloatArray definitionSelector 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2928
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2929
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2930
    "Modified: 3.3.1997 / 11:50:37 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2931
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2932
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2933
definitionSelectorPrivate
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2934
    "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
  2935
     as a private class"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2936
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2937
    ^ (self firstDefinitionSelectorPart
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2938
      ,
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2939
      '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
  2940
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2941
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2942
     Array definitionSelector      
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2943
     Array definitionSelectorPrivate  
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2944
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2945
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2946
    "Modified: 23.6.1997 / 10:45:57 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2947
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2948
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2949
firstDefinitionSelectorPart
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2950
    "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
  2951
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2952
    self isVariable ifFalse:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2953
	^ #'subclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2954
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2955
    self isBytes ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2956
	^ #'variableByteSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2957
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2958
    self isLongs ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2959
	^ #'variableLongSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2960
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2961
    self isFloats ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2962
	^ #'variableFloatSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2963
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2964
    self isDoubles ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2965
	^ #'variableDoubleSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2966
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2967
    self isWords ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2968
	^ #'variableWordSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2969
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2970
    self isSignedWords ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2971
	^ #'variableSignedWordSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2972
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2973
    self isSignedLongs ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2974
	^ #'variableSignedLongSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2975
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2976
    self isSignedLongLongs ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2977
	^ #'variableSignedLongLongSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2978
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2979
    self isLongLongs ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2980
	^ #'variableLongLongSubclass:'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2981
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2982
    ^ #'variableSubclass:'
620
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
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2985
fullName
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2986
    "Answer the name of the receiver, fully qualified."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2987
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2988
    ^ self name asString
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2989
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2990
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2991
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2992
isBehavior
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2993
    "return true, if the receiver is describing another objects behavior,
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2994
     i.e. is a class. Defined to avoid the need to use isKindOf:"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2995
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2996
    ^ true
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2997
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2998
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  2999
     True isBehavior   
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3000
     true isBehavior
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3001
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3002
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3003
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3004
isBuiltInClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3005
    "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
  3006
     Here, false is returned as default.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3007
     Notice, this is instance protocol, which means that any class
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3008
     other than those special ones) are non-builtIn by default."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3009
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3010
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3011
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3012
    "Modified: 23.4.1996 / 15:55:52 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3013
    "Created: 28.10.1996 / 15:10:02 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3014
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3015
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3016
isJavaClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3017
    "return true, if the receiver is a java class.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3018
     Java class support is not yet released to the public."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3019
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3020
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3021
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3022
    "Created: 17.3.1997 / 16:23:59 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3023
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3024
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3025
isPrivate
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3026
    "return true, if the receiver is some private class"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3027
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3028
    ^ self owningClass notNil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3029
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3030
    "Modified: 12.10.1996 / 20:11:05 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3031
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3032
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3033
isSubclassOf:aClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3034
    "return true, if I am a subclass of the argument, aClass"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3035
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3036
    |theClass|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3037
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3038
    theClass := superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3039
    [theClass notNil] whileTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3040
	(theClass == aClass) ifTrue:[^ true].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3041
%{
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3042
	if (__isBehaviorLike(theClass)) {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3043
	    theClass = __ClassInstPtr(theClass)->c_superclass;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3044
	} else {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3045
	    theClass = nil;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3046
	}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3047
%}.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3048
"/        theClass := theClass superclass.
3620
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  3049
    ].
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3050
    ^ false
2053
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3051
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3052
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3053
     String isSubclassOf:Collection  
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3054
     LinkedList isSubclassOf:Array   
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3055
     1 isSubclassOf:Number              <- will fail since 1 is no class
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3056
    "     
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3057
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3058
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3059
name
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3060
    "although behaviors have no name, we return something
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3061
     useful here - there are many places (inspectors) where
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3062
     a classes name is asked for.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3063
     Implementing this message here allows anonymous classes
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3064
     and instances of them to be inspected."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3065
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3066
    ^ #'someBehavior'
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3067
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3068
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3069
nameInBrowser
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3070
    "return a nameString as shown in browsers"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3071
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3072
    ^ self name
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3073
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3074
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3075
owningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3076
    "return my owning class - nil if I am a public class"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3077
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3078
    "/ this information is in the metaclass ...
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3079
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3080
    ^ self class owningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3081
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3082
    "Created: 15.10.1996 / 21:19:32 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3083
    "Modified: 7.11.1996 / 13:49:28 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3084
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3085
6733
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3086
owningClassOrYourself
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3087
    "return my owning class if I am private, myself otherwise"
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3088
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3089
    self owningClass notNil ifTrue:[^ self topOwningClass].
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3090
    ^ self
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3091
!
4f8a80a22261 added #owningClassOrYourself
Claus Gittinger <cg@exept.de>
parents: 6727
diff changeset
  3092
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3093
sharedPools
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3094
    "shared pools are not (yet) supported by ST/X;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3095
     return a dummy, empty collection here"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3096
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3097
    ^ #()
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3098
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3099
    "Created: 19.6.1997 / 18:19:36 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3100
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3101
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3102
sourceCodeAt:aSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3103
    "return the methods source for given selector aSelector or nil.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3104
     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
  3105
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3106
    |method|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3107
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3108
    method := self compiledMethodAt:aSelector.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3109
    method isNil ifTrue:[^ nil].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3110
    ^ method source
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3111
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3112
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3113
     True sourceCodeAt:#ifTrue:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3114
     Object sourceCodeAt:#==
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3115
     Behavior sourceCodeAt:#sourceCodeAt:
2053
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3116
    "
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3117
!
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  3118
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3119
sourceCodeManager
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3120
    "return the sourceCodeManager of the class. 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3121
     Returning nil here, since Behavior does not define any sourceCode management.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3122
     (only Classes do). This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3123
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3124
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3125
    ^ nil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3126
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3127
    "Created: 16.4.1996 / 16:26:03 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3128
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3129
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3130
supportsMethodCategories
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3131
    "return true, if my methods are categorized.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3132
     This is a hook for the browser to allow alien classes
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3133
     to be handled (aktually, this is not yet used)."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3134
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3135
    ^ true
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3136
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3137
    "Created: 30.7.1997 / 14:59:08 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3138
    "Modified: 30.7.1997 / 15:02:03 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3139
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3140
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3141
theMetaclass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3142
    "return my metaclass, also implemented in my metaclass, which also returns iteself."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3143
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3144
    ^ self class
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3145
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3146
    "Created: / 30.1.2000 / 23:08:30 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3147
    "Modified: / 31.1.2000 / 16:16:52 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3148
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3149
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3150
theNonMetaclass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3151
    "return myself, also implemented in my metaclass, which also returns me."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3152
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3153
    ^ self
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3154
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3155
    "Created: / 30.1.2000 / 23:07:59 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3156
    "Modified: / 31.1.2000 / 16:17:46 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3157
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3158
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3159
topOwningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3160
    "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
  3161
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3162
    "/ this information is in the metaclass ...
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3163
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3164
    ^ self class topOwningClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3165
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3166
    "Created: 15.10.1996 / 21:19:32 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3167
    "Modified: 3.1.1997 / 19:18:49 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3168
! !
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3169
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  3170
!Behavior methodsFor:'queries-inheritance'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3171
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3172
allSubclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3173
    "return a collection of all subclasses (direct AND indirect) of
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3174
     the receiver. There will be no specific order, in which entries
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3175
     are returned."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3176
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3177
    |newColl|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3178
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3179
    newColl := OrderedCollection new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3180
    self allSubclassesDo:[:aClass |
5327
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
  3181
        (aClass isNameSpace not or:[aClass == Smalltalk]) ifTrue:[
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
  3182
            newColl add:aClass
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
  3183
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3184
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3185
    ^ newColl
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3186
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3187
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3188
     Collection allSubclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3189
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3190
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3191
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3192
allSubclassesInOrder
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3193
    "return a collection of all subclasses (direct AND indirect) of
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3194
     the receiver. Higher level subclasses will come before lower ones."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3195
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3196
    |newColl|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3197
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3198
    newColl := OrderedCollection new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3199
    self allSubclassesInOrderDo:[:aClass |
5327
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
  3200
        (aClass isNameSpace not or:[aClass == Smalltalk]) ifTrue:[
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
  3201
            newColl add:aClass
5e5602d156fa #isNamespace renamed to #isNameSpace
Claus Gittinger <cg@exept.de>
parents: 5325
diff changeset
  3202
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3203
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3204
    ^ newColl
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3205
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3206
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3207
     Collection allSubclassesInOrder
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3208
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3209
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3210
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3211
allSuperclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3212
    "return a collection of the receivers accumulated superclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3213
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3214
    |aCollection theSuperClass|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3215
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3216
    theSuperClass := self superclass.
4451
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3217
    theSuperClass isNil ifTrue:[
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3218
        ^ #()
4451
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3219
    ].
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3220
    aCollection := OrderedCollection new.
ca4d77871c1c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4428
diff changeset
  3221
    [theSuperClass notNil] whileTrue:[
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3222
        aCollection add:theSuperClass.
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  3223
        theSuperClass := theSuperClass superclass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3224
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3225
    ^ aCollection
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3226
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3227
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3228
     String allSuperclasses 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3229
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3230
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3231
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3232
canBeSubclassed
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3233
    "return true, if its allowed to create subclasses of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3234
     This method is redefined in SmallInteger and UndefinedObject, since
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3235
     instances are detected by their pointer-fields, i.e. they do not have
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3236
     a class entry (you dont have to understand this :-)"
10
claus
parents: 5
diff changeset
  3237
claus
parents: 5
diff changeset
  3238
    ^ true
claus
parents: 5
diff changeset
  3239
!
claus
parents: 5
diff changeset
  3240
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3241
commonSuperclass:aClass
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3242
    "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
  3243
     Assumes that there is a common superclass of any two classes.
d9c0f178f091 commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents: 6733
diff changeset
  3244
     (might return nil, if either the receiver or the argument inherit from nil)"
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3245
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3246
    (aClass includesBehavior:self) ifTrue:[^ self].
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3247
    (self inheritsFrom:aClass) ifTrue:[^ aClass].
6754
d9c0f178f091 commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents: 6733
diff changeset
  3248
    superclass isNil ifTrue:[^ nil].
d9c0f178f091 commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents: 6733
diff changeset
  3249
    ^ superclass commonSuperclass:aClass
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3250
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3251
    "
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3252
     Integer commonSuperclass:Fraction  
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3253
     SmallInteger commonSuperclass:Fraction  
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3254
     View commonSuperclass:Form  
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3255
     View commonSuperclass:Image  
6754
d9c0f178f091 commonSuperClass: care for nil subclass
Claus Gittinger <cg@exept.de>
parents: 6733
diff changeset
  3256
     Integer commonSuperclass:Autoload      
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3257
    "
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3258
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3259
    "Modified: / 10.7.1998 / 02:13:04 / cg"
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3260
!
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3261
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3262
hasMultipleSuperclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3263
    "Return true, if this class inherits from other classes 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3264
     (beside its primary superclass). 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3265
     This method is a preparation for a future multiple inheritance extension 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3266
     - currently it is not supported by the VM"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3267
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3268
    ^ otherSuperclasses notNil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3269
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3270
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3271
inheritsFrom:aClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3272
    "return true, if the receiver inherits methods from aClass;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3273
     i.e. if aClass is on the receivers superclass chain."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3274
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3275
    ^ self isSubclassOf:aClass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3276
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3277
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3278
     True inheritsFrom:Object
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3279
     LinkedList inheritsFrom:Array
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3280
    "
1088
989f0e510a32 nicer message
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  3281
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3282
    "Modified: 19.6.1997 / 18:13:21 / cg"
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3283
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3284
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3285
subclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3286
    "return a collection of the direct subclasses of the receiver"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3287
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3288
    |newColl|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3289
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3290
    "/ use cached information (avoid class hierarchy search)
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3291
    "/ if possible
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3292
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3293
    SubclassInfo notNil ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3294
        newColl := SubclassInfo at:self ifAbsent:nil.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3295
        newColl notNil ifTrue:[^ newColl asOrderedCollection]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3296
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3297
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3298
    newColl := OrderedCollection new.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3299
    self subclassesDo:[:aClass |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3300
        newColl add:aClass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3301
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3302
    SubclassInfo notNil ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3303
        SubclassInfo at:self put:newColl.
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3304
    ].
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3305
    ^ newColl
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3306
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3307
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3308
     Class flushSubclassInfo.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3309
     Collection subclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3310
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3311
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3312
    "Modified: 22.1.1997 / 18:43:52 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3313
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3314
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3315
superclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3316
    "return a collection of the receivers immediate superclasses.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3317
     This method is a preparation for a future multiple inheritance extension 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3318
     - currently it is not supported by the VM"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3319
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3320
    |a|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3321
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3322
    a := Array with:self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3323
    otherSuperclasses notNil ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3324
        ^ a , otherSuperclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3325
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3326
    ^ a
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3327
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3328
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3329
     String superclasses  
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3330
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3331
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3332
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3333
withAllSubclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3334
    "return a collection containing the receiver and 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3335
     all subclasses (direct AND indirect) of the receiver"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3336
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3337
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3338
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3339
    coll := self allSubclasses asOrderedCollection.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3340
    coll addFirst:self.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3341
    ^ coll
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3342
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3343
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3344
     Collection withAllSubclasses
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3345
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3346
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3347
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3348
withAllSuperclasses
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3349
    "return a collection containing the receiver and all
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3350
     of the receivers accumulated superclasses"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3351
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3352
    |aCollection|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3353
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3354
    aCollection := OrderedCollection new.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3355
    self withAllSuperclassesDo:[:cls |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3356
        aCollection add:cls
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3357
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3358
    ^ aCollection
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3359
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3360
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3361
     String withAllSuperclasses 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3362
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3363
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3364
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3365
withAllSuperclassesDo:aBlock
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3366
    "evaluate aBlock for the class and all of its superclasses"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3367
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3368
    |theSuperClass|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3369
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3370
    aBlock value:self.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3371
    theSuperClass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3372
    [theSuperClass notNil] whileTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3373
        aBlock value:theSuperClass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3374
        theSuperClass := theSuperClass superclass
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3375
    ].
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  3376
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  3377
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3378
     String withAllSuperclassesDo:[:each| Transcript showCR:each] 
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  3379
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3380
! !
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3381
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  3382
!Behavior methodsFor:'queries-instances'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3383
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3384
allDerivedInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3385
    "return a collection of all instances of myself and 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3386
     instances of all subclasses of myself.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3387
     This method is going to be removed for protocol compatibility with
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3388
     other STs; use allSubInstances"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3389
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3390
    <resource:#obsolete>
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3391
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3392
    self obsoleteMethodWarning:'use #allSubInstances'.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3393
    ^ self allSubInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3394
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3395
    "Modified: 31.7.1997 / 23:04:59 / cg"
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  3396
!
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  3397
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3398
allInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3399
    "return a collection of all my instances"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3400
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3401
    "Read the documentation on why there seem to be no
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3402
     instances of SmallInteger and UndefinedObject"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3403
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3404
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3405
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3406
    coll := OrderedCollection new:100.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3407
    self allInstancesDo:[:anObject |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3408
	coll add:anObject
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3409
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3410
    ^ coll 
2713
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  3411
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  3412
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3413
     ScrollBar allInstances
2713
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  3414
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3415
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3416
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3417
allInstancesWeakly:doWeakly
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3418
    "return a collection of all my instances.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3419
     If weakly is true, a weak collection is returned."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3420
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3421
    "Read the documentation on why there seem to be no
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3422
     instances of SmallInteger and UndefinedObject"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3423
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3424
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3425
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3426
    coll := self allInstances.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3427
    doWeakly ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3428
	coll := WeakArray withAll:coll
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3429
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3430
    ^ coll
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3431
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3432
    "Created: / 19.6.1998 / 02:17:20 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3433
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3434
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3435
allSubInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3436
    "return a collection of all instances of myself and 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3437
     instances of all subclasses of myself."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3438
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3439
    |coll|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3440
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3441
    coll := OrderedCollection new:100.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3442
    self allSubInstancesDo:[:anObject |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3443
	(anObject isKindOf:self) ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3444
	    coll add:anObject
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3445
	]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3446
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3447
    ^ coll 
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
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3450
     View allSubInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3451
    "
2713
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  3452
!
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  3453
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3454
derivedInstanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3455
    "return the number of instances of myself and of subclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3456
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3457
    |count|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3458
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3459
    count := 0.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3460
    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3461
	(anObject isKindOf:self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3462
	    count := count + 1
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3463
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3464
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3465
    ^ count
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3466
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3467
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3468
     View derivedInstanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3469
     SequenceableCollection derivedInstanceCount
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3470
     Object derivedInstanceCount
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3471
    "
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3472
!
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3473
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3474
hasDerivedInstances
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3475
    "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
  3476
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3477
    "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
  3478
     instances of SmallInteger and UndefinedObject"
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3479
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3480
    ObjectMemory allObjectsDo:[:anObject |
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3481
	(anObject isKindOf:self) ifTrue:[
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3482
	    ^ true
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3483
	]
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3484
    ].
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3485
    ^ false
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3486
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3487
    "
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3488
     Object hasDerivedInstances         - certainly true
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3489
     SharedQueue hasDerivedInstances
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3490
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3491
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3492
2674
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3493
hasImmediateInstances
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  3494
    "return true if this class has immediate instances
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  3495
     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
  3496
     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
  3497
     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
  3498
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3499
    ^ false
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3500
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3501
    "Created: 3.6.1997 / 12:01:05 / cg"
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3502
!
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3503
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3504
hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3505
    "return true, if there are any instances of myself"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3506
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3507
    "Read the documentation on why there seem to be no
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3508
     instances of SmallInteger and UndefinedObject"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3509
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3510
"/    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3511
"/        (anObject class == self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3512
"/            ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3513
"/        ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3514
"/    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3515
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3516
    ObjectMemory allInstancesOf:self do:[:anObject |
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3517
	^ true
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3518
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3519
    ^ false
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3520
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3521
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3522
     Object hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3523
     SequenceableCollection hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3524
     Float hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3525
     SmallInteger hasInstances
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3526
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3527
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3528
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3529
hasSharedInstances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3530
    "return true if this class has shared instances, that is, instances
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3531
     with the same value are identical.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3532
     False is returned here, only redefined in classes which have unified
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3533
     instances (or should be treated so)."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3534
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3535
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3536
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3537
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3538
instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3539
    "return the number of instances of myself."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3540
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3541
    "Read the documentation on why there seem to be no
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3542
     instances of SmallInteger and UndefinedObject"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3543
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3544
    |count|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3545
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3546
    count := 0.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3547
"/    ObjectMemory allObjectsDo:[:anObject |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3548
"/        (anObject class == self) ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3549
"/            count := count + 1
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3550
"/        ]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3551
"/    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3552
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3553
    ObjectMemory allInstancesOf:self do:[:anObject |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3554
	count := count + 1
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3555
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3556
    ^ count
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3557
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3558
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3559
     View instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3560
     Object instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3561
     Float instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3562
     SequenceableCollection instanceCount
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3563
     SmallInteger instanceCount   .... mhmh - hear, hear
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3564
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3565
! !
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3566
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  3567
!Behavior methodsFor:'queries-instlayout'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3568
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3569
elementByteSize
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3570
    "for bit-like containers, return the number of bytes stored per
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3571
     element. For pointer indexed classes, 0 is returned"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3572
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3573
    self isBitsExtended ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3574
	self isBytes ifTrue:[^ 1].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3575
	self isWords ifTrue:[^ 2].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3576
	self isSignedWords ifTrue:[^ 2].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3577
	self isLongs ifTrue:[^ 4].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3578
	self isSignedLongs ifTrue:[^ 4].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3579
	self isLongLongs ifTrue:[^ 8].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3580
	self isSignedLongLongs ifTrue:[^ 8].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3581
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3582
    self isFloats ifTrue:[^ 4].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3583
    self isDoubles ifTrue:[^ 8].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3584
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3585
    ^ 0
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3586
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3587
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3588
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3589
isBits
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3590
    "return true, if instances have indexed byte or short instance variables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3591
     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
  3592
     not prepared to handle them correctly."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3593
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3594
%{  /* NOCONTEXT */
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
    REGISTER int what;
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
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3599
    RETURN (( (what == __MASKSMALLINT(BYTEARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3600
             || (what == __MASKSMALLINT(WORDARRAY))) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3601
%}.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3602
    ^ self isBytes or:[self isWords]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3603
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3604
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3605
isBitsExtended
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3606
    "return true, if instances have indexed byte, short, long or longlong instance variables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3607
     Ignore float and double arrays.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3608
     This is really the thing we expect #isBits to return, however, #isBits
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3609
     is defined to only return true for byte- and wordIndexed instances.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3610
     This avoids confusion of ST80 code, which is not prepared for long or longLong
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3611
     instVars."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3612
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3613
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3614
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3615
    REGISTER int what;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3616
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3617
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3618
    RETURN (( (what == __MASKSMALLINT(BYTEARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3619
	     || (what == __MASKSMALLINT(WORDARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3620
	     || (what == __MASKSMALLINT(SWORDARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3621
	     || (what == __MASKSMALLINT(LONGARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3622
	     || (what == __MASKSMALLINT(SLONGARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3623
	     || (what == __MASKSMALLINT(LONGLONGARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3624
	     || (what == __MASKSMALLINT(SLONGLONGARRAY))) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3625
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3626
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3627
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3628
isBytes
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3629
    "return true, if instances have indexed byte instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3630
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3631
    "this could also be defined as:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3632
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagBytes
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3633
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3634
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3635
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3636
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(BYTEARRAY)) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3637
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3638
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3639
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3640
isDoubles
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3641
    "return true, if instances have indexed double instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3642
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3643
    "this could also be defined as:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3644
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagDoubles
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3645
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3646
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3647
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3648
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(DOUBLEARRAY)) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3649
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3650
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3651
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3652
isFixed
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3653
    "return true, if instances do not have indexed instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3654
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3655
    "this could also be defined as:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3656
        ^ self isVariable not
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3657
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3658
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3659
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3660
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3661
    RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? false : true ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3662
%}.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3663
    ^ self isVariable not
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3664
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3665
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3666
isFloats
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3667
    "return true, if instances have indexed float instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3668
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3669
    "this could also be defined as:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3670
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagFloats
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3671
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3672
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3673
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3674
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(FLOATARRAY)) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3675
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3676
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3677
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3678
isFloatsOrDoubles
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3679
    "return true, if instances have indexed float or double instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3680
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3681
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3682
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3683
    int what;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3684
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3685
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3686
    RETURN (( (what == __MASKSMALLINT(FLOATARRAY))
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3687
             || (what == __MASKSMALLINT(DOUBLEARRAY))) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3688
%}.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3689
    ^ self isFloats or:[self isDoubles]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3690
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3691
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3692
     (Object new) class isFloatsOrDoubles 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3693
     (Point new) class isFloatsOrDoubles   
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3694
     (Array new) class isFloatsOrDoubles   
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3695
     (ByteArray new) class isFloatsOrDoubles  
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3696
     (FloatArray new) class isFloatsOrDoubles  
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3697
     (DoubleArray new) class isFloatsOrDoubles  
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3698
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3699
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3700
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3701
isLongLongs
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3702
    "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
  3703
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3704
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3705
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3706
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGLONGARRAY)) ? true : false );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3707
%}
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
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3710
isLongs
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3711
    "return true, if instances have indexed long instance variables (4 byte uints)"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3712
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3713
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3714
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3715
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGARRAY)) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3716
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3717
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3718
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3719
isPointers
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3720
    "return true, if instances have pointer instance variables 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3721
     i.e. are either non-indexed or have indexed pointer variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3722
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3723
    "QUESTION: should we ignore WeakPointers ?"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3724
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3725
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3726
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3727
    REGISTER int flags;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3728
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3729
    flags = __intVal(__INST(flags)) & ARRAYMASK;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3730
    switch (flags) {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3731
	default:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3732
	    /* normal objects */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3733
	    RETURN ( true );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3734
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3735
	case BYTEARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3736
	case WORDARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3737
	case LONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3738
	case SWORDARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3739
	case SLONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3740
	case SLONGLONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3741
	case LONGLONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3742
	case FLOATARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3743
	case DOUBLEARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3744
	    RETURN (false );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3745
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3746
	case WKPOINTERARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3747
	    /* what about those ? */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3748
	    RETURN (true );
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
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3752
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3753
isSignedLongLongs
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3754
    "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
  3755
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3756
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3757
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3758
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGLONGARRAY)) ? true : false );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3759
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3760
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3761
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3762
isSignedLongs
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3763
    "return true, if instances have indexed signed long instance variables (4 byte ints)"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3764
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3765
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3766
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3767
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGARRAY)) ? true : false );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3768
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3769
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3770
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3771
isSignedWords
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3772
    "return true, if instances have indexed signed short instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3773
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3774
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3775
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3776
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SWORDARRAY)) ? true : false );
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
!
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
isVariable
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3781
    "return true, if instances have indexed instance variables"
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
    "this could also be defined as:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3784
	^ (flags bitAnd:(Behavior maskIndexType)) ~~ 0
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3785
     "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3786
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3787
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3788
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3789
    RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3790
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3791
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3792
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3793
isWeakPointers
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3794
    "return true, if instances have weak pointer instance variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3795
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3796
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3797
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3798
    REGISTER int flags;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3799
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3800
    flags = __intVal(__INST(flags)) & ARRAYMASK;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3801
    if (flags == WKPOINTERARRAY) {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3802
        RETURN ( true );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3803
    }
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
    ^ false
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3806
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3807
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3808
isWords
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3809
    "return true, if instances have indexed short instance variables"
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
    "this could also be defined as:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3812
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagWords
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3813
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3814
%{  /* NOCONTEXT */
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
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(WORDARRAY)) ? true : false ); 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3817
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3818
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3819
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3820
sizeOfInst:n
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3821
    "return the number of bytes required for an instance of
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3822
     myself with n indexed instance variables. The argument n 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3823
     should be zero for classes without indexed instance variables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3824
     See Behavior>>niceNew: for an application of this."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3825
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3826
    |nInstvars|
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
    nInstvars := self instSize.
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
    int nBytes;
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
    nBytes = __intVal(nInstvars) * sizeof(OBJ) + OHDR_SIZE; 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3833
    if (__isSmallInteger(n)) {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3834
	int nIndex;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3835
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3836
	nIndex = __intVal(n);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3837
	switch (__intVal(__INST(flags)) & ARRAYMASK) {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3838
	    case BYTEARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3839
		nBytes += nIndex;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3840
		if (nBytes & (__ALIGN__ - 1)) {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3841
		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3842
		}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3843
		break;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3844
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3845
	    case WORDARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3846
	    case SWORDARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3847
		nBytes += nIndex * 2;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3848
		if (nBytes & (__ALIGN__ - 1)) {
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3849
		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3850
		}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3851
		break;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3852
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3853
	    case LONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3854
	    case SLONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3855
		nBytes += nIndex * 4;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3856
		break;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3857
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3858
	    case LONGLONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3859
	    case SLONGLONGARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3860
		nBytes += nIndex * 8;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3861
		break;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3862
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3863
	    case FLOATARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3864
		nBytes += nIndex * sizeof(float);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3865
		break;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3866
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3867
	    case DOUBLEARRAY:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3868
		nBytes += nIndex * sizeof(double);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3869
		break;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3870
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3871
	    default:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3872
		nBytes += nIndex * sizeof(OBJ);
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3873
		break;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3874
	}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3875
    }
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3876
    RETURN (__MKSMALLINT(nBytes));
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3877
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3878
! !
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3879
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  3880
!Behavior methodsFor:'queries-protocol'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3881
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3882
allSelectors
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3883
    "return a collection of all selectors understood by the receiver;
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3884
     this includes my selectors and all superclass selectors
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3885
     (i.e. the receivers full protocol)"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3886
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3887
    |superclass|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3888
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3889
    superclass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3890
    superclass notNil ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3891
        ^ superclass allSelectors addAll:(self selectors); yourself.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3892
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3893
    ^ self selectors asIdentitySet
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3894
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3895
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3896
     Point allSelectors
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3897
     View allSelectors
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3898
     Array allSelectors
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3899
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3900
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3901
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3902
cachedLookupMethodFor:aSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3903
    "return the method, which would be executed if aSelector was sent to
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3904
     an instance of the receiver. I.e. the selector arrays of the receiver
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3905
     and all of its superclasses are searched for aSelector.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3906
     Return the method, or nil if instances do not understand aSelector.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3907
     This interface provides exactly the same information as #lookupMethodFor:,
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3908
     but uses the lookup-cache in the VM for faster search. 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3909
     However, keep in mind, that doing a lookup through the cache also adds new
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3910
     entries and can thus slow down the system by polluting the cache with 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3911
     irrelevant entries. (do NOT loop over all objects calling this method).
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3912
     Does NOT (currently) handle MI"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3913
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3914
%{  /* NOCONTEXT */
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3915
    RETURN ( __lookup(self, aSelector) );
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3916
%}
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3917
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3918
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3919
     String cachedLookupMethodFor:#=
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3920
     String cachedLookupMethodFor:#asOrderedCollection
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3921
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3922
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3923
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3924
canUnderstand:aSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3925
    "return true, if the receiver or one of its superclasses implements aSelector.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3926
     (i.e. true if my instances understand aSelector)"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3927
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3928
    ^ (self lookupMethodFor:aSelector) notNil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3929
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3930
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3931
     True canUnderstand:#ifTrue:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3932
     True canUnderstand:#==
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3933
     True canUnderstand:#do:
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3934
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3935
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3936
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3937
compiledMethodAt:aSelector
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3938
    "return the method for given selector aSelector or nil.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3939
     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
  3940
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3941
    ^ self compiledMethodAt:aSelector ifAbsent:nil
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3942
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3943
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3944
     Object compiledMethodAt:#==
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3945
     (Object compiledMethodAt:#==) category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3946
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3947
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3948
    "Modified: / 7.6.1996 / 14:43:32 / stefan"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3949
    "Modified: / 27.10.1997 / 20:18:55 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3950
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3951
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3952
compiledMethodAt:aSelector ifAbsent:exceptionValue
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3953
    "return the method for given selector aSelector or the value
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3954
     of exceptionValue if not present.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3955
     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
  3956
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3957
    |dict|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3958
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3959
    dict := self methodDictionary.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3960
    dict isNil ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3961
	('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3962
	^ exceptionValue value
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3963
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3964
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3965
    ^ dict at:aSelector ifAbsent:exceptionValue
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
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3968
     Object compiledMethodAt:#==
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3969
     (Object compiledMethodAt:#==) category
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3970
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3971
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3972
    "Modified: / 7.6.1996 / 14:43:32 / stefan"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3973
    "Modified: / 10.1.1997 / 17:27:21 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3974
    "Created: / 27.10.1997 / 20:18:28 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3975
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3976
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3977
containsMethod:aMethod
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3978
    "Return true, if the argument, aMethod is a method of myself"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3979
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3980
    |dict|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3981
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3982
    dict := self methodDictionary. 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3983
    dict isNil ifTrue:[^ false].  "degenerated class"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3984
    ^ (dict keyAtValue:aMethod ifAbsent:[0]) ~~ 0
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3985
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3986
    "Modified: 12.6.1996 / 13:33:53 / stefan"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3987
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  3988
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3989
hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3990
    "return true, if there are any (local) methods in this class"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3991
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3992
    ^ (self methodDictionary size ~~ 0)
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3993
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3994
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3995
     True hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3996
     True class hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3997
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3998
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3999
    "Modified: 7.6.1996 / 15:43:09 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4000
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4001
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4002
implements:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4003
    "return true, if the receiver implements aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4004
     (i.e. implemented in THIS class - NOT in a superclass).
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4005
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4006
     Caveat:
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4007
	This simply checks for the selector being present in the classes
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4008
	selector table - therefore, it does not care for ignoredMethods.
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4009
	(but: you should not use this method for protocol-testing, anyway).
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4010
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4011
     Hint:
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4012
	Dont use this method to check if someone responds to a message -
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4013
	use #canUnderstand: on the class or #respondsTo: on the instance
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4014
	to do this."
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4015
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4016
    ^ self includesSelector:aSelector
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4017
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4018
    "
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4019
     notice: this is class protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4020
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4021
       True implements:#ifTrue:  
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4022
       True implements:#==        
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4023
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4024
     notice: this is instance protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4025
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4026
       true respondsTo:#ifTrue:   
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4027
       true respondsTo:#==        
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4028
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4029
     notice: this is class protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4030
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4031
       True canUnderstand:#ifTrue: 
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4032
       True canUnderstand:#==        
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4033
    "
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4034
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4035
    "Modified: 10.2.1996 / 13:15:56 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4036
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4037
2698
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4038
includesBehavior:aClass
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4039
    "return true, if the receiver includes the behavior of aClass;
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4040
     i.e. if is either identical to a class or inherits from it."
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4041
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4042
    ^ (self == aClass) or:[self isSubclassOf:aClass]
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4043
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4044
    "
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4045
     True includesBehavior:Object  
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4046
     True includesBehavior:Boolean 
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4047
     True includesBehavior:True    
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4048
     True includesBehavior:False   
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4049
    "
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4050
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4051
    "Modified: 19.6.1997 / 18:14:35 / cg"
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4052
!
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  4053
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4054
includesSelector:aSelector
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  4055
    "return true, if the methodDictionary of THIS class includes
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4056
     a method for aSelector.
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4057
     (i.e. if aSelector is implemented in THIS class - NOT in a superclass).
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4058
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4059
     Hint:
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4060
	Dont use this method to check if someone responds to a message -
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4061
	use #canUnderstand: on the class or #respondsTo: on the instance
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4062
	to do this."
4307
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
  4063
29dd3e6c91ca better #includesSelector
Claus Gittinger <cg@exept.de>
parents: 3980
diff changeset
  4064
    ^ self methodDictionary includesKey:aSelector
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4065
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4066
    "
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4067
	Object includesSelector:#==
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4068
	Object includesSelector:#murks
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4069
    "
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4070
3882
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3870
diff changeset
  4071
    "Modified: / 7.6.1996 / 14:27:24 / stefan"
3e11ea1568d5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3870
diff changeset
  4072
    "Modified: / 16.10.1998 / 13:00:15 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4073
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4074
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4075
lookupMethodFor:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4076
    "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
  4077
     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
  4078
     and all of its superclasses are searched for aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4079
     Return the method, or nil if instances do not understand aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4080
     EXPERIMENTAL: take care of multiple superclasses."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4081
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4082
    |m cls|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4083
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4084
    cls := self.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4085
    [cls notNil] whileTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4086
	m := cls compiledMethodAt:aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4087
	m notNil ifTrue:[^ m].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4088
	cls hasMultipleSuperclasses ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4089
	    cls superclasses do:[:aSuperClass |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4090
		m := aSuperClass lookupMethodFor:aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4091
		m notNil ifTrue:[^ m].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4092
	    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4093
	    ^ nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4094
	] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4095
	    cls := cls superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4096
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4097
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4098
    ^ nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4099
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4100
6460
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4101
responseTo:aSelector
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4102
    "return the method (from here or the inheritance chain), 
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4103
     which implements aSelector; return nil if none."
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4104
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4105
    |cls|
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4106
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4107
    cls := self whichClassIncludesSelector:aSelector.
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4108
    cls notNil ifTrue:[
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4109
        ^ cls compiledMethodAt:aSelector
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4110
    ].
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4111
    ^ nil
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4112
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4113
    "
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4114
     String responseTo:#==      
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4115
     String responseTo:#collect:   
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4116
     String responseTo:#,   
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4117
    "
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4118
!
99ac1e25f249 added #responseTo:
Claus Gittinger <cg@exept.de>
parents: 6412
diff changeset
  4119
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4120
selectorAtMethod:aMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4121
    "Return the selector for given method aMethod."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4122
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4123
    ^ self selectorAtMethod:aMethod ifAbsent:[nil]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4124
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4125
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4126
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4127
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4128
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4129
     Fraction selectorAtMethod:m.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4130
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4131
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4132
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4133
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4134
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4135
     Object selectorAtMethod:m.
356
claus
parents: 345
diff changeset
  4136
    "
claus
parents: 345
diff changeset
  4137
!
claus
parents: 345
diff changeset
  4138
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4139
selectorAtMethod:aMethod ifAbsent:failBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4140
    "return the selector for given method aMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4141
     or the value of failBlock, if not found."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4142
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4143
    |md|
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4144
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4145
    md := self methodDictionary.
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4146
    md isNil ifTrue:[
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4147
	'OOPS - nil methodDictionary' errorPrintCR.
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4148
	^ nil
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4149
    ].
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  4150
    ^ md keyAtValue:aMethod ifAbsent:failBlock.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  4151
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  4152
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4153
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4154
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4155
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4156
     Object selectorAtMethod:m ifAbsent:['oops'].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4157
    "
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  4158
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4159
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4160
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4161
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4162
     Fraction selectorAtMethod:m ifAbsent:['oops'].
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  4163
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4164
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  4165
    "Modified: 7.6.1996 / 15:15:45 / stefan"
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  4166
!
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  4167
2
claus
parents: 1
diff changeset
  4168
whichClassImplements:aSelector
328
claus
parents: 325
diff changeset
  4169
    "obsolete interface;
claus
parents: 325
diff changeset
  4170
     use whichClassIncludesSelector: for ST-80 compatibility."
claus
parents: 325
diff changeset
  4171
claus
parents: 325
diff changeset
  4172
    ^ self whichClassIncludesSelector:aSelector
claus
parents: 325
diff changeset
  4173
!
claus
parents: 325
diff changeset
  4174
claus
parents: 325
diff changeset
  4175
whichClassIncludesSelector:aSelector
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  4176
    "return the class in the inheritance chain, which implements the method
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  4177
     for aSelector; return nil if none.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  4178
     EXPERIMENTAL: handle multiple superclasses"
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  4179
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  4180
    |cls|
2
claus
parents: 1
diff changeset
  4181
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  4182
    cls := self.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  4183
    [cls notNil] whileTrue:[
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  4184
	(cls includesSelector:aSelector) ifTrue:[^ cls].
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4185
	cls hasMultipleSuperclasses ifTrue:[
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4186
	    cls superclasses do:[:aSuperClass |
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4187
		|implementingClass|
2
claus
parents: 1
diff changeset
  4188
328
claus
parents: 325
diff changeset
  4189
		implementingClass := aSuperClass whichClassIncludesSelector:aSelector.
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4190
		implementingClass notNil ifTrue:[^ implementingClass].
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4191
	    ].
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4192
	    ^ nil
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4193
	] ifFalse:[
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4194
	    cls := cls superclass
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  4195
	]
2
claus
parents: 1
diff changeset
  4196
    ].
claus
parents: 1
diff changeset
  4197
    ^ nil
claus
parents: 1
diff changeset
  4198
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  4199
    "
328
claus
parents: 325
diff changeset
  4200
     String whichClassIncludesSelector:#==
claus
parents: 325
diff changeset
  4201
     String whichClassIncludesSelector:#collect:
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  4202
    "
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4203
! !
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4204
6931
da671aa63926 category change
Claus Gittinger <cg@exept.de>
parents: 6889
diff changeset
  4205
!Behavior methodsFor:'queries-variables'!
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4206
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4207
allClassVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4208
    "return a collection of all the class variable name-strings
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4209
     this includes all superclass-class variables"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4210
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4211
    ^ self addAllClassVarNamesTo:(OrderedCollection new)
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4212
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4213
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4214
     Float allClassVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4215
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4216
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4217
    "Modified: 16.4.1996 / 18:01:00 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4218
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4219
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4220
allInstVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4221
    "return a collection of all the instance variable name-strings
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4222
     this includes all superclass-instance variables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4223
     Instvars of superclasses come first (i.e. the position matches
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4224
     the instVarAt:-index)."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4225
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4226
    self superclass isNil ifTrue:[^ self instVarNames].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4227
    ^ self addAllInstVarNamesTo:(OrderedCollection new)
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4228
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4229
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4230
     Dictionary instVarNames       
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4231
     Dictionary allInstVarNames    
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4232
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4233
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4234
    "Modified: 16.4.1996 / 18:03:55 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4235
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4236
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4237
allInstanceVariableNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4238
    "alias for allInstVarNames"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4239
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4240
    ^ self allInstVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4241
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4242
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4243
classVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4244
    "return a collection of the class variable name-strings.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4245
     Returning empty here, since Behavior does not define any classVariables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4246
     (only Classes do). This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4247
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4248
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4249
    ^ #()
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4250
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4251
    "Created: 16.4.1996 / 17:57:31 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4252
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4253
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4254
classVariableString
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4255
    "return a string of the class variables names.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4256
     Returning empty here, since Behavior does not define any classVariables.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4257
     (only Classes do). This allows different Behavior-like objects
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4258
     (alien classes) to be handled by the browser as well."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4259
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4260
    ^ ''
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4261
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4262
    "Created: 16.4.1996 / 16:28:56 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4263
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4264
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4265
instVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4266
    "Behavior does not provide this info - generate synthetic names."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4267
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4268
    |superclass superInsts|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4269
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4270
    superclass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4271
    superclass isNil ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4272
        superInsts := 0
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4273
    ] ifFalse:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4274
        superInsts := superclass instSize
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4275
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4276
    ^ (superInsts+1 to:self instSize) 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4277
       collect:[:index | '* instVar' , index printString , ' *']
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4278
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4279
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4280
instanceVariableNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4281
    "alias for instVarNames."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4282
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4283
    ^ self instVarNames
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4284
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4285
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4286
instanceVariableString
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4287
    "return a string with dummy names here - typically, your
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4288
     objects are instances of Class, not Behavior."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4289
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4290
    |superclass s superInsts n "{Class: SmallInteger }"|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4291
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4292
    superclass := self superclass.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4293
    s := ''.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4294
    superclass isNil ifTrue:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4295
        superInsts := 0
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4296
    ] ifFalse:[
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4297
        superInsts := superclass instSize
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4298
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4299
    n := self instSize.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4300
    superInsts+1 to:n do:[:i |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4301
        s size == 0 ifFalse:[s := s , ' '].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4302
        s := s , 'instvar' , i printString
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4303
    ].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4304
    ^ s
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4305
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4306
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4307
     Behavior new instanceVariableString 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4308
    "
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4309
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4310
    "Modified: 7.5.1996 / 12:50:25 / cg"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4311
    "Modified: 3.6.1996 / 16:03:33 / stefan"
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4312
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4313
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4314
whichClassDefinesClassVar: aString 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4315
	^self whichClassSatisfies: 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4316
			[:aClass | 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4317
			(aClass classVarNames collect: [:each | each asString]) 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4318
				includes: aString asString]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4319
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4320
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4321
whichClassDefinesInstVar: aString 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4322
	^self whichClassSatisfies: [:aClass | aClass instVarNames includes: aString]
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4323
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4324
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4325
whichSelectorsAssign: instVarName 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4326
        "Answer a set of selectors whose methods write the argument, instVarName, 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4327
        as a named instance variable."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4328
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4329
        ^ self whichSelectorsWrite: instVarName
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4330
!
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4331
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4332
whichSelectorsRead: instVarName 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4333
	"Answer a set of selectors whose methods read the argument, instVarName, 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4334
	as a named instance variable."
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4335
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4336
	| instVarIndex methodDict|
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4337
	instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4338
	methodDict := self methodDictionary.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4339
	^methodDict keys select: [:sel | (methodDict at: sel)
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4340
			readsField: instVarIndex]
2
claus
parents: 1
diff changeset
  4341
!
claus
parents: 1
diff changeset
  4342
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4343
whichSelectorsReferTo:someLiteralConstant
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4344
    "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
  4345
     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
  4346
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4347
    |setOfSelectors|
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4348
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4349
    setOfSelectors := IdentitySet new.
6395
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  4350
    self methodDictionary keysAndValuesDo:[:sel :mthd |
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  4351
        (mthd referencesLiteral:someLiteralConstant) ifTrue:[
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  4352
            setOfSelectors add:sel
2ad7a8e870ab instance variables should only be accessed by getters/setters
Claus Gittinger <cg@exept.de>
parents: 6329
diff changeset
  4353
        ].
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4354
    ].
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4355
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4356
    ^ setOfSelectors
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4357
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4358
    "
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4359
     String whichSelectorsReferTo:#at:  
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4360
     String whichSelectorsReferTo:CharacterArray 
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4361
    "
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4362
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4363
    "Modified: / 28.10.1997 / 13:13:18 / cg"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4364
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  4365
5297
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4366
whichSelectorsReferToClassVariable:nameOfClassVariable
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4367
    "return a collection of selectors of methods which refer to the argument.
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4368
     Search the literal arrays of my methods to do this."
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4369
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4370
    |internalNameOfVar|
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4371
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4372
    internalNameOfVar := (self name , ':' , nameOfClassVariable) asSymbol.
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4373
    ^ self whichSelectorsReferTo:internalNameOfVar
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4374
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4375
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4376
     Object whichSelectorsReferToClassVariable:#Dependencies
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4377
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4378
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4379
    "Modified: / 4.2.2000 / 00:40:22 / cg"
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4380
!
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4381
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4382
whichSelectorsReferToGlobal:nameOfGlobal
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4383
    "return a collection of selectors of methods which refer to the argument.
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4384
     Search the literal arrays of my methods to do this."
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4385
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4386
    |internalNameOfVar|
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4387
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4388
    internalNameOfVar := nameOfGlobal asSymbol.
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4389
    ^ self whichSelectorsReferTo:internalNameOfVar
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4390
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4391
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4392
     Object whichSelectorsReferToGlobal:#Debugger
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4393
    "
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4394
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4395
    "Modified: / 4.2.2000 / 00:41:10 / cg"
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4396
!
3779bff26cbe compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 5222
diff changeset
  4397
6727
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4398
whichSelectorsWrite: instVarName 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4399
	"Answer a set of selectors whose methods write the argument, instVarName, 
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4400
	as a named instance variable."
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
	| instVarIndex methodDict |
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4403
	instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Set new].
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4404
	methodDict := self methodDictionary.
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4405
	^methodDict keys select: [:sel | (methodDict at: sel)
30e331bcfeed *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6658
diff changeset
  4406
			writesField: instVarIndex]
2
claus
parents: 1
diff changeset
  4407
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4408
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4409
!Behavior methodsFor:'snapshots'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4410
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4411
postSnapshot
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4412
    "sent by ObjectMemory to all classes, after a snapshot has been written.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4413
     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
  4414
     about snapshooting."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4415
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4416
    "Modified: 16.4.1996 / 18:12:08 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4417
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4418
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4419
preSnapshot
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4420
    "sent by ObjectMemory to all classes, before a snapshot is written.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4421
     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
  4422
     about snapshooting."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4423
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  4424
    "Modified: 16.4.1996 / 18:12:14 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4425
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  4426
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4427
!Behavior methodsFor:'tracing'!
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4428
4682
4158042a9c8c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  4429
traceInto:aRequestor level:level from:referrer
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4430
    "double dispatch into tracer, passing my type implicitely in the selector"
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4431
4682
4158042a9c8c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  4432
    ^ aRequestor traceBehavior:self level:level from:referrer
4657
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4433
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4434
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4435
! !
ace3dc642424 added #hasSharedInstances and tracing support.
Claus Gittinger <cg@exept.de>
parents: 4636
diff changeset
  4436
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  4437
!Behavior class methodsFor:'documentation'!
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  4438
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  4439
version
6968
5eb367934349 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6931
diff changeset
  4440
    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.218 2003-01-26 14:15:53 cg Exp $'
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  4441
! !