Behavior.st
author Claus Gittinger <cg@exept.de>
Fri, 10 Jul 1998 02:13:45 +0200
changeset 3641 d419c5d9a1c3
parent 3628 5b58b3b8644a
child 3805 d525b3acc091
permissions -rw-r--r--
added #commonSuperClass:
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
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#Behavior
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
    14
	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
    15
	classVariableNames:'SubclassInfo'
1088
989f0e510a32 nicer message
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
    16
	poolDictionaries:''
989f0e510a32 nicer message
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
    17
	category:'Kernel-Classes'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
    20
!Behavior class methodsFor:'documentation'!
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    21
88
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    24
 COPYRIGHT (c) 1988 by Claus Gittinger
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
    25
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    26
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    34
!
81dacba7a63a *** empty log message ***
claus
parents: 82
diff changeset
    35
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    36
documentation
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    37
"
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    38
    Every class in the system inherits from Behavior (via Class, ClassDescription);
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    39
    so here is where most of the class messages end up being implemented.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    40
    (to answer a FAQ: 'Point basicNew' will be done here :-)
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    41
356
claus
parents: 345
diff changeset
    42
    Beginners should keep in mind, that all classes are instances (of subclasses)
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
    43
    of Behavior, therefore you will find the above mentioned 'basicNew:' method 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
    44
    under the 'instance'-methods of Behavior - NOT under the class methods 
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
    45
    ('Behavior new' will create and return a new class, while sending 'new' to 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
    46
    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
    47
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    48
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    49
    Behavior provides minimum support for all classes - additional stuff is
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    50
    found in ClassDescription and Class. Behaviors provides all mechanisms needed
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    51
    to create instances, and send messages to those. However, Behavior does not provide 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    52
    all the (symbolic) information needed to compile methods for a class or to get
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
    53
    useful information in inspectors.
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    54
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    55
    for experts:
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    56
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    57
    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
    58
    message dispatch mechanism, these can be used as 'light weight' classes.
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    59
    I.e. it is possible, to generate completely anonymous classes (and instances thereof)
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    60
    on the fly - 'Behavior new new' is such a thingy.
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    61
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
    62
    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
    63
    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
    64
    This avoids the need for knowledge about Dictionaries in the runtime library (VM)
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    65
    (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
    66
     hashed dictionary is almost void).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    67
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    68
    [Instance variables:]
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    69
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    70
	superclass        <Class>            the receivers superclass
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    71
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    72
	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
    73
					     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
    74
					     implementations
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    75
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    76
	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
    77
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    78
	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
    79
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    80
	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
    81
					     not for application use
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    82
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
    83
    flag bits (see stc.h):
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    84
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    85
    NOTICE: layout known by compiler and runtime system; be careful when changing
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    86
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1285
diff changeset
    87
    [author:]
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    88
	Claus Gittinger
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1285
diff changeset
    89
1285
7df250a95d7b commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    90
    [see also:]
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    91
	Class ClassDescription Metaclass
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
    92
	Method MethodDictionary
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
    93
"
356
claus
parents: 345
diff changeset
    94
!
claus
parents: 345
diff changeset
    95
claus
parents: 345
diff changeset
    96
virtualMachineRelationship 
claus
parents: 345
diff changeset
    97
"
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
    98
    Expert info follows:
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
    99
357
claus
parents: 356
diff changeset
   100
    NOTICE: 
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   101
	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
   102
	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
   103
	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
   104
	not be portable to other systems.
357
claus
parents: 356
diff changeset
   105
claus
parents: 356
diff changeset
   106
    WARNING: 
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   107
	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
   108
	it has been reported, that some crash badly when doing this .... ;-)
357
claus
parents: 356
diff changeset
   109
356
claus
parents: 345
diff changeset
   110
    Instances of Behavior and subclasses (i.e. in sloppy words: classes)
claus
parents: 345
diff changeset
   111
    play a special role w.r.t. the VM. Only objects whose class-slot is marked
claus
parents: 345
diff changeset
   112
    as being behaviorLike (in the flag-instvar) are considered to be classLike
claus
parents: 345
diff changeset
   113
    and a message lookup will be done for it in the well known way.
claus
parents: 345
diff changeset
   114
    Thus, if an object has a class for which its class does NOT have
362
claus
parents: 360
diff changeset
   115
    this flag bit set, the VM will trigger an error on a message send.
356
claus
parents: 345
diff changeset
   116
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   117
356
claus
parents: 345
diff changeset
   118
    Why is this so:
claus
parents: 345
diff changeset
   119
claus
parents: 345
diff changeset
   120
    the above lets every object play the role of a class,
claus
parents: 345
diff changeset
   121
    which has been flagged as behaviorLike in its class's flag.
claus
parents: 345
diff changeset
   122
    Thus, you can create arbitrary new classLike objects and have the VM 
claus
parents: 345
diff changeset
   123
    play with them.
claus
parents: 345
diff changeset
   124
    This may offer the flexibility to create a totally different object scheme
362
claus
parents: 360
diff changeset
   125
    on top of ST/X (for example: Self like objects) where any object can play
claus
parents: 360
diff changeset
   126
    a classRole for another object.
356
claus
parents: 345
diff changeset
   127
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   128
    [A concrete application of this is found in the Structure class,
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   129
     which creates objects which are their own class !!
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   130
     This may look to be of theoretical value at first sight, 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   131
     however, such a construct saves memory, by not requiring an extra 
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   132
     class object per Structure object.]
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   133
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   134
    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
   135
    object, the VM EXPECTS the object selector and methodDictionaries to be found
362
claus
parents: 360
diff changeset
   136
    at the instance positions as defined here.
claus
parents: 360
diff changeset
   137
    (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
   138
	superclass 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   139
	flags 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   140
	methodDictionary
362
claus
parents: 360
diff changeset
   141
     must be present and have the same instVar-index as here).
claus
parents: 360
diff changeset
   142
356
claus
parents: 345
diff changeset
   143
    The VM (and the system) may crash badly, if this is not the case.
362
claus
parents: 360
diff changeset
   144
356
claus
parents: 345
diff changeset
   145
    Since every class in the system derives from Behavior, the flag setting
357
claus
parents: 356
diff changeset
   146
    (and instance variable layout) is correct for all 'normal' classes.
claus
parents: 356
diff changeset
   147
    If you experiment by creating new behaviorLike objects, please take
claus
parents: 356
diff changeset
   148
    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
   149
    instVars  'superclass' and 'methodDictionary' are required
357
claus
parents: 356
diff changeset
   150
    and have to be at the same instVar index.
362
claus
parents: 360
diff changeset
   151
    (we suggest, you subclass Behavior, to make certain)
357
claus
parents: 356
diff changeset
   152
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   153
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   154
    Vice versa, defining 'dump classes', which have the behaviorLike bit turned
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   155
    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
   156
    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
   157
    #doesNotUnderstand: mechanism - however, since the instance is no good
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   158
    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
   159
    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
   160
    and arguments) along with the original receiver.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   161
    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
   162
    however, you may redefine this in your 'dum class' for recovery.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   163
    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
   164
    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
   165
    interface.
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   166
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   167
    All of the above is pure expert stuff 
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   168
    - 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
   169
    ST-programmer, though (and even most of those will never use these features).
357
claus
parents: 356
diff changeset
   170
356
claus
parents: 345
diff changeset
   171
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   172
    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
   173
	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
   174
	-> 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
   175
	   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
   176
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   177
	|newMeta notRecognizedAsClass someInstance|
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 := Metaclass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   180
	newMeta flags:0.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   181
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   182
	notRecognizedAsClass := newMeta new.
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
	someInstance := notRecognizedAsClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   185
	someInstance perform:#isNil
356
claus
parents: 345
diff changeset
   186
357
claus
parents: 356
diff changeset
   187
claus
parents: 356
diff changeset
   188
    Of course, this is an exception which can be handled ...:
claus
parents: 356
diff changeset
   189
    Example:
claus
parents: 356
diff changeset
   190
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   191
	|newMeta notRecognizedAsClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   192
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   193
	newMeta := Metaclass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   194
	newMeta flags:0.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   195
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   196
	notRecognizedAsClass := newMeta new.
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
	someInstance := notRecognizedAsClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   199
	Object errorSignal handle:[:ex |
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   200
	    ex return
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   201
	] do:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   202
	    someInstance perform:#isNil
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   203
	]
357
claus
parents: 356
diff changeset
   204
claus
parents: 356
diff changeset
   205
claus
parents: 356
diff changeset
   206
    likewise, a doesNotUnderstand-notUnderstood can be handled:
claus
parents: 356
diff changeset
   207
    Example:
claus
parents: 356
diff changeset
   208
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   209
	|newMeta funnyClass someInstance|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   210
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   211
	newMeta := Metaclass new.
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
	funnyClass := newMeta new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   214
	funnyClass setSuperclass:nil.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   215
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   216
	someInstance := funnyClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   217
	Object errorSignal handle:[:ex |
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   218
	     ex return
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   219
	] do:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   220
	    someInstance perform:#isNil
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   221
	]
357
claus
parents: 356
diff changeset
   222
claus
parents: 356
diff changeset
   223
362
claus
parents: 360
diff changeset
   224
    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
   225
	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
   226
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   227
	|newClass someInstance|
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 := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   230
	newClass setSuperclass:nil.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   231
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   232
	someInstance inspect
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   233
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   234
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   235
	|newClass someInstance|
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 := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   238
	newClass setSuperclass:newClass.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   239
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   240
	someInstance inspect
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   241
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   242
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   243
	|newClass someInstance|
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 := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   246
	newClass setSuperclass:1.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   247
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   248
	someInstance inspect
357
claus
parents: 356
diff changeset
   249
claus
parents: 356
diff changeset
   250
356
claus
parents: 345
diff changeset
   251
    Example:
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   252
	creating totally anonymous classes:
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   253
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   254
	|newClass someInstance|
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 := Class new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   257
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   258
	someInstance inspect
356
claus
parents: 345
diff changeset
   259
357
claus
parents: 356
diff changeset
   260
356
claus
parents: 345
diff changeset
   261
    Example:
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   262
	creating totally anonymous metaclasses:
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   263
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   264
	|newMeta newClass someInstance|
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 := Metaclass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   267
	newClass := newMeta new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   268
	someInstance := newClass new.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   269
	someInstance inspect
357
claus
parents: 356
diff changeset
   270
2230
b7a86880ab9c beahvior documentation updated
Claus Gittinger <cg@exept.de>
parents: 2228
diff changeset
   271
357
claus
parents: 356
diff changeset
   272
    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
   273
	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
   274
	with: 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   275
		'Smalltalk debugPrinting:false'
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   276
	and: 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   277
		'Smalltalk infoPrinting:false'
356
claus
parents: 345
diff changeset
   278
"
47
93f17a1b452c *** empty log message ***
claus
parents: 45
diff changeset
   279
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   280
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   281
!Behavior class methodsFor:'creating new classes'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   282
a27a279701f8 Initial revision
claus
parents:
diff changeset
   283
new
356
claus
parents: 345
diff changeset
   284
    "creates and return a new behavior (which is like a class,
claus
parents: 345
diff changeset
   285
     but without the symbolic & name information).
claus
parents: 345
diff changeset
   286
     Not for normal applications.
claus
parents: 345
diff changeset
   287
     Sending the returned behavior the #new message gives you
claus
parents: 345
diff changeset
   288
     an instance if it.
claus
parents: 345
diff changeset
   289
claus
parents: 345
diff changeset
   290
     Notice: the returned class is given a superclass of Object;
claus
parents: 345
diff changeset
   291
     this allows for its new instances to be inspected and the like."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   292
a27a279701f8 Initial revision
claus
parents:
diff changeset
   293
    |newClass|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   294
a27a279701f8 Initial revision
claus
parents:
diff changeset
   295
    newClass := self basicNew.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   296
    newClass setSuperclass:Object
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   297
	  methodDictionary:MethodDictionary new
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
   298
		  instSize:0
345
claus
parents: 343
diff changeset
   299
		     flags:(self flagBehavior).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   300
    ^ newClass
356
claus
parents: 345
diff changeset
   301
claus
parents: 345
diff changeset
   302
    "
claus
parents: 345
diff changeset
   303
     Behavior new               <- a new behavior
claus
parents: 345
diff changeset
   304
     Behavior new new           <- an instance of it
claus
parents: 345
diff changeset
   305
     ClassDescription new       <- a new classDescription
claus
parents: 345
diff changeset
   306
     ClassDescription new new   <- an instance of it
claus
parents: 345
diff changeset
   307
     Class new                  <- a new class
claus
parents: 345
diff changeset
   308
     Class new new              <- an instance of it
claus
parents: 345
diff changeset
   309
     Metaclass new              <- a new metaclass
claus
parents: 345
diff changeset
   310
     Metaclass new new          <- an instance (i.e. a class) of it
claus
parents: 345
diff changeset
   311
     Metaclass new new new      <- an instance of this new class
claus
parents: 345
diff changeset
   312
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   313
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   314
    "Modified: 7.6.1996 / 15:38:58 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   315
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   316
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   317
!Behavior class methodsFor:'flag bit constants'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   318
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   319
flagBehavior
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   320
    "return the flag code which marks Behavior-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   321
     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
   322
     checking for behaviors."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   323
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   324
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   325
    /* 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
   326
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   327
    RETURN ( __MKSMALLINT(BEHAVIOR_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   328
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   329
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   330
    "consistency check:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   331
     all class-entries must be behaviors;
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   332
     all behaviors must be flagged so (in its class's flags)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   333
     (otherwise, VM will bark)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   334
     all non-behaviors may not be flagged
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   335
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   336
     |bit|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   337
     bit := Class flagBehavior.
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
     ObjectMemory allObjectsDo:[:o|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   340
       o isBehavior ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   341
	 (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
   342
	     self halt
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   343
	 ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   344
       ] ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   345
	 (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
   346
	     self halt
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   347
	 ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   348
       ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   349
       o class isBehavior ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   350
	 self halt
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   351
       ] ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   352
	 (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
   353
	     self halt
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   354
	 ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   355
       ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   356
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   357
    "
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
flagBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   361
    "return the flag code which marks Block-like instances.
2236
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   362
     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
   363
     value when checking for blocks to be evaluated from bytecodes.
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   364
     However, compiled code only checks for the block bit."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   365
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   366
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   367
    /* 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
   368
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   369
    RETURN ( __MKSMALLINT(BLOCK_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   370
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   371
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   372
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   373
flagBlockContext
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   374
    "return the flag code which marks BlockContext-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   375
     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
   376
     checking for blockContexts."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   377
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   378
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   379
    /* 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
   380
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   381
    RETURN ( __MKSMALLINT(BCONTEXT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   382
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   383
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   384
2236
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   385
flagBlockLike
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   386
    "return the flag code which marks Block-like instances
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   387
     with respect to byteCode interpretation.
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   388
     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
   389
     value when checking for blocks to be evaluated from bytecodes.
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   390
     However, compiled code only checks for the block bit."
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   391
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   392
%{  /* NOCONTEXT */
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   393
    /* 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
   394
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   395
    RETURN ( __MKSMALLINT(BLOCKLIKE_INSTS) );
ab40680bd690 flagBlock vs. flagBlockLike
Claus Gittinger <cg@exept.de>
parents: 2230
diff changeset
   396
%}
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
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   399
flagBytes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   400
    "return the flag code for byte-valued indexed instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   401
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   402
     and compares it to this flag value, when checking for byte valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   403
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   404
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   405
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   406
    /* 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
   407
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   408
    RETURN ( __MKSMALLINT(BYTEARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   409
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   410
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   411
     Behavior flagBytes    
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   415
flagContext
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   416
    "return the flag code which marks Context-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   417
     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
   418
     checking for contexts."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   419
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   420
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   421
    /* 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
   422
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   423
    RETURN ( __MKSMALLINT(CONTEXT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   424
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   425
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   426
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   427
flagDoubles
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   428
    "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
   429
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   430
     and compares it to this flag value, when checking for double valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   431
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   432
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   433
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   434
    /* 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
   435
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   436
    RETURN ( __MKSMALLINT(DOUBLEARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   437
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   438
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   439
     Behavior flagDoubles    
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   440
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   441
     (ByteArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)    
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   442
     (DoubleArray flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)    
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   443
     (Object flags bitAnd:(Behavior maskIndexType)) == (Behavior flagDoubles)    
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   444
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   445
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   446
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   447
flagFloat
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   448
    "return the flag code which marks Float-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   449
     The VM checks this single bit in the flag value when
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   450
     checking for a float."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   451
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   452
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   453
    /* 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
   454
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   455
    RETURN ( __MKSMALLINT(FLOAT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   456
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   457
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   458
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   459
flagFloats
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   460
    "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
   461
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   462
     and compares it to this flag value, when checking for double valued
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   463
     variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   464
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   465
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   466
    /* 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
   467
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   468
    RETURN ( __MKSMALLINT(FLOATARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   469
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   470
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   471
     Behavior flagFloats    
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
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   475
flagForSymbolic:aSymbol
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   476
    "return the flag code for indexed instances with aSymbolic type.
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   477
     The argument may be one of #float, #double, #long, #word, #signedWord,
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   478
     #signedLong or #byte."
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   479
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   480
%{   /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   481
    if (aSymbol == @symbol(float)) {
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   482
	RETURN ( __MKSMALLINT(FLOATARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   483
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   484
    if (aSymbol == @symbol(double)) {
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   485
	RETURN ( __MKSMALLINT(DOUBLEARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   486
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   487
    if (aSymbol == @symbol(long)) {
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   488
	RETURN ( __MKSMALLINT(LONGARRAY) );
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(word)) {
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   491
	RETURN ( __MKSMALLINT(WORDARRAY) );
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(signedWord)) {
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   494
	RETURN ( __MKSMALLINT(SWORDARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   495
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   496
    if (aSymbol == @symbol(signedLong)) {
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   497
	RETURN ( __MKSMALLINT(SLONGARRAY) );
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   498
    }
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   499
    if (aSymbol == @symbol(byte)) {
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   500
	RETURN ( __MKSMALLINT(BYTEARRAY) );
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
%}.
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   503
    ^ 0         "/ not indexed
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
3141
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   506
flagJavaClass
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   507
    "return the flag code which marks JavaClass-like instances.
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   508
     The VM checks this single bit in the flag value when
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   509
     checking for a javaClass."
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   510
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   511
%{  /* NOCONTEXT */
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   512
    /* this is defined as a primitive to get defines from stc.h */
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   513
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   514
    RETURN ( __MKSMALLINT(JCLASS_INSTS) );
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   515
%}
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   516
!
366ff03d9c8f javaFlag added
Claus Gittinger <cg@exept.de>
parents: 3069
diff changeset
   517
