UndefObj.st
changeset 159 514c749165c3
parent 95 d22739a0c6e9
child 202 40ca7cc6fb9c
equal deleted inserted replaced
158:be947d4e7fb2 159:514c749165c3
     1 "
     1 "
     2  COPYRIGHT (c) 1988 by Claus Gittinger
     2  COPYRIGHT (c) 1988 by Claus Gittinger
     3               All Rights Reserved
     3 	      All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    17        category:'Kernel-Objects'
    17        category:'Kernel-Objects'
    18 !
    18 !
    19 
    19 
    20 UndefinedObject comment:'
    20 UndefinedObject comment:'
    21 COPYRIGHT (c) 1988 by Claus Gittinger
    21 COPYRIGHT (c) 1988 by Claus Gittinger
    22               All Rights Reserved
    22 	      All Rights Reserved
    23 
    23 
    24 $Header: /cvs/stx/stx/libbasic/Attic/UndefObj.st,v 1.11 1994-08-05 01:02:56 claus Exp $
    24 $Header: /cvs/stx/stx/libbasic/Attic/UndefObj.st,v 1.12 1994-10-10 00:29:03 claus Exp $
    25 '!
    25 '!
    26 
    26 
    27 !UndefinedObject class methodsFor:'documentation'!
    27 !UndefinedObject class methodsFor:'documentation'!
    28 
    28 
    29 copyright
    29 copyright
    30 "
    30 "
    31  COPYRIGHT (c) 1988 by Claus Gittinger
    31  COPYRIGHT (c) 1988 by Claus Gittinger
    32               All Rights Reserved
    32 	      All Rights Reserved
    33 
    33 
    34  This software is furnished under a license and may be used
    34  This software is furnished under a license and may be used
    35  only in accordance with the terms of that license and with the
    35  only in accordance with the terms of that license and with the
    36  inclusion of the above copyright notice.   This software may not
    36  inclusion of the above copyright notice.   This software may not
    37  be provided or otherwise made available to, or used by, any
    37  be provided or otherwise made available to, or used by, any
    40 "
    40 "
    41 !
    41 !
    42 
    42 
    43 version
    43 version
    44 "
    44 "
    45 $Header: /cvs/stx/stx/libbasic/Attic/UndefObj.st,v 1.11 1994-08-05 01:02:56 claus Exp $
    45 $Header: /cvs/stx/stx/libbasic/Attic/UndefObj.st,v 1.12 1994-10-10 00:29:03 claus Exp $
    46 "
    46 "
    47 !
    47 !
    48 
    48 
    49 documentation
    49 documentation
    50 "
    50 "
   147     ^ true
   147     ^ true
   148 ! !
   148 ! !
   149 
   149 
   150 !UndefinedObject methodsFor:'copying'!
   150 !UndefinedObject methodsFor:'copying'!
   151 
   151 
       
   152 copy
       
   153     "return a shallow copy of myself
       
   154      - since there is only one nil in the system return self"
       
   155 
       
   156     ^ self
       
   157 !
       
   158 
   152 shallowCopy
   159 shallowCopy
   153     "return a shallow copy of myself
   160     "return a shallow copy of myself
   154      - since there is only one nil in the system return self"
   161      - since there is only one nil in the system return self"
   155 
   162 
   156     ^ self
   163     ^ self
   157 !
   164 !
   158 
   165 
       
   166 deepCopy
       
   167     "return a deep copy of myself
       
   168      - since there is only one nil in the system return self"
       
   169 
       
   170     ^ self
       
   171 !
       
   172 
   159 simpleDeepCopy
   173 simpleDeepCopy
   160     "return a deep copy of myself
   174     "return a deep copy of myself
   161      - since there is only one nil in the system return self"
   175      - since there is only one nil in the system return self"
   162 
   176 
   163     ^ self
   177     ^ self
   164 !
   178 !
   165 
   179 
   166 deepCopyUsing:aDictionary
   180 deepCopyUsing:aDictionary
   167     "return a deep copy of myself
       
   168      - since there is only one nil in the system return self"
       
   169 
       
   170     ^ self
       
   171 !
       
   172 
       
   173 deepCopy
       
   174     "return a deep copy of myself
   181     "return a deep copy of myself
   175      - since there is only one nil in the system return self"
   182      - since there is only one nil in the system return self"
   176 
   183 
   177     ^ self
   184     ^ self
   178 ! !
   185 ! !
   216 ! !
   223 ! !
   217 
   224 
   218 !UndefinedObject methodsFor:'subclass creation'!
   225 !UndefinedObject methodsFor:'subclass creation'!
   219 
   226 
   220 subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
   227 subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
   221     "create a new class which has nil as superclass - i.e. traps into doesNotUnderstand: for
   228     "create a new class which has nil as superclass 
   222      all of its messages."
   229      - i.e. traps into doesNotUnderstand: for all of its messages."
   223 
   230 
   224     |newClass upd|
   231     |newClass upd|
   225 
   232 
   226     upd := Class updateChanges:false.
   233     upd := Class updateChanges:false.
   227     [
   234     [
   228         newClass := Object subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat.
   235 	newClass := Object subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat.
   229     ] valueNowOrOnUnwindDo:[
   236     ] valueNowOrOnUnwindDo:[
   230         Class updateChanges:upd
   237 	Class updateChanges:upd
   231     ].
   238     ].
   232     newClass notNil ifTrue:[
   239     newClass notNil ifTrue:[
   233         newClass setSuperclass:nil.
   240 	newClass setSuperclass:nil.
   234         newClass setMethodArray:(Array with:(Object compiledMethodAt:#class)
   241 	newClass 
   235                                        with:(Object compiledMethodAt:#doesNotUnderstand:)).
   242 	    setSelectors:(Array with:#class
   236         newClass setSelectorArray:(Array with:#class
   243 				with:#doesNotUnderstand:)
   237                                          with:#doesNotUnderstand:).
   244 	    methods:(Array with:(Object compiledMethodAt:#class)
   238         Class addChangeRecordForClass:newClass.
   245 			   with:(Object compiledMethodAt:#doesNotUnderstand:)).
       
   246 	Class addChangeRecordForClass:newClass.
   239     ].
   247     ].
   240     ^ newClass
   248     ^ newClass
   241 ! 
   249 ! 
   242 
   250 
   243 variableSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
   251 variableSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
   244     "create a new class which has nil as superclass - i.e. traps into doesNotUnderstand: for
   252     "create a new class which has nil as superclass 
   245      all of its messages."
   253      - i.e. traps into doesNotUnderstand: for all of its messages."
   246 
   254 
   247     |newClass upd|
   255     |newClass upd|
   248 
   256 
   249     upd := Class updateChanges:false.
   257     upd := Class updateChanges:false.
   250     [
   258     [
   251         newClass := Object variableSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat.
   259 	newClass := Object variableSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat.
   252     ] valueNowOrOnUnwindDo:[
   260     ] valueNowOrOnUnwindDo:[
   253         Class updateChanges:upd
   261 	Class updateChanges:upd
   254     ].
   262     ].
   255     newClass notNil ifTrue:[
   263     newClass notNil ifTrue:[
   256         newClass setSuperclass:nil.
   264 	newClass setSuperclass:nil.
   257         newClass setMethodArray:(Array with:(Object compiledMethodAt:#class)
   265 	newClass 
   258                                        with:(Object compiledMethodAt:#doesNotUnderstand:)).
   266 	    setSelectors:(Array with:#class
   259         newClass setSelectorArray:(Array with:#class
   267 				with:#doesNotUnderstand:)
   260                                          with:#doesNotUnderstand:).
   268 	    methods:(Array with:(Object compiledMethodAt:#class)
   261         Class addChangeRecordForClass:newClass.
   269 			   with:(Object compiledMethodAt:#doesNotUnderstand:)).
       
   270 	Class addChangeRecordForClass:newClass.
   262     ].
   271     ].
   263     ^ newClass
   272     ^ newClass
   264 ! 
   273 ! 
   265 
   274 
   266 variableByteSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
   275 variableByteSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
   267     "create a new class which has nil as superclass - i.e. traps into doesNotUnderstand: for
   276     "create a new class which has nil as superclass 
   268      all of its messages."
   277      - i.e. traps into doesNotUnderstand: for all of its messages."
   269 
   278 
   270     |newClass upd|
   279     |newClass upd|
   271 
   280 
   272     upd := Class updateChanges:false.
   281     upd := Class updateChanges:false.
   273     [
   282     [
   274         newClass := Object variableByteSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat.
   283 	newClass := Object variableByteSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat.
   275     ] valueNowOrOnUnwindDo:[
   284     ] valueNowOrOnUnwindDo:[
   276         Class updateChanges:upd
   285 	Class updateChanges:upd
   277     ].
   286     ].
   278     newClass notNil ifTrue:[
   287     newClass notNil ifTrue:[
   279         newClass setSuperclass:nil.
   288 	newClass setSuperclass:nil.
   280         newClass setMethodArray:(Array with:(Object compiledMethodAt:#class)
   289 	newClass 
   281                                        with:(Object compiledMethodAt:#doesNotUnderstand:)).
   290 	    setSelectors:(Array with:#class
   282         newClass setSelectorArray:(Array with:#class
   291 				with:#doesNotUnderstand:)
   283                                          with:#doesNotUnderstand:).
   292 	    methods:(Array with:(Object compiledMethodAt:#class)
   284         Class addChangeRecordForClass:newClass.
   293 			   with:(Object compiledMethodAt:#doesNotUnderstand:)).
       
   294 	Class addChangeRecordForClass:newClass.
   285     ].
   295     ].
   286     ^ newClass
   296     ^ newClass
   287 ! !
   297 ! !