"
COPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
Object subclass:#ClassOrganization
instanceVariableNames:'class'
classVariableNames:''
poolDictionaries:''
category:'System-Support'
!
!ClassOrganization class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
version
"
$Header: /cvs/stx/stx/libbasic3/ClassOrganizer.st,v 1.1 1995-02-22 01:15:44 claus Exp $
"
!
documentation
"
in contrast to other smalltalks, ST/X does not keep the
method <-> category associations in the class (as organization),
but instead keeps the category as an instance variable of method.
This may change in future versions.
For compatibility with (fileOut-) files which include a class organization
message, aClass organization returns an instance of this class, which
implements the category change functionality.
"
! !
!ClassOrganization class methodsFor:'instance creation'!
for:aClass
"create & return a new instance of myself, to organize aClass"
^ self new class:aClass
! !
!ClassOrganization methodsFor:'private access'!
class:aClass
"set the class"
class := aClass
! !
!ClassOrganization methodsFor:'changing'!
changeFromString:organizationString
"take category<->selector associations from aString, and change
the categories of those methods. Only required when filing in
ST-80 code."
|s a category selector m|
"
(mis(use) parser for the scanning
"
a := Compiler evaluate:'#(' , organizationString , ')'.
(a isMemberOf:Array) ifFalse:[^ self error:'malformed argument'].
a do:[:row |
category := row at:1.
2 to:row size do:[:idx |
|selector|
selector := row at:idx.
m := class compiledMethodAt:selector.
m isNil ifTrue:[
Transcript showCr:'no method for ' , selector , ' in ', class name
] ifFalse:[
m category:category.
]
]
].
class changed:#organization
"
TestClass organization changeFromString:'( ''category1'' #foo1 #foo2 foo3)
( ''category2'' #bar1 #bar2)'
"
! !