2801
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   518
flagJavaMethod
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   519
    "return the flag code which marks JavaMethod-like instances.
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   520
     The VM checks this single bit in the flag value when
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   521
     checking for a method."
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   522
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   523
%{  /* NOCONTEXT */
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   524
    /* 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
   525
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   526
    RETURN ( __MKSMALLINT(JMETHOD_INSTS) );
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   527
%}
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   528
!
195be5eb29f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   529
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   530
flagLongs
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   531
    "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
   532
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   533
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   534
     unsigned long valued variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   535
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   536
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   537
    /* 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
   538
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   539
    RETURN ( __MKSMALLINT(LONGARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   540
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   541
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   542
     Behavior flagLongs    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   543
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   544
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   545
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   546
flagMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   547
    "return the flag code which marks Method-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   548
     The VM checks this single bit in the flag value when
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   549
     checking for a method."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   550
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   551
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   552
    /* 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
   553
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   554
    RETURN ( __MKSMALLINT(METHOD_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   555
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   556
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   557
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   558
flagNonObjectInst
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   559
    "return the flag code which marks instances which have a
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   560
     non-object instance variable (in slot 1).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   561
     (these are ignored by the garbage collector)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   562
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   563
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   564
    /* 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
   565
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   566
    RETURN ( __MKSMALLINT(NONOBJECT_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   567
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   568
!
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
flagNotIndexed
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   571
    "return the flag code for non-indexed instances.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   572
     You have to mask the flag value with indexMask when comparing
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   573
     it with flagNotIndexed."
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
    ^ 0
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   576
!
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
flagPointers
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   579
    "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
   580
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   581
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   582
     pointer variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   583
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   584
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   585
    /* 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
   586
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   587
    RETURN ( __MKSMALLINT(POINTERARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   588
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   589
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   590
     Behavior flagPointers    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   591
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   592
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   593
1383
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   594
flagRegular
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   595
    "return the flag code which marks regular instances."
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   596
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   597
    ^ 0
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   598
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   599
    "Created: 12.5.1996 / 17:53:36 / cg"
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   600
!
1033e3b396d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1340
diff changeset
   601
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   602
flagSignedLongs
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   603
    "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
   604
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   605
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   606
     signed long valued variable instances."
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   607
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   608
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   609
    /* this is defined as a primitive to get defines from stc.h */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   610
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   611
    RETURN ( __MKSMALLINT(SLONGARRAY) );
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   612
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   613
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   614
     Behavior flagSignedLongs
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   615
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   616
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   617
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   618
flagSignedWords
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   619
    "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
   620
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   621
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   622
     signed word valued variable instances."
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   623
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   624
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   625
    /* this is defined as a primitive to get defines from stc.h */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   626
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   627
    RETURN ( __MKSMALLINT(SWORDARRAY) );
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   628
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   629
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   630
     Behavior flagSignedWords
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   631
    "
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   632
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   633
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   634
flagSymbol
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   635
    "return the flag code which marks Symbol-like instances.
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   636
     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
   637
     checking for symbols."
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
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   640
    /* 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
   641
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   642
    RETURN ( __MKSMALLINT(SYMBOL_INSTS) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   643
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   644
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   645
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   646
flagWeakPointers
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   647
    "return the flag code for weak pointer indexed instances (i.e. WeakArray).
2226
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   648
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   649
     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
   650
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   651
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   652
    /* 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
   653
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   654
    RETURN ( __MKSMALLINT(WKPOINTERARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   655
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   656
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   657
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   658
flagWords
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   659
    "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
   660
     The VM masks the flag value with the indexMask (maskIndexType) 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   661
     and compares it to this flag value, when checking for 
b59ec5725a9d commentary
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
   662
     unsigned word valued variable instances."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   663
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   664
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   665
    /* 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
   666
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   667
    RETURN ( __MKSMALLINT(WORDARRAY) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   668
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   669
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   670
     Behavior flagWords    
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   671
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   672
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   673
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   674
maskIndexType
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   675
    "return a mask to extract all index-type bits"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   676
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   677
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   678
    /* 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
   679
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   680
    RETURN ( __MKSMALLINT(ARRAYMASK) );
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   681
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   682
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   683
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   684
!Behavior class methodsFor:'private '!
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   685
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   686
flushSubclassInfo
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   687
    "throw away (forget) the cached subclass information, as created
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   688
     by #subclassInfo.
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   689
     This is private protocol"
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   690
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   691
    SubclassInfo := nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   692
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   693
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   694
     Class flushSubclassInfo
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   695
    "
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   696
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   697
    "Modified: 22.1.1997 / 18:39:36 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   698
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   699
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   700
subclassInfo
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   701
    "build & return a dictionary, containing the set of subclass
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   702
     for each class. This information is kept until explicitely flushed
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   703
     by #flushSubclassInfo.
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   704
     This cache is used internally, for enumerators like #allSubclasses
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   705
     or #allSubclassesDo:, to avoid repeated recursive walks over the class
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   706
     hierarchy.
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   707
     This is private protocol."
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   708
357
claus
parents: 356
diff changeset
   709
    |d|
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   710
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   711
    SubclassInfo notNil ifTrue:[^ SubclassInfo].
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   712
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   713
    d := IdentityDictionary new.
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   714
    Smalltalk allClassesDo:[:aClass |
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   715
	|superCls|
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   716
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   717
	aClass isMeta not ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   718
	    superCls := aClass superclass.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   719
	    superCls notNil ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   720
		(d includesKey: superCls) ifFalse:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   721
		    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
   722
		] ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   723
		    (d at:superCls ) add:aClass
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   724
		]
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   725
	    ]
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   726
	].
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   727
    ].
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   728
    SubclassInfo := d.
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   729
    ^ d
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   730
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   731
    "
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   732
     Class subclassInfo
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   733
    "
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   734
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
   735
    "Modified: 22.1.1997 / 18:44:59 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   736
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   737
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
   738
!Behavior class methodsFor:'queries'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   739
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   740
isBuiltInClass
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
   741
    "return true if this class is known by the run-time-system.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
   742
     Here, true is returned for myself, false for subclasses."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   743
1179
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   744
    ^ (self == Behavior class) or:[self == Behavior]
3e0f32177af4 allow subclasses of Class to be changed
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   745
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
   746
    "Modified: 23.4.1996 / 15:55:52 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   747
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   748
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   749
!Behavior methodsFor:'accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   750
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   751
addSelector:newSelector withLazyMethod:newMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   752
    "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
   753
     1st argument to the methodDictionary. 
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   754
     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
   755
     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
   756
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   757
    |oldMethod|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   758
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   759
    newMethod isLazyMethod ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   760
	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
   761
	^ false
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   762
    ].
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   763
    oldMethod := self compiledMethodAt:newSelector.
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   764
    "/
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   765
    "/ 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
   766
    "/ 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
   767
    "/
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   768
    oldMethod notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   769
	newMethod privacy:(oldMethod privacy).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   770
	newMethod restricted:(oldMethod isRestricted).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   771
	ObjectMemory flushCaches
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   772
    ].
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   773
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   774
    (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
   775
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   776
	"/ 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
   777
	"/ - 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
   778
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   779
	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
   780
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   781
	"/ 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
   782
	"/ 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
   783
	"/ 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
   784
	"/ - 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
   785
	"/
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   786
	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
   787
	^ true
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   788
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   789
    ^ false
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   790
2095
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   791
    "Modified: 8.1.1997 / 23:02:10 / cg"
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   792
!
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   793
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   794
addSelector:newSelector withMethod:newMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   795
    "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
   796
     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
   797
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   798
    |nargs oldMethod|
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   799
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   800
    oldMethod := self compiledMethodAt:newSelector.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   801
    (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
   802
746
31f5d9af5680 dont forget privace & restricted when entering a method
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
   803
    oldMethod notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   804
	newMethod privacy:(oldMethod privacy).
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   805
	newMethod restricted:(oldMethod isRestricted).
746
31f5d9af5680 dont forget privace & restricted when entering a method
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
   806
    ].
31f5d9af5680 dont forget privace & restricted when entering a method
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
   807
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   808
    "/
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   809
    "/ pass the selector AND the old method as changeArg
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   810
    "/ - this allows for watchers to find out if its a new method or a method-change
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   811
    "/
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   812
    self changed:#methodDictionary with:(Array with:newSelector with:oldMethod).
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   813
2095
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   814
    "/
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   815
    "/ also notify a change of Smalltalk;
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   816
    "/ this allows a dependent of Smalltalk to watch all class
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   817
    "/ changes (no need for observing all classes)
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   818
    "/ - this allows for watchers to find out if its a new method or a method-change
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   819
    "/
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   820
    Smalltalk changed:#methodInClass with:(Array with:self with:newSelector with:oldMethod).
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   821
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   822
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   823
     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
   824
     data for myself ... (actually, in any case all that needs
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   825
     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
   826
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   827
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   828
    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
   829
	     a bit slow :-(
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   830
	     We need the hasSubclasses-info bit in Behavior; now
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   831
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   832
    self withAllSubclassesDo:[:aClass |
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   833
	ObjectMemory flushInlineCachesFor:aClass withArgs:nargs.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   834
	ObjectMemory flushMethodCacheFor:aClass
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   835
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   836
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   837
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   838
    nargs := newSelector numArgs.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   839
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   840
    ObjectMemory flushMethodCacheForSelector:newSelector.
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   841
"/    ObjectMemory flushMethodCache.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   842
    ObjectMemory flushInlineCachesWithArgs:nargs.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   843
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   844
    ^ true
734
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   845
a4378f483a86 pass original method as changeArg when doing method changes;
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   846
    "Created: 11.12.1995 / 13:59:37 / cg"
2095
fa85d9f387ac beside notifying a self-changed,
Claus Gittinger <cg@exept.de>
parents: 2054
diff changeset
   847
    "Modified: 8.1.1997 / 22:43:13 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   848
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   849
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   850
addSuperclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   851
    "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
   852
     inherit protocol."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   853
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   854
    "first, check if the class is abstract - 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   855
     allows abstract mixins are allowed in the current implementation"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   856
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   857
    aClass instSize == 0 ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   858
	self error:'only abstract mixins allowed'.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   859
	^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   860
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   861
    otherSuperclasses isNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   862
	otherSuperclasses := Array with:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   863
    ] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   864
	otherSuperclasses := otherSuperclasses copyWith:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   865
    ].
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
   866
    SubclassInfo := nil.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   867
    ObjectMemory flushCaches
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   868
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   869
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   870
displayString
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   871
    "although behaviors have no name, we return something
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   872
     useful here - there are many places (inspectors) where
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   873
     a classes name is asked for.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   874
     Implementing this message here allows instances of anonymous classes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   875
     to show a reasonable name."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   876
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   877
    ^ 'someBehavior'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   878
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   879
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   880
flags
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   881
    "return the receivers flag bits"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   882
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   883
    ^ flags
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   884
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   885
3327
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   886
getMethodDictionary
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   887
    "ST 80 compatibility: return the receivers method dictionary."
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   888
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   889
    ^ methodDictionary
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   890
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   891
    "Modified: / 6.3.1998 / 15:45:50 / stefan"
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   892
!
5efc0a1f0e2c Add #getMethodDictionary (ST80)
Stefan Vogel <sv@exept.de>
parents: 3237
diff changeset
   893
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   894
instSize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   895
    "return the number of instance variables of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   896
     This includes all superclass instance variables."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   897
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   898
    ^ instSize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   899
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   900
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   901
methodDictionary
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   902
    "return the receivers method dictionary."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   903
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   904
    ^ methodDictionary
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   905
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   906
    "Modified: 12.6.1996 / 13:47:08 / stefan"
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
   907
    "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
   908
!
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   909
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   910
methodDictionary:dict
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   911
    "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
   912
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   913
    dict isNil ifTrue:[
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   914
	self halt:'attempt to set methodDictionary to nil.'
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   915
    ].
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   916
    self setMethodDictionary:dict.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   917
    ObjectMemory flushCaches.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   918
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   919
    "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
   920
    "Modified: 7.6.1996 / 08:39:51 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   921
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   922
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   923
removeSelector:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   924
    "remove the selector, aSelector and its associated method 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   925
     from the methodDictionary"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   926
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   927
    |dict newDict|
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   928
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   929
    dict := self methodDictionary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   930
    newDict := dict removeKeyAndCompress:aSelector.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   931
    newDict isNil ifTrue:[ 
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   932
	^ false.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   933
    ].
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   934
    self setMethodDictionary:newDict.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   935
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   936
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   937
    [
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   938
	|nargs|
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   939
	nargs := aSelector numArgs.
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   940
	ObjectMemory flushMethodCache.
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
   941
	ObjectMemory flushInlineCachesWithArgs:nargs.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   942
    ] value
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   943
"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   944
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   945
     actually, we would do better with less flushing ...
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   946
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   947
    ObjectMemory flushCaches.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   948
    ^ true
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   949
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   950
    "Modified: 12.6.1996 / 11:54:29 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   951
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   952
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   953
removeSuperclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   954
    "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
   955
     inherit protocol."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   956
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   957
    otherSuperclasses notNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   958
	otherSuperclasses := otherSuperclasses copyWithout:aClass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   959
	otherSuperclasses isEmpty ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   960
	    otherSuperclasses := nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   961
	].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   962
	SubclassInfo := nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   963
	ObjectMemory flushCaches
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   964
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   965
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   966
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   967
selectors
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   968
    "return the receivers selector array as an orderedCollection.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   969
     Notice: this may not be compatible with ST-80.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   970
     (should we return a Set ?)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   971
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   972
    |md|
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   973
1967
e8a6fb1e14ce oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   974
    (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
   975
	'oops - nil methodDictionary' errorPrintCR.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
   976
	^ #()
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   977
    ].
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   978
    ^ md keys
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   979
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
   980
    "Modified: 7.6.1996 / 15:33:18 / stefan"
1967
e8a6fb1e14ce oops - iNil instead of isNil
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
   981
    "Modified: 12.11.1996 / 11:31:51 / cg"
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   984
superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   985
    "return the receivers superclass"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   986
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   987
    ^ superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   988
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   989
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   990
superclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   991
    "set the superclass - this actually creates a new class,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   992
     recompiling all methods for the new one. The receiving class stays
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   993
     around anonymous to allow existing instances some life.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   994
     This may change in the future (adjusting existing instances)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   995
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
   996
    |owner ns name|
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
   997
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   998
    SubclassInfo := nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   999
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1000
    "must flush caches since lookup chain changes"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1001
    ObjectMemory flushCaches.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1002
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1003
    "/ 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
  1004
    "/ 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
  1005
    "/ 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
  1006
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1007
    (owner := self owningClass) notNil ifTrue:[
3628
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1008
        ns := owner.
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1009
        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
  1010
    ] ifFalse:[
3628
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1011
        ns := Smalltalk.
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1012
        name := self name
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1013
    ].
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1014
3628
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1015
    Class classRedefinitionSignal answer:#keep do:[
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1016
        Class nameSpaceQuerySignal answer:ns
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1017
        do:[
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1018
            aClass 
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1019
                perform:(self definitionSelector) 
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1020
                withArguments:(Array with:name 
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1021
                               with:(self instanceVariableString) 
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1022
                               with:(self classVariableString)
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1023
                               with:'' "/ pool 
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1024
                               with:(self category)).
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1025
        ]
2054
1601ad49cf59 care for nameSpace and owning class when changing the superClass.
Claus Gittinger <cg@exept.de>
parents: 2053
diff changeset
  1026
    ]
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  1027
3628
5b58b3b8644a auto-keep package - when changing superclass
Claus Gittinger <cg@exept.de>
parents: 3623
diff changeset
  1028
    "Modified: / 20.6.1998 / 18:17:37 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1029
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1030
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1031
!Behavior methodsFor:'autoload check'!
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
autoload
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1034
    "force autoloading - do nothing here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1035
     redefined in Autoload; see comment there"
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1038
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1039
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1040
isLoaded
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1041
    "return true, if the class has been loaded; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1042
     redefined in Autoload; see comment there"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1043
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1044
    ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1045
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1046
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1047
!Behavior methodsFor:'binary storage'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1048
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1049
binaryDefinitionFrom:stream manager:manager
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1050
    "sent during a binary read by the input manager.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1051
     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
  1052
     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
  1053
     return the new object."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1054
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1055
    |obj t
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1056
     basicSize "{ Class: SmallInteger }" |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1057
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1058
    self isPointers ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1059
	"/
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1060
	"/ inst size not needed - if you uncomment the line below,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1061
	"/ also uncomment the corresponding line in
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1062
	"/ Object>>storeBinaryDefinitionOn:manager:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1063
	"/
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1064
	"/ stream next. "skip instSize"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1065
	self isVariable ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1066
	    ^ self basicNew:(stream nextNumber:3)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1067
	].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1068
	^ self basicNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1069
    ].
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1070
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1071
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1072
     an object with bit-valued instance variables.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1073
     These are read here.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1074
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1075
    basicSize := stream nextNumber:4.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1076
    obj := self basicNew:basicSize.
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
    self isBytes ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1079
	stream nextBytes:basicSize into:obj
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1080
    ] ifFalse: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1081
	self isWords ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1082
	    1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1083
		obj basicAt:i put:(stream nextNumber:2)
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
	] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1086
	    self isLongs ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1087
		1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1088
		    obj basicAt:i put:(stream nextNumber:4)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1089
		]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1090
	    ] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1091
		self isFloats ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1092
		    "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
  1093
		    t := Float basicNew.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1094
		    1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1095
			Float readBinaryIEEESingleFrom:stream into:t.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1096
			obj basicAt:i put: t
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1097
		    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1098
		] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1099
		    self isDoubles ifTrue: [
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1100
			"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
  1101
			t := Float basicNew.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1102
			1 to:basicSize do:[:i |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1103
			    Float readBinaryIEEEDoubleFrom:stream into:t.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1104
			    obj basicAt:i put: t
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1105
			]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1106
		    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1107
		]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1108
	    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1109
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1110
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1111
    ^obj
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1112
!
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
canCloneFrom:anObject 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1115
    "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
  1116
     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
  1117
     be converted, should redefine this method to return false.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1118
     (However, conversion is never done silently in a binary load; you
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1119
      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
  1120
      request signal.)"
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
    ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1123
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1124
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1125
cloneFrom:aPrototype
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1126
    "return an instance of myself with variables initialized from
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1127
     a prototype. This is used when instances of obsolete classes are
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1128
     binary loaded and a conversion is done on the obsolete object. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1129
     UserClasses may redefine this for better conversions."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1130
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1131
    |newInst indexed myInfo otherInfo varIndexAssoc|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1132
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1133
    indexed := false.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1134
    aPrototype class isVariable ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1135
	self isVariable ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1136
	    indexed := true.
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
	"otherwise, these are lost ..."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1139
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1140
    indexed ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1141
	newInst := self basicNew:aPrototype basicSize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1142
    ] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1143
	newInst := self basicNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1144
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1145
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1146
    myInfo := self instanceVariableOffsets.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1147
    otherInfo := aPrototype class instanceVariableOffsets.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1148
    myInfo keysAndValuesDo:[:name :index |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1149
	varIndexAssoc := otherInfo at:name ifAbsent:[].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1150
	varIndexAssoc notNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1151
	    newInst instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1152
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1153
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1154
    indexed ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1155
	1 to:aPrototype basicSize do:[:index |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1156
	    newInst basicAt:index put:(aPrototype basicAt:index)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1157
	].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1158
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1159
    ^ newInst
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
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1162
     Class withoutUpdatingChangesDo:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1163
	 Point subclass:#Point3D
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1164
	   instanceVariableNames:'z'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1165
	   classVariableNames:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1166
	   poolDictionaries:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1167
	   category:'testing'.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1168
	 (Point3D cloneFrom:1@2) inspect.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1169
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1170
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1171
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1172
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1173
     Class withoutUpdatingChangesDo:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1174
	 Point variableSubclass:#Point3D
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1175
	   instanceVariableNames:'z'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1176
	   classVariableNames:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1177
	   poolDictionaries:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1178
	   category:'testing'.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1179
	 (Point3D cloneFrom:#(1 2 3)) inspect.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1180
     ]
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
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1184
     |someObject|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1185
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1186
     Class withoutUpdatingChangesDo:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1187
	 Object subclass:#TestClass1 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1188
	   instanceVariableNames:'foo bar'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1189
	   classVariableNames:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1190
	   poolDictionaries:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1191
	   category:'testing'.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1192
	 someObject := TestClass1 new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1193
	 someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1194
	 Object subclass:#TestClass2 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1195
	   instanceVariableNames:'bar foo'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1196
	   classVariableNames:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1197
	   poolDictionaries:''
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1198
	   category:'testing'.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1199
	 (TestClass2 cloneFrom:someObject) inspect.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1200
     ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1201
    "
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
readBinaryFrom:aStream
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1205
    "read an objects binary representation from the argument,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1206
     aStream and return it. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1207
     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
  1208
     To get any object, use 'Object readBinaryFrom:...',
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1209
     To get any number, use 'Number readBinaryFrom:...' and so on.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1210
     This is the reverse operation to 'storeBinaryOn:'. "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1211
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1212
    ^ self readBinaryFrom:aStream onError:[self error:('expected ' , self name)]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1213
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1214
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1215
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1216
     s := WriteStream on:(ByteArray new).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1217
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1218
     Object readBinaryFrom:(ReadStream on:s contents)  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1219
    "
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
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1222
     s := 'testFile' asFilename writeStream binary.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1223
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1224
     'hello world' storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1225
     s close.
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
     s := 'testFile' asFilename readStream binary.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1228
     Transcript showCR:(Object readBinaryFrom:s).
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1229
     Transcript showCR:(Object readBinaryFrom:s).
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1230
     s close.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1231
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1232
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1233
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1234
readBinaryFrom:aStream onError:exceptionBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1235
    "read an objects binary representation from the argument,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1236
     aStream and return it. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1237
     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
  1238
     the exceptionBlock is returned.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1239
     To get any object, use 'Object readBinaryFrom:...',
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1240
     To get any number, use 'Number readBinaryFrom:...' and so on.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1241
     This is the reverse operation to 'storeBinaryOn:'. "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1242
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1243
    |newObject|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1244
3069
9a25834a3ef7 tuned binaryStorage
Claus Gittinger <cg@exept.de>
parents: 3053
diff changeset
  1245
    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
  1246
    (self ~~ Object
b46ca5e3f1ec allow readBinaryFrom ... to return a nonObject, if sent to
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1247
     and:[(newObject isKindOf:self) not]) ifTrue:[^ exceptionBlock value].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1248
    ^ newObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1249
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1250
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1251
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1252
     s := WriteStream on:(ByteArray new).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1253
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1254
     Object readBinaryFrom:(ReadStream on:s contents) onError:['oops'] 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1255
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1256
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1257
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1258
     s := WriteStream on:(ByteArray new).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1259
     #[1 2 3 4] storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1260
     Array readBinaryFrom:(ReadStream on:s contents)  onError:['oops']  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1261
    "
1834
b46ca5e3f1ec allow readBinaryFrom ... to return a nonObject, if sent to
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1262
3069
9a25834a3ef7 tuned binaryStorage
Claus Gittinger <cg@exept.de>
parents: 3053
diff changeset
  1263
    "Modified: / 1.11.1997 / 16:53:36 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1264
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1265
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1266
storeBinaryDefinitionOn: stream manager: manager
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1267
    "binary store of a classes definition.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1268
     Classes will store the name only and restore by looking for
1259
8c62958114ad commentary
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
  1269
     that name in the Smalltalk dictionary.
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1270
     This is an internal interface for the binary storage mechanism."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1271
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1272
    | myName |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1273
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1274
    myName := self name.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1275
    stream nextNumber:4 put:self signature.
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1276
    stream nextNumber:2 put:0.              "/ no instVarNames string here
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1277
    stream nextNumber:2 put:myName size.
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1278
    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
  1279
"/    myName do:[:c| 
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1280
"/        stream nextPut:c asciiValue
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1281
"/    ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1282
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1283
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1284
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1285
     s := WriteStream on:ByteArray new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1286
     #(1 2 3 4) storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1287
     Object readBinaryFrom:(ReadStream on:s contents)  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1288
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1289
     |s|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1290
     s := WriteStream on:ByteArray new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1291
     Rectangle storeBinaryOn:s.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1292
     Object readBinaryFrom:(ReadStream on:s contents)  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1293
    "
1259
8c62958114ad commentary
Claus Gittinger <cg@exept.de>
parents: 1192
diff changeset
  1294
2463
b0937b570306 save strings in one write (binary storage)
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1295
    "Modified: 19.3.1997 / 19:49:59 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1296
! !
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
!Behavior methodsFor:'compiler interface'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1299
1328
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1300
browserClass
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1301
    "return the browser to use for this class - 
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1302
     this can be redefined in special classes, to get different browsers"
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1303
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1304
    ^ SystemBrowser
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1305
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1306
    "Created: 3.5.1996 / 12:36:40 / cg"
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1307
!
04a3de9b2566 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  1308
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1309
compiler
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1310
    "return the compiler to use for this class.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1311
     OBSOLETE: This is the old ST/X interface, kept for migration. 
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1312
               Dont use it - it will vanish."
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1313
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1314
    self obsoleteMethodWarning:'use #compilerClass'.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1315
    ^ self compilerClass
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1316
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1317
    "Modified: 31.7.1997 / 23:04:33 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1318
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1319
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1320
compilerClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1321
    "return the compiler to use for this class - 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1322
     this can be redefined in special classes, to get classes with
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1323
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1324
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1325
    ^ Compiler
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1328
evaluatorClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1329
    "return the compiler to use for expression evaluation for this class - 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1330
     this can be redefined in special classes, to get classes with
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1331
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1332
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1333
    ^ Compiler
2569
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1334
!
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1335
3411
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1336
formatterClass
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1337
    "return the parser to use for farmatting (prettyPrinting) this class - 
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1338
     this can be redefined in special classes, to get classes with
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1339
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1340
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1341
    ^ Parser
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1342
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1343
    "Created: / 27.4.1998 / 15:33:34 / cg"
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1344
!
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1345
2569
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1346
parserClass
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1347
    "return the parser to use for parsing this class - 
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1348
     this can be redefined in special classes, to get classes with
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1349
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1350
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1351
    ^ Parser
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1352
1d527c0ea7a5 added #parserClass
Claus Gittinger <cg@exept.de>
parents: 2463
diff changeset
  1353
    "Created: 18.4.1997 / 21:02:41 / cg"
3411
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1354
!
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1355
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1356
syntaxHighlighterClass
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1357
    "return the parser to use for farmatting (prettyPrinting) this class - 
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1358
     this can be redefined in special classes, to get classes with
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1359
     Lisp, Prolog, ASN1, Basic :-) or whatever syntax."
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1360
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1361
    ^ SyntaxHighlighter
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1362
5c71b3ce77ac added queries for #formatterClass & #syntaxHighliterClass
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  1363
    "Created: / 27.4.1998 / 15:34:08 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1364
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1365
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1366
!Behavior methodsFor:'copying'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1367
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1368
deepCopy
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1369
    "return a deep copy of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1370
     - return the receiver here - time will show if this is ok"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1371
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1372
    ^ self
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1375
deepCopyUsing:aDictionary
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1376
    "return a deep copy of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1377
     - return the receiver here - time will show if this is ok"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1378
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1379
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1380
!
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
simpleDeepCopy
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1383
    "return a deep copy of the receiver
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1384
     - return the receiver here - time will show if this is ok"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1385
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1386
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1387
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1388
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1389
!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
  1390
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1391
addChangeRecordForClassRemove:aClassName
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1392
     "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
  1393
      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
  1394
      (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
  1395
      (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
  1396
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1397
    "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
  1398
    "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
  1399
! !
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1400
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1401
!Behavior methodsFor:'dummy fileOut'!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1402
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1403
fileOutDefinitionOn:aStream
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1404
    "dummy fileOut defined here.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1405
     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
  1406
     (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
  1407
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1408
    ^ self
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1409
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1410
    "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
  1411
! !
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  1412
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1413
!Behavior methodsFor:'enumerating'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1414
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1415
allDerivedInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1416
    "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
  1417
     This method is going to be removed for protocol compatibility with
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1418
     other STs; use allSubInstancesDo:"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1419
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1420
    self obsoleteMethodWarning:'use #allSubInstancesDo:'.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1421
    self allSubInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1422
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1423
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1424
     StandardSystemView allDerivedInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1425
    "
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1426
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  1427
    "Modified: 31.7.1997 / 23:05:04 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1428
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1429
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1430
allInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1431
    "evaluate aBlock for all of my instances"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1432
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1433
"/    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1434
"/        (anObject class == self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1435
"/            aBlock value:anObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1436
"/        ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1437
"/    ]
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
    ObjectMemory allInstancesOf:self do:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1440
	aBlock value:anObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1441
    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1442
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1443
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1444
     StandardSystemView allInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1445
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1446
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1447
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1448
allSubInstancesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1449
    "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
  1450
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1451
    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1452
	(anObject isKindOf:self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1453
	    aBlock value:anObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1454
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1455
    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1456
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1457
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1458
     StandardSystemView allSubInstancesDo:[:v | Transcript showCR:(v name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1459
    "
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
allSubclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1463
    "evaluate aBlock for all of my subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1464
     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
  1465
     Warning:
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1466
        This will only enumerate globally known classes - for anonymous
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1467
        behaviors, you have to walk over all instances of Behavior."
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1468
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1469
    self isMeta ifTrue:[
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1470
        "/ metaclasses are not found via Smalltalk allBehaviorsDo:
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1471
        "/ here, walk over classes and enumerate corresponding metas.
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1472
        self soleInstance allSubclassesDo:[:aSubClass |
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1473
            aBlock value:(aSubClass class)
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1474
        ].
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1475
    ] ifFalse:[
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1476
        Smalltalk allBehaviorsDo:[:aClass |
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1477
            (aClass isSubclassOf:self) ifTrue:[
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1478
                aBlock value:aClass
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1479
            ]
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1480
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1481
    ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1482
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1483
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1484
     Collection allSubclassesDo:[:c | Transcript showCR:(c name)]
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1485
     Collection class allSubclassesDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1486
    "
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1487
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1488
    "Modified: / 25.10.1997 / 21:17:13 / cg"
620
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1491
allSubclassesInOrderDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1492
    "evaluate aBlock for all of my subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1493
     Higher level subclasses will be enumerated before the deeper ones,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1494
     so the order in which aBlock gets called is ok to fileOut classes in
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1495
     correct order for later fileIn.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1496
     This will only enumerate globally known classes - for anonymous
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1497
     behaviors, you have to walk over all instances of Behavior"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1498
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1499
    self subclassesDo:[:aClass |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1500
	aBlock value:aClass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1501
	aClass allSubclassesInOrderDo:aBlock
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
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1505
     Collection allSubclassesInOrderDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1506
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1507
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1508
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1509
allSuperclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1510
    "evaluate aBlock for all of my superclasses"
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
    |theClass|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1513
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1514
    theClass := superclass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1515
    [theClass notNil] whileTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1516
	aBlock value:theClass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1517
	theClass := theClass superclass
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1520
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1521
     String allSuperclassesDo:[:c | Transcript showCR:(c name)]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1522
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1523
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1524
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1525
selectorsAndMethodsDo:aTwoArgBlock
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1526
    methodDictionary keysAndValuesDo:aTwoArgBlock
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1527
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1528
    "Created: / 27.10.1997 / 14:09:27 / cg"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1529
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  1530
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1531
subclassesDo:aBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1532
    "evaluate the argument, aBlock for all immediate subclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1533
     This will only enumerate globally known classes - for anonymous
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1534
     behaviors, you have to walk over all instances of Behavior."
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
    |coll|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1537
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1538
    "/ use cached information (avoid class hierarchy search)
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1539
    "/ if possible
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1540
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1541
    SubclassInfo isNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1542
	Behavior subclassInfo
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
    SubclassInfo notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1545
	coll := SubclassInfo at:self ifAbsent:nil.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1546
	coll notNil ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1547
	    coll do:aBlock.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1548
	].
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1549
	^ self
620
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1552
    Smalltalk allBehaviorsDo:[:aClass |
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1553
	(aClass superclass == self) ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1554
	    aBlock value:aClass
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  1555
	]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1556
    ]
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
    "
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1559
     Collection subclassesDo:[:c | Transcript showCR:(c name)]
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1560
    "
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1561
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1562
    "Modified: 22.1.1997 / 18:44:01 / cg"
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1563
! !
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  1564
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1565
!Behavior methodsFor:'initialization'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1566
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1567
deinitialize
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1568
    "deinitialize is sent to a class before it is physically unloaded.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1569
     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
  1570
     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
  1571
     not visible to smalltalk (for example, release internal memory).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1572
     The default action here is to do nothing."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1573
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1574
    ^ self
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1575
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  1576
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1577
initialize
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1578
    "initialize is sent to a class either during startup,
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1579
     (for all statically compiled-in classes) or after a class
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1580
     has been loaded into the system (either bytecodes or machinecode).
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1581
     The default action here is to do nothing."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1582
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1583
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1584
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1585
3442
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1586
initializeWithAllPrivateClasses
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1587
    "if implemented, send #initialize to myself and any private
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1588
     class which does so.
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1589
     This is sent to a class after it
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1590
     has been loaded into the system.
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1591
     Statically compiled classes are initialized by the VM"
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1592
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1593
    (self class implements:#initialize) ifTrue:[
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1594
        self initialize.
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1595
    ].
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1596
    self privateClassesSorted do:[:aPrivateClass |
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1597
        aPrivateClass initializeWithAllPrivateClasses.
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1598
    ].
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1599
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1600
    "Created: / 13.5.1998 / 23:33:16 / cg"
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1601
    "Modified: / 13.5.1998 / 23:34:06 / cg"
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1602
!
d22afbb5864f added #initializeWithAllPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  1603
328
claus
parents: 325
diff changeset
  1604
postAutoload
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1605
    "postAutoload is sent to a class after it has been autoloaded.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1606
     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
  1607
     after a while ...
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1608
     This is NOT sent to statically compiled in or explicitely filedIn
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1609
     classes.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1610
     The default action here is to do nothing."
328
claus
parents: 325
diff changeset
  1611
claus
parents: 325
diff changeset
  1612
    ^ self
claus
parents: 325
diff changeset
  1613
!
claus
parents: 325
diff changeset
  1614
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1615
reinitialize
442
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1616
    "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
  1617
     I.e. when the system is restarted.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1618
     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
  1619
     obsolete data which may be a leftover from the previous live.
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1620
     The default action here is to do nothing."
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1621
65a11cda5e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
  1622
    ^ self
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  1623
! !
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  1624
492
fa23b14f444b renamed instance creation category
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
  1625
!Behavior methodsFor:'instance creation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1626
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1627
basicNew
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1628
    "return an instance of myself without indexed variables.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1629
     If the receiver-class has indexed instvars, the new object will have
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1630
     a basicSize of zero - 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1631
     i.e. 'aClass basicNew' is equivalent to 'aClass basicNew:0'.
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1632
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1633
     ** Do not redefine this method in any class **"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1634
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1635
%{  /* NOCONTEXT */
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1636
    REGISTER OBJ newobj;
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1637
    REGISTER char *nextPtr;
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1638
    unsigned int instsize;
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1639
    REGISTER unsigned int nInstVars;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1640
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1641
    /*
369
claus
parents: 362
diff changeset
  1642
     * the following ugly code is nothing more than a __new() followed
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1643
     * by a nilling of the new instance.
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1644
     * Unrolled for a bit more speed since this is one of the central object 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1645
     * allocation methods in the system
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1646
     */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1647
    nInstVars = __intVal(__INST(instSize));
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1648
    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1649
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1650
    newobj = (OBJ) __newNextPtr;
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1651
    nextPtr = ((char *)newobj) + instsize;
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1652
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1653
    /*
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1654
     * dont argue about the goto and the arrangement below - it saves 
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1655
     * an extra nil-compare and branch in the common case ...
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1656
     * (i.e. if no GC is needed, we fall through without a branch)
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1657
     */
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1658
    if (nextPtr < __newEndPtr) {
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1659
	_objPtr(newobj)->o_size = instsize;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1660
	/* o_allFlags(newobj) = 0;              */
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1661
	/* _objPtr(newobj)->o_space = __newSpace; */
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1662
	o_setAllFlags(newobj, __newSpace);
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1663
#ifdef __HAS_ALIGN4__
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1664
	/*
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1665
	 * if the alignment is 4, we are already sat,
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1666
	 * since a non-indexed object always has a word-aligned size.
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1667
	 */
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1668
	__newNextPtr = nextPtr;
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1669
#else
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1670
	if (instsize & (__ALIGN__-1)) {
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1671
	    __newNextPtr = (char *)newobj + (instsize & ~(__ALIGN__-1)) + __ALIGN__;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1672
	} else {
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1673
	    __newNextPtr = nextPtr;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1674
	}
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1675
#endif
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1676
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1677
ok:
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1678
	__InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  1679
	__qSTORE(newobj, self);
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1680
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1681
	if (nInstVars) {
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1682
#if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1683
	    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1684
#else
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1685
	    REGISTER OBJ *op;
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1686
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1687
	    op = __InstPtr(newobj)->i_instvars;
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1688
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1689
# if !defined(NEGATIVE_ADDRESSES)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1690
	    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1691
	     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1692
	     */
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1693
#  if defined(FAST_OBJECT_MEMSET_DOUBLES_UNROLLED)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1694
	    if (nInstVars > 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1695
		*op++ = nil;    /* for alignment */
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1696
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1697
		while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1698
		    *(double *)op = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1699
		    ((double *)op)[1] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1700
		    ((double *)op)[2] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1701
		    ((double *)op)[3] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1702
		    op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1703
		    nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1704
		}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1705
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1706
	    while (nInstVars != 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1707
		*op++ = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1708
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1709
	    }
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1710
#  else
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1711
#   if defined(FAST_OBJECT_MEMSET_LONGLONG_UNROLLED)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1712
	    if (nInstVars > 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1713
		*op++ = nil;    /* for alignment */
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1714
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1715
		while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1716
		    *(long long *)op = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1717
		    ((long long *)op)[1] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1718
		    ((long long *)op)[2] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1719
		    ((long long *)op)[3] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1720
		    op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1721
		    nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1722
		}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1723
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1724
	    while (nInstVars != 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1725
		*op++ = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1726
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1727
	    }
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1728
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1729
#   else
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1730
#    if defined(FAST_OBJECT_MEMSET_WORDS_UNROLLED)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1731
	    while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1732
		*op = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1733
		*(op+1) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1734
		*(op+2) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1735
		*(op+3) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1736
		*(op+4) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1737
		*(op+5) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1738
		*(op+6) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1739
		*(op+7) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1740
		op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1741
		nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1742
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1743
	    while (nInstVars != 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1744
		*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1745
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1746
	    }
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1747
#    else
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1748
#     if defined(FAST_MEMSET)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1749
	    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1750
#     else
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1751
	    do {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1752
		*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1753
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1754
	    } while (nInstVars != 0);
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  1755
#     endif
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1756
#    endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1757
#   endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1758
#  endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1759
# else /* nil could be ~~ 0 */
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1760
	    while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1761
		*op = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1762
		*(op+1) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1763
		*(op+2) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1764
		*(op+3) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1765
		*(op+4) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1766
		*(op+5) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1767
		*(op+6) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1768
		*(op+7) = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1769
		op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1770
		nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1771
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1772
	    while (nInstVars != 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1773
		*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1774
		nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1775
	    }
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1776
# endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1777
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1778
	}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1779
	RETURN ( newobj );
81
e02c66a7296f *** empty log message ***
claus
parents: 77
diff changeset
  1780
    }
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1781
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1782
    /*
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1783
     * the slow case - a GC will occur
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1784
     */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1785
    __PROTECT_CONTEXT__
369
claus
parents: 362
diff changeset
  1786
    newobj = __new(instsize);
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1787
    __UNPROTECT_CONTEXT__
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  1788
    if (newobj != nil) goto ok;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1789
%}
2
claus
parents: 1
diff changeset
  1790
