--- a/ClassOrganizer.st Tue Apr 30 17:40:00 1996 +0200
+++ b/ClassOrganizer.st Thu May 09 15:47:56 1996 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ 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
@@ -11,10 +11,10 @@
"
Object subclass:#ClassOrganizer
- instanceVariableNames:'globalComment categoryArray categoryStops elementArray class'
- classVariableNames:''
- poolDictionaries:''
- category:'Kernel-Support'
+ instanceVariableNames:'globalComment categoryArray categoryStops elementArray class'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Kernel-Support'
!
!ClassOrganizer class methodsFor:'documentation'!
@@ -33,25 +33,23 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassOrganizer.st,v 1.6 1995-11-11 15:20:28 cg 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.
+ but instead keeps the category as an instance variable of methods.
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.
- Also, some PD code seems to use & define methods for ClassOrganizers - having this
- (somewhat dummy) around helps to fileIn that code.
+ Also, some PD code seems to use & define methods for ClassOrganizers
+ - having this (somewhat dummy) class around helps to fileIn that code.
- Notice, that instances of ClassOrganizer are not used in the current ST/X
- system; all is pure mimicri.
- This may change in future versions.
+ Notice, that instances of ClassOrganizer are NOT used in the current ST/X
+ system; all of this is pure compatibility mimicri.
+
+ [author:]
+ Claus Gittinger
"
! !
@@ -63,17 +61,28 @@
^ self new class:aClass
! !
-!ClassOrganizer methodsFor:'accessing'!
+!ClassOrganizer methodsFor:'accessing'!
+
+categories
+ "return a collection of my classes method-categorySymbols"
-classComment
- ^ class comment
+ |set|
+
+ set := IdentitySet new.
+ class methodArray do:[:m |
+ set add:m category
+ ].
+ ^ set asArray
"
- Number organization classComment
+ SmallInteger organization categories
"
!
categoryOfElement:aSelectorSymbol
+ "return the category for the method specified by aSelectorSymbol.
+ Return nil, if there is no such method."
+
|m|
m := class compiledMethodAt:aSelectorSymbol.
@@ -86,6 +95,16 @@
"
!
+classComment
+ "return the classes comment"
+
+ ^ class comment
+
+ "
+ Number organization classComment
+ "
+!
+
listAtCategoryNamed:aCategorySymbol
"return a collection of selectors whose methods are categorized
as aCategorySymbol"
@@ -101,21 +120,44 @@
"
SmallInteger organization listAtCategoryNamed:#arithmetic
"
-!
+! !
-categories
- "return a collection of categorySymbols"
+!ClassOrganizer methodsFor:'changing'!
- |set|
+changeFromString:organizationString
+ "take category<->selector associations from aString, and change
+ the categories of those methods.
+ Only required when filing in ST-80 code, which changes the categorization
+ this way."
- set := IdentitySet new.
- class methodArray do:[:m |
- set add:m category
- ].
- ^ set asArray
+ |a category m|
"
- SmallInteger organization categories
+ (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)'
"
! !
@@ -159,38 +201,8 @@
class := aClass
! !
-!ClassOrganizer 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."
-
- |a category m|
+!ClassOrganizer class methodsFor:'documentation'!
- "
- (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)'
- "
+version
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassOrganizer.st,v 1.7 1996-05-09 13:47:56 cg Exp $'
! !