.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1791
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1792
     memory allocation failed.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1793
     When we arrive here, there was no memory, even after
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  1794
     a garbage collect. 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  1795
     This means, that the VM wanted to get some more memory from the 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  1796
     Operatingsystem, which was not kind enough to give it.
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  1797
     Bad luck - you should increase the swap space on your machine.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1798
    "
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  1799
    ^ ObjectMemory allocationFailureSignal raise.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1800
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1801
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1802
basicNew:anInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1803
    "return an instance of myself with anInteger indexed variables.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1804
     If the receiver-class has no indexed instvars, this is only allowed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1805
     if the argument, anInteger is zero.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1806
     ** Do not redefine this method in any class **"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1807
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1808
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1809
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1810
    OBJ newobj;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1811
    unsigned INT instsize, nInstVars;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1812
    INT nindexedinstvars;
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1813
    unsigned INT flags;
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1814
#if ! defined(FAST_ARRAY_MEMSET) || defined(NEGATIVE_ADDRESSES)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1815
    REGISTER char *cp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1816
    short *sp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1817
    long *lp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1818
#endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1819
    REGISTER OBJ *op;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1820
    float *fp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1821
    double *dp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1822
249
claus
parents: 216
diff changeset
  1823
    if (__isSmallInteger(anInteger)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1824
	nindexedinstvars = __intVal(anInteger);
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1825
	if (nindexedinstvars >= 0) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1826
	    nInstVars = __intVal(__INST(instSize));
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1827
	    flags = __intVal(__INST(flags)) & ARRAYMASK;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1828
	    switch (flags) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1829
		case BYTEARRAY:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1830
		    instsize = OHDR_SIZE + nindexedinstvars;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1831
		    if (nInstVars == 0) {
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1832
			if (__CanDoQuickNew(instsize)) {	/* OBJECT ALLOCATION */
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1833
			    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1834
			     * the most common case
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1835
			     */
835
8bd6f4aa8130 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  1836
			    __qCheckedNew(newobj, instsize);
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1837
			    __InstPtr(newobj)->o_class = self;
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1838
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
359
claus
parents: 357
diff changeset
  1839
			    nInstVars = nindexedinstvars >> 2;
claus
parents: 357
diff changeset
  1840
			    if (nindexedinstvars & 3) nInstVars++;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1841
			    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
357
claus
parents: 356
diff changeset
  1842
#else
claus
parents: 356
diff changeset
  1843
# if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1844
			    memset(__InstPtr(newobj)->i_instvars, 0, nindexedinstvars);
357
claus
parents: 356
diff changeset
  1845
# else
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1846
			    cp = (char *)__InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1847
			    while (nindexedinstvars >= sizeof(long)) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1848
				*(long *)cp = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1849
				cp += sizeof(long);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1850
				nindexedinstvars -= sizeof(long);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1851
			    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1852
			    while (nindexedinstvars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1853
				*cp++ = '\0';
357
claus
parents: 356
diff changeset
  1854
# endif
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1855
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1856
			    RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1857
			}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1858
		    } else {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1859
			instsize += __OBJS2BYTES__(nInstVars);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1860
		    }
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1861
		    __PROTECT_CONTEXT__
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1862
		    __qNew(newobj, instsize);	/* OBJECT ALLOCATION */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1863
		    __UNPROTECT_CONTEXT__
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1864
		    if (newobj == nil) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1865
			break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1866
		    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1867
		    __InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  1868
		    __qSTORE(newobj, self);
claus
parents: 362
diff changeset
  1869
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1870
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
357
claus
parents: 356
diff changeset
  1871
		    nInstVars = (instsize-OHDR_SIZE) >> 2;
claus
parents: 356
diff changeset
  1872
		    if (instsize & 3) nInstVars++;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1873
		    memset4(__InstPtr(newobj)->i_instvars, 0, nInstVars);
357
claus
parents: 356
diff changeset
  1874
#else
claus
parents: 356
diff changeset
  1875
# if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1876
		    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1877
		     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1878
		     */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1879
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize-OHDR_SIZE);
357
claus
parents: 356
diff changeset
  1880
# else
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1881
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1882
		    while (nInstVars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1883
			*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1884
		    cp = (char *)op;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1885
		    while (nindexedinstvars >= sizeof(long)) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1886
			*(long *)cp = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1887
			cp += sizeof(long);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1888
			nindexedinstvars -= sizeof(long);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1889
		    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1890
		    while (nindexedinstvars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1891
			*cp++ = '\0';
357
claus
parents: 356
diff changeset
  1892
# endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1893
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1894
		    RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1895
		    break;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1896
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1897
		case WORDARRAY:
1514
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1898
		case SWORDARRAY:
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1899
		    instsize = OHDR_SIZE + 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1900
			       __OBJS2BYTES__(nInstVars) + 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1901
			       nindexedinstvars * sizeof(short);
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1902
		    __PROTECT_CONTEXT__
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1903
		    __qNew(newobj, instsize);	/* OBJECT ALLOCATION */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1904
		    __UNPROTECT_CONTEXT__
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1905
		    if (newobj == nil) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1906
			break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1907
		    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1908
		    __InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  1909
		    __qSTORE(newobj, self);
claus
parents: 362
diff changeset
  1910
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1911
#if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1912
		    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1913
		     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1914
		     */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1915
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1916
#else
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1917
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1918
		    while (nInstVars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1919
			*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1920
		    sp = (short *)op;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1921
		    while (nindexedinstvars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1922
			*sp++ = 0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1923
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1924
		    RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1925
		    break;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1926
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1927
	       case LONGARRAY:
1514
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1928
	       case SLONGARRAY:
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1929
		    instsize = OHDR_SIZE + 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1930
			       __OBJS2BYTES__(nInstVars) + 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1931
			       nindexedinstvars * sizeof(long);
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1932
		    __PROTECT_CONTEXT__
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1933
		    __qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1934
		    __UNPROTECT_CONTEXT__
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1935
		    if (newobj == nil) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1936
			break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1937
		    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1938
		    __InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  1939
		    __qSTORE(newobj, self);
claus
parents: 362
diff changeset
  1940
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  1941
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1942
		    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1943
		     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1944
		     */
2865
4d09015b12cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1945
		    {
4d09015b12cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1946
			int n4 = nInstVars + nindexedinstvars;
4d09015b12cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1947
4d09015b12cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1948
		        memset4(__InstPtr(newobj)->i_instvars, 0, n4);
4d09015b12cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1949
		    }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1950
#else
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1951
# if defined(FAST_ARRAY_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1952
		    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1953
		     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1954
		     */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1955
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1956
# else
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1957
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1958
		    while (nInstVars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1959
			*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1960
		    lp = (long *)op;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1961
		    while (nindexedinstvars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1962
			*lp++ = 0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1963
# endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1964
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1965
		    RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1966
		    break;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1967
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1968
	       case FLOATARRAY:
325
claus
parents: 323
diff changeset
  1969
		    instsize = sizeof(struct __floatArray) + 
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1970
			       __OBJS2BYTES__(nInstVars) + 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1971
			       (nindexedinstvars - 1) * sizeof(float);
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1972
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1973
		    __PROTECT_CONTEXT__
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  1974
		    __qNew(newobj, instsize);	/* OBJECT ALLOCATION */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1975
		    __UNPROTECT_CONTEXT__
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1976
		    if (newobj == nil) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1977
			break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1978
		    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1979
		    __InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  1980
		    __qSTORE(newobj, self);
claus
parents: 362
diff changeset
  1981
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1982
		    op = __InstPtr(newobj)->i_instvars;
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1983
# if defined(mips) /* knowin that float 0.0 is all-zeros */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  1984
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1985
# else
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1986
		    while (nInstVars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1987
			*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1988
		    fp = (float *)op;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1989
		    while (nindexedinstvars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1990
			*fp++ = 0.0;
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  1991
# endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1992
		    RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1993
		    break;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1994
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1995
	       case DOUBLEARRAY:
325
claus
parents: 323
diff changeset
  1996
		    instsize = sizeof(struct __doubleArray) + 
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1997
			       __OBJS2BYTES__(nInstVars) + 
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  1998
			       (nindexedinstvars - 1) * sizeof(double);
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  1999
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2000
		    __PROTECT_CONTEXT__
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  2001
		    __qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2002
		    __UNPROTECT_CONTEXT__
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2003
		    if (newobj == nil) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2004
			break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2005
		    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2006
		    __InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  2007
		    __qSTORE(newobj, self);
claus
parents: 362
diff changeset
  2008
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2009
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2010
		    while (nInstVars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2011
			*op++ = nil;
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2012
#ifdef NEED_DOUBLE_ALIGN
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2013
		    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2014
		     * care for double alignment
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  2015
		     * add filler.
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2016
		     */
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  2017
		    if ((INT)op & (__ALIGN__-1)) {
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2018
			*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2019
		    }
54
06dbdeeed4f9 *** empty log message ***
claus
parents: 47
diff changeset
  2020
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2021
		    dp = (double *)op;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2022
		    while (nindexedinstvars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2023
			*dp++ = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2024
		    RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2025
		    break;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2026
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2027
		case WKPOINTERARRAY:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2028
		case POINTERARRAY:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2029
		    nInstVars += nindexedinstvars;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2030
		    instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2031
		    __PROTECT_CONTEXT__
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  2032
		    __qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2033
		    __UNPROTECT_CONTEXT__
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2034
		    if (newobj == nil) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2035
			break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2036
		    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2037
		    __InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  2038
		    __qSTORE(newobj, self);
claus
parents: 362
diff changeset
  2039
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2040
#if defined(memset4) && defined(FAST_ARRAY_MEMSET4) || defined(FAST_MEMSET4)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2041
		    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2042
#else
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2043
# if !defined(NEGATIVE_ADDRESSES)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2044
		    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2045
		     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2046
		     */
360
claus
parents: 359
diff changeset
  2047
#ifdef XXmips
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2048
# undef FAST_ARRAY_MEMSET_DOUBLES_UNROLLED
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2049
# undef FAST_ARRAY_MEMSET_LONGLONG_UNROLLED
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2050
/* seems to be slightly faster */
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2051
# define FAST_ARRAY_MEMSET
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2052
#endif
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2053
#ifdef sparc
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2054
# define FAST_ARRAY_MEMSET_DOUBLES_UNROLLED
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2055
#endif
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  2056
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2057
#  if defined(FAST_ARRAY_MEMSET_DOUBLES_UNROLLED)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2058
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2059
		    if (nInstVars > 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2060
			*op++ = nil;    /* for alignment */
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2061
			nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2062
			while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2063
			    *(double *)op = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2064
			    ((double *)op)[1] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2065
			    ((double *)op)[2] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2066
			    ((double *)op)[3] = 0.0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2067
			    op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2068
			    nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2069
			}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2070
		    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2071
		    while (nInstVars) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2072
			*op++ = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2073
			nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2074
		    }
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2075
#  else
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2076
#   if defined(FAST_ARRAY_MEMSET_LONGLONG_UNROLLED)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2077
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2078
		    if (nInstVars > 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2079
			*op++ = nil;    /* for alignment */
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2080
			nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2081
			while (nInstVars >= 8) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2082
			    *(long long *)op = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2083
			    ((long long *)op)[1] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2084
			    ((long long *)op)[2] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2085
			    ((long long *)op)[3] = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2086
			    op += 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2087
			    nInstVars -= 8;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2088
			}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2089
		    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2090
		    while (nInstVars) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2091
			*op++ = 0;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2092
			nInstVars--;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2093
		    }
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2094
#   else
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2095
#    if defined(FAST_ARRAY_MEMSET)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2096
		    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2097
#    else
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2098
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2099
		    while (nInstVars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2100
			*op++ = nil;
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2101
#    endif
82
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2102
#   endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2103
#  endif
0147b4f725ae *** empty log message ***
claus
parents: 81
diff changeset
  2104
# else
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2105
		    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2106
		    while (nInstVars--)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2107
			*op++ = nil;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2108
# endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2109
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2110
		    RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2111
		    break;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2112
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2113
		default:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2114
		    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2115
		     * new:n for non-variable classes only allowed if
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2116
		     * n == 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2117
		     */
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2118
		    if (nindexedinstvars == 0) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2119
			instsize = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2120
			__PROTECT_CONTEXT__
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  2121
			__qAlignedNew(newobj, instsize);	/* OBJECT ALLOCATION */
834
c68ed1088b42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2122
			__UNPROTECT_CONTEXT__
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2123
			if (newobj == nil) {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2124
			    break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2125
			}
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2126
			__InstPtr(newobj)->o_class = self;
369
claus
parents: 362
diff changeset
  2127
			__qSTORE(newobj, self);
claus
parents: 362
diff changeset
  2128
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2129
			if (nInstVars) {
788
e80f1c42b87b dont use memset4 if its undefined
Claus Gittinger <cg@exept.de>
parents: 759
diff changeset
  2130
#if defined(memset4) && defined(FAST_OBJECT_MEMSET4) || defined(FAST_MEMSET4)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2131
			    memset4(__InstPtr(newobj)->i_instvars, nil, nInstVars);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2132
#else
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2133
# if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2134
			    /*
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2135
			     * knowing that nil is 0
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2136
			     */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2137
			    memset(__InstPtr(newobj)->i_instvars, 0, instsize - OHDR_SIZE);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2138
# else
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  2139
			    op = __InstPtr(newobj)->i_instvars;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2140
			    do {
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2141
				*op++ = nil;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2142
			    } while (--nInstVars);
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2143
# endif
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2144
#endif
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2145
			}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2146
			RETURN ( newobj );
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2147
		    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2148
		    break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2149
	    }
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2150
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2151
    }
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2152
%}.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2153
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2154
     arrive here if something went wrong ...
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2155
     figure out what it was
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2156
    "
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2157
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2158
    (anInteger isMemberOf:SmallInteger) ifFalse:[
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2159
	"
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2160
	 the argument is either not an integer,
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2161
	 or a LargeInteger (which means that its definitely too big)
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2162
	"
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2163
	self error:'argument to new: must be Integer'.
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2164
	^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2165
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2166
    (anInteger < 0) ifTrue:[
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2167
	"
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2168
	 the argument is negative,
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2169
	"
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2170
	self error:'bad (negative) argument to new:'.
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2171
	^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2172
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2173
    self isVariable ifFalse:[
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2174
	"
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2175
	 this class does not have any indexed instance variables
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2176
	"
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2177
	self error:'class has no indexed instvars - cannot create with new:'.
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2178
	^ nil
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2179
    ].
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2180
    "
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2181
     memory allocation failed.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2182
     When we arrive here, there was no memory, even after
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2183
     a garbage collect. 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2184
     This means, that the VM wanted to get some more memory from the 
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2185
     Operatingsystem, which was not kind enough to give it.
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
  2186
     Bad luck - you should increase the swap space on your machine.
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2187
    "
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  2188
    ^ ObjectMemory allocationFailureSignal raise.
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2189
!
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2190
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2191
decodeFromLiteralArray:anArray
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2192
    "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
  2193
3237
5c3d09b9239d use #new instead of #basicNew when decoding from a literal array;
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  2194
    ^ self new fromLiteralArrayEncoding:anArray.
2370
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2195
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2196
    "
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2197
     Rectangle
3237
5c3d09b9239d use #new instead of #basicNew when decoding from a literal array;
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  2198
        decodeFromLiteralArray:#(Rectangle 10 10 100 100)
2370
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2199
    "
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2200
3237
5c3d09b9239d use #new instead of #basicNew when decoding from a literal array;
Claus Gittinger <cg@exept.de>
parents: 3141
diff changeset
  2201
    "Modified: / 28.1.1998 / 17:40:30 / cg"
2370
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2202
!
694ebbc71f04 added #decodeFromLiteralArray: - ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
  2203
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2204
new
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2205
    "return an instance of myself without indexed variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2206
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2207
    ^ self basicNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2208
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2209
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2210
new:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2211
    "return an instance of myself with anInteger indexed variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2212
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2213
    ^ self basicNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2214
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2215
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2216
niceBasicNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2217
    "same as basicNew:anInteger, but tries to avoid long pauses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2218
     due to garbage collection. This method checks to see if
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2219
     allocation is possible without a pause, and does a background
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2220
     incremental garbage collect first if there is not enough memory
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2221
     available at the moment for fast allocation. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2222
     This is useful in low-priority background processes which like to 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2223
     avoid disturbing any higher priority foreground process while allocating
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2224
     big amounts of memory. Of course, using this method only makes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2225
     sense for big or huge objects (say > 200k).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2226
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2227
     EXPERIMENTAL: this is a non-standard interface and should only 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2228
     be used for special applications. There is no guarantee, that this
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2229
     method will be available in future ST/X releases."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2230
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2231
    |size|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2232
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2233
    size := self sizeOfInst:anInteger.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2234
    (ObjectMemory checkForFastNew:size) ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2235
	"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2236
	 incrementally collect garbage
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2237
	"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2238
	ObjectMemory incrementalGC.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2239
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2240
    ^ self basicNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2241
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2242
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2243
readFrom:aStream
43
00ca34676cbf *** empty log message ***
claus
parents: 25
diff changeset
  2244
    "read an objects printed representation from the argument, aStream 
00ca34676cbf *** empty log message ***
claus
parents: 25
diff changeset
  2245
     and return it. 
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  2246
     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
  2247
     This is the reverse operation to 'storeOn:'.
43
00ca34676cbf *** empty log message ***
claus
parents: 25
diff changeset
  2248
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  2249
     WARNING: storeOn: does not handle circular references and multiple 
3480
aa538a7438ba conversion error string
Claus Gittinger <cg@exept.de>
parents: 3442
diff changeset
  2250
              references to the same object.
aa538a7438ba conversion error string
Claus Gittinger <cg@exept.de>
parents: 3442
diff changeset
  2251
              Use #storeBinary:/readBinaryFrom: for this."
aa538a7438ba conversion error string
Claus Gittinger <cg@exept.de>
parents: 3442
diff changeset
  2252
aa538a7438ba conversion error string
Claus Gittinger <cg@exept.de>
parents: 3442
diff changeset
  2253
    ^ self readFrom:aStream onError:[self error:'conversion error for: ' , self name]
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2254
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2255
    "
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2256
     |s|
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2257
     s := WriteStream on:String new.
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2258
     #(1 2 3 4) storeOn:s.
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2259
     Object readFrom:(ReadStream on:s contents)  
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2260
    "
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2261
!
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2262
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2263
readFrom:aStream onError:exceptionBlock
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2264
    "read an objects printed representation from the argument, aStream 
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2265
     and return it (i.e. the stream should contain some representation of
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2266
     the object which was created using #storeOn:). 
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2267
     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
  2268
     exceptionBlock is returned.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2269
     To get any object, use 'Object readFrom:...',
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2270
     To get any number, use 'Number readFrom:...' and so on.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2271
     This is the reverse operation to 'storeOn:'.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2272
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2273
     WARNING: storeOn: does not handle circular references and multiple 
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2274
	      references to the same object.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2275
	      Use #storeBinary:/readBinaryFrom: for this."
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2276
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2277
    |newObject|
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2278
340
claus
parents: 331
diff changeset
  2279
    ErrorSignal handle:[:ex |
claus
parents: 331
diff changeset
  2280
	ex return
claus
parents: 331
diff changeset
  2281
    ] do:[
345
claus
parents: 343
diff changeset
  2282
	newObject := self evaluatorClass evaluate:aStream.
340
claus
parents: 331
diff changeset
  2283
    ].
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2284
    (newObject isKindOf:self) ifFalse:[^ exceptionBlock value].
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2285
    ^ newObject
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2286
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2287
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2288
     |s|
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2289
     s := WriteStream on:String new.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2290
     #(1 2 3 4) storeOn:s.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  2291
     Transcript showCR:(
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  2292
	Array readFrom:(ReadStream on:s contents) onError:'not an Array'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  2293
     )
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2294
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2295
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2296
     |s|
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2297
     s := WriteStream on:String new.
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2298
     #[1 2 3 4] storeOn:s.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  2299
     Transcript showCR:(
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  2300
	 Array readFrom:(ReadStream on:s contents) onError:'not an Array'
345
claus
parents: 343
diff changeset
  2301
     )
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2302
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2303
!
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2304
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2305
readFromString:aString
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2306
    "create an object from its printed representation.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2307
     For most classes, the string is expected to be in a format created by
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2308
     storeOn: or storeString; however, some (Time, Date) expect a user
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2309
     readable string here.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2310
     See comments in Behavior>>readFromString:onError:,
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2311
     Behavior>>readFrom: and Behavior>>readFrom:onError:"
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  2312
345
claus
parents: 343
diff changeset
  2313
    ^ self readFromString:aString onError:[self error:'expected: ' , self name]
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2314
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2315
    "
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2316
     Integer readFromString:'12345678901234567890' 
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2317
     Point readFromString:'1@2'  
345
claus
parents: 343
diff changeset
  2318
     Point readFromString:'1'  
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2319
    "
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2320
!
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2321
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2322
readFromString:aString onError:exceptionBlock
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2323
    "create an object from its printed representation.
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2324
     Here, the string is expected to be in a format created by
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2325
     storeOn: or storeString; however, some classes (Time, Date) may redefine
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2326
     it to expect a user readable string here.
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2327
     See comments in Behavior>>readFrom: and Behavior>>readFrom:onError:"
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2328
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2329
    ^ self readFrom:(ReadStream on:aString) onError:exceptionBlock
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2330
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2331
    "
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2332
     Integer readFromString:'12345678901234567890' 
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2333
     Integer readFromString:'abc' 
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2334
     Integer readFromString:'abc' onError:0
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2335
     Point readFromString:'1@2'  
345
claus
parents: 343
diff changeset
  2336
     Point readFromString:'0'   
275
a76029ddaa98 *** empty log message ***
claus
parents: 249
diff changeset
  2337
     Point readFromString:'0' onError:[0@0]  
198
d0d0e3910c98 added readFrom:onError: / binaryReadFrom:onError:
claus
parents: 165
diff changeset
  2338
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2339
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2340
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2341
uninitializedNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2342
    "create an instance of myself with uninitialized contents.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2343
     For all classes except ByteArray, this is the same as #basicNew."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2344
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2345
    ^ self basicNew
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2346
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2347
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2348
uninitializedNew:anInteger
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2349
    "create an instance of myself with uninitialized contents.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2350
     For all classes except ByteArray, this is the same as #basicNew:."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2351
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2352
    ^ self basicNew:anInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2353
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2354
3619
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2355
!Behavior methodsFor:'misc'!
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2356
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2357
sourceCodeTemplate
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2358
    ^ 'messageSelector and arguments
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2359
    "method comment - purpose of message"
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2360
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2361
    |temporaries|
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2362
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2363
    statements
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2364
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2365
    "
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2366
     example uses
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2367
    "
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2368
'
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2369
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2370
    "Created: / 19.6.1998 / 02:14:02 / cg"
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2371
! !
85b70481bc54 added #sourceCodeTemplate
Claus Gittinger <cg@exept.de>
parents: 3480
diff changeset
  2372
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2373
!Behavior methodsFor:'private accessing'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2374
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2375
flags:aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2376
    "set the flags.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2377
     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
  2378
     and no change record written here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2379
     Do NOT use it."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2380
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2381
    flags := aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2382
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2383
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2384
instSize:aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2385
    "set the instance size.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2386
     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
  2387
     and no change record written here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2388
     Do NOT use it."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2389
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2390
    instSize := aNumber
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2391
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2392
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2393
primAddSelector:newSelector withMethod:newMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2394
    "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
  2395
     the 1st argument to the methodDictionary. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2396
     Does NOT flush any caches, does NOT write a change record.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2397
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2398
     Do not use this in normal situations, strange behavior will be
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2399
     the consequence.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2400
     I.e. executing obsolete methods, since the old method will still 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2401
     be executed out of the caches."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2402
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2403
    |dict|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2404
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2405
    (newSelector isMemberOf:Symbol) ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2406
	self error:'invalid selector'. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2407
	^ false
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2408
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2409
    newMethod isNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2410
	self error:'invalid method'. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2411
	^ false
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2412
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2413
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2414
    dict := self methodDictionary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2415
    self setMethodDictionary:(dict at:newSelector putOrAppend:newMethod).
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2416
    ^ true.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2417
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2418
    "Modified: 7.6.1996 / 14:48:45 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2419
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2420
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2421
setMethodDictionary:dict
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2422
    "set the receivers method dictionary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2423
     Convert dict to a MethodDictionary if necessary.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2424
     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
  2425
     after this call"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2426
2228
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2427
    "/ since the only thing the VM is prepared to deal with are
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2428
    "/ proper methodDictionaries (it cannot do another message send, to
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2429
    "/ find any methods ...), we convert it here if required.
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2430
    "/ No other classes instances are allowed.
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2431
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  2432
    dict class ~~ MethodDictionary ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2433
	methodDictionary := MethodDictionary withAll:dict.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2434
	methodDictionary isNil ifTrue:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2435
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2436
	    "/ refuse to do this 
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2437
	    "/ (can only happen in case of memory allocation trouble,
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2438
	    "/  where the allocation failed and some exception handler returned
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2439
	    "/  nil ...)
2228
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2440
        
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2441
	    self halt:'cannot set methodDictionary to nil'.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2442
	    ^ self.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2443
	]
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  2444
    ] ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2445
	methodDictionary := dict.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2446
    ].
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  2447
    ^ self.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2448
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2449
    "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
  2450
    "Modified: 12.6.1996 / 13:58:55 / stefan"
2228
ddcc662bd9b1 commentary
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2451
    "Modified: 22.1.1997 / 21:10:48 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2452
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2453
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2454
setOtherSuperclasses:anArrayOfClasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2455
    "EXPERIMENTAL: set the other superclasses of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2456
     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
  2457
     and no change record written here; 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2458
     Do NOT use it."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2459
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2460
    SubclassInfo := nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2461
    otherSuperclasses := anArrayOfClasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2462
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2463
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2464
setSuperclass:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2465
    "set the superclass of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2466
     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
  2467
     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
  2468
     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
  2469
     be correct, since no caches are flushed.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2470
     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
  2471
2438
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2472
    |info|
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2473
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2474
    SubclassInfo notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2475
	"/ flush/update the subclass information
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2476
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2477
	"/ 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
  2478
	(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
  2479
	    info add:self
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2480
	] ifFalse:[
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2481
	    SubclassInfo := nil.  "/ flush it
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2482
	]
2438
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2483
    ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2484
    superclass := aClass
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2485
2438
52ca8e0904a7 try to preserve subclassInfo in #setSuperClass.
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  2486
    "Modified: 3.3.1997 / 13:27:00 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2487
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2488
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2489
setSuperclass:aClass methodDictionary:d instSize:i flags:f
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2490
    "set some inst vars. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2491
     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
  2492
     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
  2493
     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
  2494
     be correct, since no caches are flushed.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2495
     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
  2496
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2497
    self setSuperclass:aClass.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2498
    self setMethodDictionary:d.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2499
    instSize := i.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2500
    flags := f
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2501
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2502
    "Created: 7.6.1996 / 08:41:20 / stefan"
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2503
    "Modified: 22.1.1997 / 18:42:12 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2504
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2505
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2506
!Behavior methodsFor:'private helpers'!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2507
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2508
addAllClassVarNamesTo:aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2509
    "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
  2510
     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
  2511
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2512
    |classvars|
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2513
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2514
    (superclass notNil) ifTrue:[
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2515
	superclass addAllClassVarNamesTo:aCollection
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2516
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2517
    (classvars := self classVariableString) notNil ifTrue:[
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2518
	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
  2519
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2520
    ^ aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2521
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2522
    "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
  2523
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2524
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2525
addAllInstVarNamesTo:aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2526
    "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
  2527
     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
  2528
     Return aCollection."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2529
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2530
    |superInsts instvars|
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2531
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2532
    (superclass notNil) ifTrue:[
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2533
	superclass addAllInstVarNamesTo:aCollection
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2534
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2535
    (instvars := self instanceVariableString) notNil ifTrue:[
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2536
	aCollection addAll:(instvars asCollectionOfWords).
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2537
    ] ifFalse:[
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2538
	"/ mhmh - either someone klduged around, or this is
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2539
	"/ a system running without sourceInfo. Generate
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2540
	"/ synthetic names.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2541
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2542
	superclass isNil ifTrue:[
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2543
	    superInsts := 0
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2544
	] ifFalse:[
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2545
	    superInsts := superclass instSize
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2546
	].
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2547
	aCollection addAll:((superInsts+1 to:self instSize) 
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2548
				collect:[:index | '* instVar' , index printString , ' *'])
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2549
    ].
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2550
    ^ aCollection
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2551
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2552
    "Modified: 30.10.1995 / 19:46:21 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2553
    "Created: 16.4.1996 / 18:03:14 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2554
! !
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2555
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2556
!Behavior methodsFor:'queries'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2557
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2558
allClassVarNames
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2559
    "return a collection of all the class variable name-strings
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2560
     this includes all superclass-class variables"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2561
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2562
    ^ self addAllClassVarNamesTo:(OrderedCollection new)
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2563
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2564
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2565
     Float allClassVarNames
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2566
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2567
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2568
    "Modified: 16.4.1996 / 18:01:00 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2569
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2570
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2571
allDerivedInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2572
    "return a collection of all instances of myself and 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2573
     instances of all subclasses of myself.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2574
     This method is going to be removed for protocol compatibility with
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2575
     other STs; use allSubInstances"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2576
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  2577
    self obsoleteMethodWarning:'use #allSubInstances'.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2578
    ^ self allSubInstances
2823
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  2579
eb6feef1dd12 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
  2580
    "Modified: 31.7.1997 / 23:04:59 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2581
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2582
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2583
allInstVarNames
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2584
    "return a collection of all the instance variable name-strings
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2585
     this includes all superclass-instance variables.
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2586
     Instvars of superclasses come first (i.e. the position matches
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2587
     the instVarAt:-index)."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2588
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2589
    ^ self addAllInstVarNamesTo:(OrderedCollection new)
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2590
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2591
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2592
     Dictionary instVarNames       
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2593
     Dictionary allInstVarNames    
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2594
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2595
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2596
    "Modified: 16.4.1996 / 18:03:55 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2597
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2598
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2599
allInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2600
    "return a collection of all my instances"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2601
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2602
    "Read the documentation on why there seem to be no
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2603
     instances of SmallInteger and UndefinedObject"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2604
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2605
    |coll|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2606
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2607
    coll := OrderedCollection new:100.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2608
    self allInstancesDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2609
	coll add:anObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2610
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2611
    ^ coll 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2612
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2613
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2614
     ScrollBar allInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2615
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2616
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2617
3620
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2618
allInstancesWeakly:doWeakly
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2619
    "return a collection of all my instances.
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2620
     If weakly is true, a weak collection is returned."
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2621
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2622
    "Read the documentation on why there seem to be no
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2623
     instances of SmallInteger and UndefinedObject"
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2624
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2625
    |coll|
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2626
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2627
    coll := self allInstances.
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2628
    doWeakly ifTrue:[
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2629
        coll := WeakArray withAll:coll
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2630
    ].
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2631
    ^ coll
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2632
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2633
    "Created: / 19.6.1998 / 02:17:20 / cg"
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2634
!
e517c8b18e90 added #allInstancesWeakly for ST-80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3619
diff changeset
  2635
2053
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2636
allSelectors
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2637
    "return a collection of all selectors understood by the receiver;
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2638
     this includes my selectors and all superclass selectors
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2639
     (i.e. the receivers full protocol)"
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2640
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2641
    superclass notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2642
	^ superclass allSelectors addAll:(self selectors); yourself.
2053
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2643
    ].
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2644
    ^ self selectors asIdentitySet
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2645
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2646
    "
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2647
     Point allSelectors
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2648
     View allSelectors
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2649
     Array allSelectors
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2650
    "
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2651
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2652
!
82cf91ad2d8f added #allSelectors
ca
parents: 2048
diff changeset
  2653
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2654
allSubInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2655
    "return a collection of all instances of myself and 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2656
     instances of all subclasses of myself."
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
    |coll|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2659
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2660
    coll := OrderedCollection new:100.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2661
    self allSubInstancesDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2662
	(anObject isKindOf:self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2663
	    coll add:anObject
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2664
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2665
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2666
    ^ coll 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2667
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2668
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2669
     View allSubInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2670
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2671
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2672
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2673
allSubclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2674
    "return a collection of all subclasses (direct AND indirect) of
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2675
     the receiver. There will be no specific order, in which entries
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2676
     are returned."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2677
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2678
    |newColl|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2679
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2680
    newColl := OrderedCollection new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2681
    self allSubclassesDo:[:aClass |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2682
	newColl add:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2683
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2684
    ^ newColl
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2685
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2686
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2687
     Collection allSubclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2688
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2689
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2690
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2691
allSubclassesInOrder
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2692
    "return a collection of all subclasses (direct AND indirect) of
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2693
     the receiver. Higher level subclasses will come before lower ones."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2694
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2695
    |newColl|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2696
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2697
    newColl := OrderedCollection new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2698
    self allSubclassesInOrderDo:[:aClass |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2699
	newColl add:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2700
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2701
    ^ newColl
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2702
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
     Collection allSubclassesInOrder
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2708
allSuperclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2709
    "return a collection of the receivers accumulated superclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2710
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2711
    |aCollection theSuperClass|
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
    theSuperClass := superclass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2714
    theSuperClass notNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2715
	aCollection := OrderedCollection new.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2716
	[theSuperClass notNil] whileTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2717
	    aCollection add:theSuperClass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2718
	    theSuperClass := theSuperClass superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2719
	]
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
    ^ aCollection
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2722
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2723
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2724
     String allSuperclasses 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2725
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2726
!
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
cachedLookupMethodFor:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2729
    "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
  2730
     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
  2731
     and all of its superclasses are searched for aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2732
     Return the method, or nil if instances do not understand aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2733
     This interface provides exactly the same information as #lookupMethodFor:,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2734
     but uses the lookup-cache in the VM for faster search. 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2735
     However, keep in mind, that doing a lookup through the cache also adds new
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2736
     entries and can thus slow down the system by polluting the cache with 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2737
     irrelevant entries. (do NOT loop over all objects calling this method).
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2738
     Does NOT (currently) handle MI"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2739
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2740
%{  /* NOCONTEXT */
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  2741
    RETURN ( __lookup(self, aSelector) );
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2744
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2745
     String cachedLookupMethodFor:#=
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2746
     String cachedLookupMethodFor:#asOrderedCollection
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2747
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2748
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2749
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2750
canBeSubclassed
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2751
    "return true, if its allowed to create subclasses of the receiver.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2752
     This method is redefined in SmallInteger and UndefinedObject, since
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2753
     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
  2754
     a class entry (you dont have to understand this :-)"
10
claus
parents: 5
diff changeset
  2755
claus
parents: 5
diff changeset
  2756
    ^ true
claus
parents: 5
diff changeset
  2757
!
claus
parents: 5
diff changeset
  2758
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2759
canUnderstand:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2760
    "return true, if the receiver or one of its superclasses implements aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2761
     (i.e. true if my instances understand aSelector)"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2762
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2763
    ^ (self lookupMethodFor:aSelector) notNil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2764
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2765
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2766
     True canUnderstand:#ifTrue:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2767
     True canUnderstand:#==
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2768
     True canUnderstand:#do:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2769
    "
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2770
!
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  2771
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2772
category
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2773
    "return the category of the class. 
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2774
     Returning nil here, since Behavior does not define a category
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2775
     (only ClassDescriptions do)."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2776
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2777
    ^ nil
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2778
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2779
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2780
     Point category                
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2781
     Behavior new category           
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2782
    "
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2783
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2784
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  2785
classPool
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  2786
    ^ IdentityDictionary new
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  2787
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  2788
    "Modified: 17.10.1997 / 12:07:29 / cg"
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  2789
!
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2894
diff changeset
  2790
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2791
classVarNames
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2792
    "return a collection of the class variable name-strings.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2793
     Returning empty here, since Behavior does not define any classVariables.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2794
     (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
  2795
     (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
  2796
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2797
    ^ #()
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2798
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2799
    "Created: 16.4.1996 / 17:57:31 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2800
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2801
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2802
classVariableString
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2803
    "return a string of the class variables names.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2804
     Returning empty here, since Behavior does not define any classVariables.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2805
     (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
  2806
     (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
  2807
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2808
    ^ ''
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2809
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2810
    "Created: 16.4.1996 / 16:28:56 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2811
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2812
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2813
comment
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2814
    "return the comment of the class. 
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2815
     Returning nil here, since Behavior does not define a category
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2816
     (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
  2817
     (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
  2818
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2819
    ^ nil
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2820
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2821
    "Modified: 16.4.1996 / 16:25:23 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2822
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  2823
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2824
commonSuperclass:aClass
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2825
    "Return the common superclass of the receiver and aClass.
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2826
     Assumes that there is a common superclass of any two classes."
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2827
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2828
    (aClass includesBehavior:self) ifTrue:[^ self].
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2829
    (self inheritsFrom:aClass) ifTrue:[^ aClass].
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2830
    ^ superclass commonSuperclass:aClass
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2831
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2832
    "
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2833
     Integer commonSuperclass:Fraction  
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2834
     SmallInteger commonSuperclass:Fraction  
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2835
     View commonSuperclass:Form  
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2836
     View commonSuperclass:Image  
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2837
    "
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2838
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2839
    "Modified: / 10.7.1998 / 02:13:04 / cg"
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2840
!
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  2841
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2842
compiledMethodAt:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2843
    "return the method for given selector aSelector or nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2844
     Only methods in the receiver - not in the superclass chain are tested."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2845
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2846
    ^ self compiledMethodAt:aSelector ifAbsent:nil
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2847
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  2848
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2849
     Object compiledMethodAt:#==
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2850
     (Object compiledMethodAt:#==) category
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  2851
    "
1088
989f0e510a32 nicer message
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  2852
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2853
    "Modified: / 7.6.1996 / 14:43:32 / stefan"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2854
    "Modified: / 27.10.1997 / 20:18:55 / cg"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2855
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2856
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2857
compiledMethodAt:aSelector ifAbsent:exceptionValue
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2858
    "return the method for given selector aSelector or the value
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2859
     of exceptionValue if not present.
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2860
     Only methods in the receiver - not in the superclass chain are tested."
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2861
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2862
    |dict|
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2863
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2864
    dict := self methodDictionary.
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2865
    dict isNil ifTrue:[
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2866
        ('Behavior [warning]: nil methodDictionary in ' , self name printString) errorPrintCR.
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2867
        ^ exceptionValue value
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2868
    ].
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2869
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2870
    ^ dict at:aSelector ifAbsent:exceptionValue
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2871
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2872
    "
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2873
     Object compiledMethodAt:#==
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2874
     (Object compiledMethodAt:#==) category
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2875
    "
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2876
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2877
    "Modified: / 7.6.1996 / 14:43:32 / stefan"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2878
    "Modified: / 10.1.1997 / 17:27:21 / cg"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2879
    "Created: / 27.10.1997 / 20:18:28 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2880
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2881
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2882
containsMethod:aMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2883
    "Return true, if the argument, aMethod is a method of myself"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2884
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2885
    |dict|
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2886
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2887
    dict := self methodDictionary. 
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2888
    dict isNil ifTrue:[^ false].  "degenerated class"
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2889
    ^ (dict keyAtValue:aMethod ifAbsent:[0]) ~~ 0
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2890
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  2891
    "Modified: 12.6.1996 / 13:33:53 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2892
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2893
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2894
definitionSelector
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2895
    "return the selector with which I was (can be) defined in my superclass"
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2896
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2897
    self isVariable ifFalse:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2898
	^ #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2899
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2900
    self isBytes ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2901
	^ #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2902
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2903
    self isLongs ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2904
	^ #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2905
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2906
    self isFloats ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2907
	^ #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2908
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2909
    self isDoubles ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2910
	^ #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2911
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2912
    self isWords ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2913
	^ #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2914
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2915
    self isSignedWords ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2916
	^ #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2917
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2918
    self isSignedLongs ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  2919
	^ #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
2436
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2920
    ].
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2921
    ^ #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:'
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2922
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2923
    "
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2924
     Object definitionSelector
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2925
     Array definitionSelector  
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2926
     ByteArray definitionSelector 
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2927
     FloatArray definitionSelector 
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2928
    "
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2929
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2930
    "Modified: 3.3.1997 / 11:50:37 / cg"
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2931
!
dbea519857e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2370
diff changeset
  2932
2713
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2933
definitionSelectorPrivate
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2934
    "return the selector with which I was (can be) defined in my superclass
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2935
     as a private class"
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2936
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2937
    self isVariable ifFalse:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2938
        ^ #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2939
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2940
    self isBytes ifTrue:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2941
        ^ #'variableByteSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2942
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2943
    self isLongs ifTrue:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2944
        ^ #'variableLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2945
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2946
    self isFloats ifTrue:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2947
        ^ #'variableFloatSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2948
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2949
    self isDoubles ifTrue:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2950
        ^ #'variableDoubleSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2951
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2952
    self isWords ifTrue:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2953
        ^ #'variableWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2954
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2955
    self isSignedWords ifTrue:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2956
        ^ #'variableSignedWordSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2957
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2958
    self isSignedLongs ifTrue:[
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2959
        ^ #'variableSignedLongSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2960
    ].
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2961
    ^ #'variableSubclass:instanceVariableNames:classVariableNames:poolDictionaries:privateIn:'
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2962
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2963
    "
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2964
     Array definitionSelector      
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2965
     Array definitionSelectorPrivate  
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2966
    "
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2967
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2968
    "Modified: 23.6.1997 / 10:45:57 / cg"
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2969
!
11cd28893629 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2699
diff changeset
  2970
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2971
derivedInstanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2972
    "return the number of instances of myself and of subclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2973
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2974
    |count|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2975
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2976
    count := 0.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2977
    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2978
	(anObject isKindOf:self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2979
	    count := count + 1
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2980
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2981
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2982
    ^ count
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2983
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  2984
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2985
     View derivedInstanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  2986
     SequenceableCollection derivedInstanceCount
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2987
     Object derivedInstanceCount
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2988
    "
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2989
!
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2990
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2991
hasDerivedInstances
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2992
    "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
  2993
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2994
    "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
  2995
     instances of SmallInteger and UndefinedObject"
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2996
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2997
    ObjectMemory allObjectsDo:[:anObject |
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2998
	(anObject isKindOf:self) ifTrue:[
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  2999
	    ^ true
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3000
	]
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3001
    ].
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3002
    ^ false
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3003
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3004
    "
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3005
     Object hasDerivedInstances         - certainly true
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3006
     SharedQueue hasDerivedInstances
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3007
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3008
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3009
2674
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3010
hasImmediateInstances
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3011
    "return true if this class has immediate instances.
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3012
     Redefined in classes which have."
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3013
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3014
    ^ false
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3015
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3016
    "Created: 3.6.1997 / 12:01:05 / cg"
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3017
!
5278213b500c added #hasImmediateInstances for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
  3018
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3019
hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3020
    "return true, if there are any instances of myself"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3021
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3022
    "Read the documentation on why there seem to be no
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3023
     instances of SmallInteger and UndefinedObject"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3024
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3025
"/    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3026
"/        (anObject class == self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3027
"/            ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3028
"/        ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3029
"/    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3030
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3031
    ObjectMemory allInstancesOf:self do:[:anObject |
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3032
	^ true
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3033
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3034
    ^ false
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3035
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3036
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3037
     Object hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3038
     SequenceableCollection hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3039
     Float hasInstances
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3040
     SmallInteger hasInstances
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3041
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3042
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3043
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3044
hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3045
    "return true, if there are any (local) methods in this class"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3046
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3047
    ^ (self methodDictionary size ~~ 0)
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3048
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  3049
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3050
     True hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3051
     True class hasMethods
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3052
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3053
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3054
    "Modified: 7.6.1996 / 15:43:09 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3055
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3056
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3057
hasMultipleSuperclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3058
    "Return true, if this class inherits from other classes 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3059
     (beside its primary superclass). 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3060
     This method is a preparation for a future multiple inheritance extension 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3061
     - currently it is not supported by the VM"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3062
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3063
    ^ otherSuperclasses notNil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3064
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3065
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3066
implements:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3067
    "return true, if the receiver implements aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3068
     (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
  3069
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3070
     Caveat:
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3071
	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
  3072
	selector table - therefore, it does not care for ignoredMethods.
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3073
	(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
  3074
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3075
     Hint:
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3076
	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
  3077
	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
  3078
	to do this."
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3079
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3080
    ^ self includesSelector:aSelector
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3081
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3082
    "
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3083
     notice: this is class protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3084
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3085
       True implements:#ifTrue:  
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3086
       True implements:#==        
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3087
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3088
     notice: this is instance protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3089
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3090
       true respondsTo:#ifTrue:   
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3091
       true respondsTo:#==        
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3092
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3093
     notice: this is class protocol
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3094
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3095
       True canUnderstand:#ifTrue: 
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3096
       True canUnderstand:#==        
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3097
    "
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3098
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3099
    "Modified: 10.2.1996 / 13:15:56 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3100
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3101
2698
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3102
includesBehavior:aClass
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3103
    "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
  3104
     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
  3105
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3106
    ^ (self == aClass) or:[self isSubclassOf:aClass]
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3107
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3108
    "
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3109
     True includesBehavior:Object  
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3110
     True includesBehavior:Boolean 
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3111
     True includesBehavior:True    
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3112
     True includesBehavior:False   
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3113
    "
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3114
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3115
    "Modified: 19.6.1997 / 18:14:35 / cg"
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3116
!
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3117
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3118
includesSelector:aSelector
1494
dab70fc90ebc Remove old methodArray and selectorArray stuff (use MethodDictionary only).
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  3119
    "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
  3120
     a method for aSelector.
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3121
     (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
  3122
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3123
     Hint:
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3124
	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
  3125
	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
  3126
	to do this."
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3127
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3128
    ^ (self methodDictionary at:aSelector ifAbsent:[0]) ~~ 0
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3129
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3130
    "
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3131
	Object includesSelector:#==
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3132
	Object includesSelector:#murks
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3133
    "
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3134
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3135
    "Modified: 7.6.1996 / 14:27:24 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3136
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3137
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3138
inheritsFrom:aClass
2698
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3139
    "return true, if the receiver inherits methods from aClass;
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3140
     i.e. if aClass is on the receivers superclass chain."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3141
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3142
    ^ self isSubclassOf:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3143
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3144
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3145
     True inheritsFrom:Object
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3146
     LinkedList inheritsFrom:Array
356
claus
parents: 345
diff changeset
  3147
    "
2698
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3148
26abb8941250 added #includesBehavior for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2674
diff changeset
  3149
    "Modified: 19.6.1997 / 18:13:21 / cg"
357
claus
parents: 356
diff changeset
  3150
!
claus
parents: 356
diff changeset
  3151
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3152
instanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3153
    "return the number of instances of myself."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3154
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3155
    "Read the documentation on why there seem to be no
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3156
     instances of SmallInteger and UndefinedObject"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3157
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3158
    |count|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3159
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3160
    count := 0.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3161
"/    ObjectMemory allObjectsDo:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3162
"/        (anObject class == self) ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3163
"/            count := count + 1
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3164
"/        ]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3165
"/    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3166
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3167
    ObjectMemory allInstancesOf:self do:[:anObject |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3168
	count := count + 1
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3169
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3170
    ^ count
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3171
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3172
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3173
     View instanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3174
     Object instanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3175
     Float instanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3176
     SequenceableCollection instanceCount
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3177
     SmallInteger instanceCount   .... mhmh - hear, hear
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
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3180
1340
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3181
instanceVariableString
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3182
    "return a string with dummy names here - typically, your
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3183
     objects are instances of Class, not Behavior."
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3184
1449
19df9cda3d87 instanceVariableString must not return instance variables of superclasses.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  3185
    |s superInsts n "{Class: SmallInteger }"|
1340
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3186
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3187
    s := ''.
1449
19df9cda3d87 instanceVariableString must not return instance variables of superclasses.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  3188
    superclass isNil ifTrue:[
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3189
	superInsts := 0
1449
19df9cda3d87 instanceVariableString must not return instance variables of superclasses.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  3190
    ] ifFalse:[
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3191
	superInsts := superclass instSize
1449
19df9cda3d87 instanceVariableString must not return instance variables of superclasses.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  3192
    ].
1340
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3193
    n := self instSize.
1449
19df9cda3d87 instanceVariableString must not return instance variables of superclasses.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  3194
    superInsts+1 to:n do:[:i |
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3195
	s size == 0 ifFalse:[s := s , ' '].
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3196
	s := s , 'instvar' , i printString
1340
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3197
    ].
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3198
    ^ s
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3199
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3200
    "
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3201
     Behavior new instanceVariableString 
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3202
    "
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3203
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3204
    "Modified: 7.5.1996 / 12:50:25 / cg"
1449
19df9cda3d87 instanceVariableString must not return instance variables of superclasses.
Stefan Vogel <sv@exept.de>
parents: 1422
diff changeset
  3205
    "Modified: 3.6.1996 / 16:03:33 / stefan"
1340
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3206
!
2e3930570745 dummy #instanceVariableString added
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  3207
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3208
isBehavior
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3209
    "return true, if the receiver is describing another objects behavior,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3210
     i.e. is a class. Defined to avoid the need to use isKindOf:"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3211
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3212
    ^ true
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
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3215
     True isBehavior   
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3216
     true isBehavior
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3217
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3218
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3219
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3220
isBits
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3221
    "return true, if instances have indexed byte or short instance variables.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3222
     Ignore long, float and double arrays, since ST-80 code using isBits are probably
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3223
     not prepared to handle them correctly."
92
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  3224
0c73b48551ac *** empty log message ***
claus
parents: 91
diff changeset
  3225
%{  /* NOCONTEXT */
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3226
642
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3227
    REGISTER int what;
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3228
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3229
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
642
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3230
    RETURN (( (what == __MASKSMALLINT(BYTEARRAY))
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3231
	     || (what == __MASKSMALLINT(WORDARRAY))) ? true : false ); 
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3232
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3233
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3234
1832
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3235
isBuiltInClass
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3236
    "return true if this class is known by the run-time-system.
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3237
     Here, false is returned as default.
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3238
     Notice, this is instance protocol, which means that any class
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3239
     other than those special ones) are non-builtIn by default."
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3240
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3241
    ^ false
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3242
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3243
    "Modified: 23.4.1996 / 15:55:52 / cg"
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3244
    "Created: 28.10.1996 / 15:10:02 / cg"
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3245
!
133fa5ec54b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1814
diff changeset
  3246
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3247
isBytes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3248
    "return true, if instances have indexed byte instance variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3249
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3250
    "this could also be defined as:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3251
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagBytes
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3252
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3253
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3254
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3255
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(BYTEARRAY)) ? true : false ); 
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3256
%}
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3257
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3258
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3259
isDoubles
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3260
    "return true, if instances have indexed double instance variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3261
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3262
    "this could also be defined as:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3263
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagDoubles
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3264
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3265
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3266
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3267
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(DOUBLEARRAY)) ? true : false ); 
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3268
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3269
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3270
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3271
isFixed
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3272
    "return true, if instances do not have indexed instance variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3273
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3274
    "this could also be defined as:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3275
	^ self isVariable not
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3276
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3277
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3278
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3279
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3280
    RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? false : true ); 
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3281
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3282
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3283
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3284
isFloats
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3285
    "return true, if instances have indexed float instance variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3286
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3287
    "this could also be defined as:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3288
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagFloats
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3289
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3290
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3291
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3292
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(FLOATARRAY)) ? true : false ); 
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3293
%}
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3294
!
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3295
642
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3296
isFloatsOrDoubles
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3297
    "return true, if instances have indexed float or double instance variables"
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3298
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3299
%{  /* NOCONTEXT */
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3300
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3301
    int what;
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3302
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3303
    what = (INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK);
642
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3304
    RETURN (( (what == __MASKSMALLINT(FLOATARRAY))
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3305
	     || (what == __MASKSMALLINT(DOUBLEARRAY))) ? true : false ); 
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3306
%}
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3307
    "
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3308
     (Object new) class isFloatsOrDoubles 
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3309
     (Point new) class isFloatsOrDoubles   
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3310
     (Array new) class isFloatsOrDoubles   
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3311
     (ByteArray new) class isFloatsOrDoubles  
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3312
     (FloatArray new) class isFloatsOrDoubles  
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3313
     (DoubleArray new) class isFloatsOrDoubles  
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3314
    "
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3315
!
dbf407bedf64 slighly faster isXXX methods; added isFloatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
  3316
2455
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3317
isJavaClass
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3318
    "return true, if the receiver is a java class.
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3319
     Java class support is not yet released to the public."
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3320
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3321
    ^ false
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3322
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3323
    "Created: 17.3.1997 / 16:23:59 / cg"
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3324
!
c39100c251f9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2438
diff changeset
  3325
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3326
isLongs
1514
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  3327
    "return true, if instances have indexed long instance variables (4 byte ints)"
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  3328
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3329
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3330
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3331
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(LONGARRAY)) ? true : false ); 
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3332
%}
356
claus
parents: 345
diff changeset
  3333
!
claus
parents: 345
diff changeset
  3334
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3335
isPointers
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3336
    "return true, if instances have pointer instance variables 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3337
     i.e. are either non-indexed or have indexed pointer variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3338
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3339
    "QUESTION: should we ignore WeakPointers ?"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3340
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3341
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3342
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3343
    REGISTER int flags;
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3344
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3345
    flags = __intVal(__INST(flags)) & ARRAYMASK;
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3346
    switch (flags) {
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3347
	default:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3348
	    /* normal objects */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3349
	    RETURN ( true );
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3350
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3351
	case BYTEARRAY:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3352
	case WORDARRAY:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3353
	case LONGARRAY:
1514
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  3354
	case SWORDARRAY:
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  3355
	case SLONGARRAY:
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3356
	case FLOATARRAY:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3357
	case DOUBLEARRAY:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3358
	    RETURN (false );
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3359
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3360
	case WKPOINTERARRAY:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3361
	    /* what about those ? */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3362
	    RETURN (true );
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
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3365
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3366
1722
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3367
isPrivate
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3368
    "return true, if the receiver is some private class"
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3369
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3370
    ^ self owningClass notNil
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3371
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3372
    "Modified: 12.10.1996 / 20:11:05 / cg"
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3373
!
7c88e91b0c6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  3374
1634
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3375
isSignedLongs
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3376
    "return true, if instances have indexed signed long instance variables (4 byte ints)"
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3377
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3378
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3379
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3380
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SLONGARRAY)) ? true : false );
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3381
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3382
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3383
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3384
isSignedWords
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3385
    "return true, if instances have indexed signed short instance variables"
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3386
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3387
%{  /* NOCONTEXT */
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3388
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3389
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(SWORDARRAY)) ? true : false );
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3390
%}
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3391
!
9ce0afb7f089 commentary
Claus Gittinger <cg@exept.de>
parents: 1514
diff changeset
  3392
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3393
isSubclassOf:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3394
    "return true, if I am a subclass of the argument, aClass"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3395
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3396
    |theClass|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3397
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3398
    theClass := superclass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3399
    [theClass notNil] whileTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3400
	(theClass == aClass) ifTrue:[^ true].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3401
%{
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3402
	if (__isBehaviorLike(theClass)) {
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3403
	    theClass = __ClassInstPtr(theClass)->c_superclass;
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3404
	} else {
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3405
	    theClass = nil;
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3406
	}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3407
%}.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3408
"/        theClass := theClass superclass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3409
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3410
    ^ false
356
claus
parents: 345
diff changeset
  3411
claus
parents: 345
diff changeset
  3412
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3413
     String isSubclassOf:Collection  
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3414
     LinkedList isSubclassOf:Array   
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3415
     1 isSubclassOf:Number              <- will fail since 1 is no class
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3416
    "     
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3417
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3418
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3419
isVariable
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3420
    "return true, if instances have indexed instance variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3421
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3422
    "this could also be defined as:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3423
	^ (flags bitAnd:(Behavior maskIndexType)) ~~ 0
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3424
     "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3425
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3426
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3427
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3428
    RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) ? true : false ); 
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3429
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3430
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3431
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3432
isWords
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3433
    "return true, if instances have indexed short instance variables"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3434
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3435
    "this could also be defined as:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3436
	^ (flags bitAnd:(Behavior maskIndexType)) == Behavior flagWords
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3437
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3438
%{  /* NOCONTEXT */
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3439
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3440
    RETURN ( (((INT)(__INST(flags)) & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(WORDARRAY)) ? true : false ); 
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3441
%}
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3442
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3443
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3444
lookupMethodFor:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3445
    "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
  3446
     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
  3447
     and all of its superclasses are searched for aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3448
     Return the method, or nil if instances do not understand aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3449
     EXPERIMENTAL: take care of multiple superclasses."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3450
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3451
    |m cls|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3452
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3453
    cls := self.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3454
    [cls notNil] whileTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3455
	m := cls compiledMethodAt:aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3456
	m notNil ifTrue:[^ m].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3457
	cls hasMultipleSuperclasses ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3458
	    cls superclasses do:[:aSuperClass |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3459
		m := aSuperClass lookupMethodFor:aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3460
		m notNil ifTrue:[^ m].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3461
	    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3462
	    ^ nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3463
	] ifFalse:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3464
	    cls := cls superclass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3465
	]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3466
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3467
    ^ nil
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3468
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3469
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3470
name
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3471
    "although behaviors have no name, we return something
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3472
     useful here - there are many places (inspectors) where
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3473
     a classes name is asked for.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3474
     Implementing this message here allows anonymous classes
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3475
     and instances of them to be inspected."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3476
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3477
    ^ 'someBehavior'
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3478
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3479
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3480
owningClass
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3481
    "return my owning class - nil if I am a public class"
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3482
1918
66fe87eddac2 commentary
Claus Gittinger <cg@exept.de>
parents: 1834
diff changeset
  3483
    "/ this information is in the metaclass ...
66fe87eddac2 commentary
Claus Gittinger <cg@exept.de>
parents: 1834
diff changeset
  3484
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3485
    ^ self class owningClass
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3486
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3487
    "Created: 15.10.1996 / 21:19:32 / cg"
1918
66fe87eddac2 commentary
Claus Gittinger <cg@exept.de>
parents: 1834
diff changeset
  3488
    "Modified: 7.11.1996 / 13:49:28 / cg"
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3489
!
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3490
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3491
selectorAtMethod:aMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3492
    "Return the selector for given method aMethod."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3493
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3494
    ^ self selectorAtMethod:aMethod ifAbsent:[nil]
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3495
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3496
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3497
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3498
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3499
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3500
     Fraction selectorAtMethod:m.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3501
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3502
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3503
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3504
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3505
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3506
     Object selectorAtMethod:m.
356
claus
parents: 345
diff changeset
  3507
    "
claus
parents: 345
diff changeset
  3508
!
claus
parents: 345
diff changeset
  3509
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3510
selectorAtMethod:aMethod ifAbsent:failBlock
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3511
    "return the selector for given method aMethod
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3512
     or the value of failBlock, if not found."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3513
1814
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3514
    |md|
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3515
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3516
    md := self methodDictionary.
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3517
    md isNil ifTrue:[
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3518
	'OOPS - nil methodDictionary' errorPrintCR.
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3519
	^ nil
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3520
    ].
fdaf647b5086 check for nil methodDict
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
  3521
    ^ md keyAtValue:aMethod ifAbsent:failBlock.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  3522
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  3523
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3524
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3525
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3526
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3527
     Object selectorAtMethod:m ifAbsent:['oops'].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3528
    "
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  3529
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3530
     |m|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3531
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3532
     m := Object compiledMethodAt:#copy.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3533
     Fraction selectorAtMethod:m ifAbsent:['oops'].
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  3534
    "
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3535
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1449
diff changeset
  3536
    "Modified: 7.6.1996 / 15:15:45 / stefan"
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  3537
!
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  3538
2699
2a47baf52313 added #sharedPools for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2698
diff changeset
  3539
sharedPools
2a47baf52313 added #sharedPools for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2698
diff changeset
  3540
    ^ #()
2a47baf52313 added #sharedPools for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2698
diff changeset
  3541
2a47baf52313 added #sharedPools for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2698
diff changeset
  3542
    "Created: 19.6.1997 / 18:19:36 / cg"
2a47baf52313 added #sharedPools for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2698
diff changeset
  3543
!
2a47baf52313 added #sharedPools for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2698
diff changeset
  3544
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3545
sizeOfInst:n
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3546
    "return the number of bytes required for an instance of
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3547
     myself with n indexed instance variables. The argument n 
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3548
     should be zero for classes without indexed instance variables.
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3549
     See Behavior>>niceNew: for an application of this."
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
  3550
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3551
    |nInstvars|
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3552
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3553
    nInstvars := self instSize.
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3554
%{
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3555
    int nBytes;
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3556
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3557
    nBytes = __intVal(nInstvars) * sizeof(OBJ) + OHDR_SIZE; 
249
claus
parents: 216
diff changeset
  3558
    if (__isSmallInteger(n)) {
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3559
	int nIndex;
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3560
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3561
	nIndex = __intVal(n);
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3562
	switch (__intVal(__INST(flags)) & ARRAYMASK) {
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3563
	    case BYTEARRAY:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3564
		nBytes += nIndex;
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  3565
		if (nBytes & (__ALIGN__ - 1)) {
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  3566
		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3567
		}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3568
		break;
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3569
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3570
	    case WORDARRAY:
1514
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  3571
	    case SWORDARRAY:
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3572
		nBytes += nIndex * sizeof(short);
2894
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  3573
		if (nBytes & (__ALIGN__ - 1)) {
344aec8ba014 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
  3574
		    nBytes = (nBytes & ~(__ALIGN__ - 1)) + __ALIGN__;
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3575
		}
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3576
		break;
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3577
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3578
	    case LONGARRAY:
1514
4ac06d3251a8 added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  3579
	    case SLONGARRAY:
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3580
		nBytes += nIndex * sizeof(long);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3581
		break;
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3582
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3583
	    case FLOATARRAY:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3584
		nBytes += nIndex * sizeof(float);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3585
		break;
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3586
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3587
	    case DOUBLEARRAY:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3588
		nBytes += nIndex * sizeof(double);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3589
		break;
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3590
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3591
	    default:
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3592
		nBytes += nIndex * sizeof(OBJ);
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3593
		break;
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3594
	}
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3595
    }
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
  3596
    RETURN (__MKSMALLINT(nBytes));
127
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3597
%}
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3598
!
6625c77d890f added sizeOfInst:
claus
parents: 92
diff changeset
  3599
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3600
sourceCodeAt:aSelector
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3601
    "return the methods source for given selector aSelector or nil.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3602
     Only methods in the receiver - not in the superclass chain are tested."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3603
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3604
    |method|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3605
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3606
    method := self compiledMethodAt:aSelector.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3607
    method isNil ifTrue:[^ nil].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3608
    ^ method source
45
0c270a39d4a2 *** empty log message ***
claus
parents: 43
diff changeset
  3609
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3610
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3611
     True sourceCodeAt:#ifTrue:
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3612
     Object sourceCodeAt:#==
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3613
     Behavior sourceCodeAt:#sourceCodeAt:
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3614
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3615
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3616
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3617
sourceCodeManager
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3618
    "return the sourceCodeManager of the class. 
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3619
     Returning nil here, since Behavior does not define any sourceCode management.
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3620
     (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
  3621
     (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
  3622
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3623
    ^ nil
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3624
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3625
    "Created: 16.4.1996 / 16:26:03 / cg"
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3626
!
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3627
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3628
subclasses
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3629
    "return a collection of the direct subclasses of the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3630
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3631
    |newColl|
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3632
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3633
    "/ use cached information (avoid class hierarchy search)
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3634
    "/ if possible
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3635
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  3636
    SubclassInfo notNil ifTrue:[
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  3637
	newColl := SubclassInfo at:self ifAbsent:nil.
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  3638
	newColl notNil ifTrue:[^ newColl asOrderedCollection]
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  3639
    ].
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  3640
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3641
    newColl := OrderedCollection new.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3642
    self subclassesDo:[:aClass |
2666
7981b615b48a Make Metaclass a subclass of ClassDescription instead of Class.
Stefan Vogel <sv@exept.de>
parents: 2569
diff changeset
  3643
	newColl add:aClass
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3644
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3645
    ^ newColl
45
0c270a39d4a2 *** empty log message ***
claus
parents: 43
diff changeset
  3646
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3647
    "
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3648
     Collection subclasses
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3649
    "
2224
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3650
7e49310cb7af commentary
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3651
    "Modified: 22.1.1997 / 18:43:52 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3652
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3653
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3654
superclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3655
    "return a collection of the receivers immediate superclasses.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3656
     This method is a preparation for a future multiple inheritance extension 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3657
     - currently it is not supported by the VM"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3658
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3659
    |a|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3660
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3661
    a := Array with:superclass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3662
    otherSuperclasses notNil ifTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3663
	^ a , otherSuperclasses
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3664
    ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3665
    ^ a
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3666
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3667
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3668
     String superclasses  
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3669
    "
2
claus
parents: 1
diff changeset
  3670
!
claus
parents: 1
diff changeset
  3671
2809
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3672
supportsMethodCategories
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3673
    "return true, if my methods are categorized.
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3674
     This is a hook for the browser to allow alien classes
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3675
     to be handled (aktually, this is not yet used)."
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3676
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3677
    ^ true
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3678
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3679
    "Created: 30.7.1997 / 14:59:08 / cg"
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3680
    "Modified: 30.7.1997 / 15:02:03 / cg"
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3681
!
b8f6c655a6db checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2801
diff changeset
  3682
2048
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3683
topOwningClass
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3684
    "return my outermost owning class - nil if I am a public class"
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3685
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3686
    "/ this information is in the metaclass ...
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3687
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3688
    ^ self class topOwningClass
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3689
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3690
    "Created: 15.10.1996 / 21:19:32 / cg"
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3691
    "Modified: 3.1.1997 / 19:18:49 / cg"
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3692
!
91eeef9b3106 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  3693
1191
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3694
wasAutoloaded
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3695
    "return true, if this class came into the system via an
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3696
     autoload; false otherwise.
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3697
     Returning false here. This allows different Behavior-like objects
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3698
     (alien classes) to be handled by the browser as well."
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3699
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3700
    ^ false
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3701
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3702
    "Created: 16.4.1996 / 16:27:16 / cg"
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3703
!
7d458640ca32 moved & added some query methods (from class) to upper abstract classes
Claus Gittinger <cg@exept.de>
parents: 1179
diff changeset
  3704
2
claus
parents: 1
diff changeset
  3705
whichClassImplements:aSelector
328
claus
parents: 325
diff changeset
  3706
    "obsolete interface;
claus
parents: 325
diff changeset
  3707
     use whichClassIncludesSelector: for ST-80 compatibility."
claus
parents: 325
diff changeset
  3708
claus
parents: 325
diff changeset
  3709
    ^ self whichClassIncludesSelector:aSelector
claus
parents: 325
diff changeset
  3710
!
claus
parents: 325
diff changeset
  3711
claus
parents: 325
diff changeset
  3712
whichClassIncludesSelector:aSelector
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3713
    "return the class in the inheritance chain, which implements the method
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3714
     for aSelector; return nil if none.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3715
     EXPERIMENTAL: handle multiple superclasses"
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3716
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3717
    |cls|
2
claus
parents: 1
diff changeset
  3718
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3719
    cls := self.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  3720
    [cls notNil] whileTrue:[
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  3721
	(cls includesSelector:aSelector) ifTrue:[^ cls].
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3722
	cls hasMultipleSuperclasses ifTrue:[
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3723
	    cls superclasses do:[:aSuperClass |
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3724
		|implementingClass|
2
claus
parents: 1
diff changeset
  3725
328
claus
parents: 325
diff changeset
  3726
		implementingClass := aSuperClass whichClassIncludesSelector:aSelector.
154
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3727
		implementingClass notNil ifTrue:[^ implementingClass].
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3728
	    ].
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3729
	    ^ nil
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3730
	] ifFalse:[
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3731
	    cls := cls superclass
d4236ec280a6 *** empty log message ***
claus
parents: 151
diff changeset
  3732
	]
2
claus
parents: 1
diff changeset
  3733
    ].
claus
parents: 1
diff changeset
  3734
    ^ nil
claus
parents: 1
diff changeset
  3735
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3736
    "
328
claus
parents: 325
diff changeset
  3737
     String whichClassIncludesSelector:#==
claus
parents: 325
diff changeset
  3738
     String whichClassIncludesSelector:#collect:
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3739
    "
2
claus
parents: 1
diff changeset
  3740
!
claus
parents: 1
diff changeset
  3741
3053
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3742
whichSelectorsReferTo:someLiteralConstant
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3743
    "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
  3744
     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
  3745
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3746
    |setOfSelectors|
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3747
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3748
    setOfSelectors := IdentitySet new.
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3749
    methodDictionary keysAndValuesDo:[:sel :mthd |
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3750
        (mthd referencesLiteral:someLiteralConstant) ifTrue:[
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3751
            setOfSelectors add:sel
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3752
        ].
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3753
    ].
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3754
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3755
    ^ setOfSelectors
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3756
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3757
    "
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3758
     String whichSelectorsReferTo:#at:  
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3759
     String whichSelectorsReferTo:CharacterArray 
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3760
    "
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3761
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3762
    "Modified: / 28.10.1997 / 13:13:18 / cg"
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3763
!
d6aad366397f added #whichSelectorsReferTo: and #compiledMethodAt:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  3764
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3765
withAllSubclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3766
    "return a collection containing the receiver and 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3767
     all subclasses (direct AND indirect) of the receiver"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3768
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3769
    |newColl|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3770
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3771
    newColl := OrderedCollection with:self.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3772
    self allSubclassesDo:[:aClass |
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3773
	newColl add:aClass
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3774
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3775
    ^ newColl
328
claus
parents: 325
diff changeset
  3776
claus
parents: 325
diff changeset
  3777
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3778
     Collection withAllSubclasses
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3779
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3780
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3781
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3782
withAllSuperclasses
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3783
    "return a collection containing the receiver and all
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3784
     of the receivers accumulated superclasses"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3785
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3786
    |aCollection theSuperClass|
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3787
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3788
    aCollection := OrderedCollection with:self.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3789
    theSuperClass := superclass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3790
    [theSuperClass notNil] whileTrue:[
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3791
	aCollection add:theSuperClass.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3792
	theSuperClass := theSuperClass superclass
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  3793
    ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3794
    ^ aCollection
11
6bf3080856be *** empty log message ***
claus
parents: 10
diff changeset
  3795
91
b3971c7dc731 *** empty log message ***
claus
parents: 88
diff changeset
  3796
    "
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3797
     String withAllSuperclasses 
308
f04744ef7b5d *** empty log message ***
claus
parents: 295
diff changeset
  3798
    "
2
claus
parents: 1
diff changeset
  3799
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3800
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3801
!Behavior methodsFor:'snapshots'!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3802
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3803
postSnapshot
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3804
    "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
  3805
     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
  3806
     about snapshooting."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3807
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3808
    "Modified: 16.4.1996 / 18:12:08 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3809
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3810
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3811
preSnapshot
1192
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3812
    "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
  3813
     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
  3814
     about snapshooting."
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3815
b1c2b886f23c moved some protocol from Class to upper levels; renamed categories
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
  3816
    "Modified: 16.4.1996 / 18:12:14 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3817
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
  3818
1760
e7254ff682fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  3819
!Behavior class methodsFor:'documentation'!
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  3820
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  3821
version
3641
d419c5d9a1c3 added #commonSuperClass:
Claus Gittinger <cg@exept.de>
parents: 3628
diff changeset
  3822
    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.134 1998-07-10 00:13:45 cg Exp $'
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 642
diff changeset
  3823
! !