Edgar J. De Cleene | 9 Feb 20:20
Picon
Favicon

Re: Empty categories


On 2/9/10 11:58 AM, "Torsten Bergmann" <astares <at> gmx.de> wrote:

> Shouldnt we run a script on trunk to remove empty
> categories to clean up a little bit?

Trying to see if the cleanup I have was in Squeak3.11-8931-alpha.image
originate the attached walkback

The error was with the .cs via drag and drop and selecting code browser
Using message names tool I see no cleanup in image, so I copy paste here.
Come from original code of Ramon Leon and IMHO should be used before any
image go to ftp 

!SmalltalkImage methodsFor: 'image cleanup' stamp: 'edc 12/13/2009 08:34'!
cleanup
    "SmalltalkImage current cleanup"
    | tasks |
    Transcript open.
    tasks := OrderedCollection new
                add: [Smalltalk removeEmptyMessageCategories];

                add: [Workspace
                        allSubInstancesDo: [:each | each setBindings:
Dictionary new]];

                add: [Undeclared removeUnreferencedKeys];

                add: [Categorizer sortAllCategories];

                add: [Symbol compactSymbolTable];

                add: [#(#TheWorldMenu #FileServices #AppRegistry
#Preferences #FileList )
                        do: [:cl | (Smalltalk at: cl) removeObsolete]];

                add: [Flaps freshFlapsStart];

                add: [MCFileBasedRepository flushAllCaches];

                add: [HandMorph releaseCachedState; initForEvents.
                    self fixObsoleteReferences];

                add: [Smalltalk forgetDoIts.
                    DataStream initialize.
                    Behavior flushObsoleteSubclasses.
                    "The pointer to currentMethod is not realy needed
                    (anybody care to fix this) and often holds on to
                    obsolete bindings"
                    MethodChangeRecord
                        allInstancesDo: [:each | each noteNewMethod: nil].
                    Smalltalk garbageCollectMost];
                 yourself.
    Utilities
        informUserDuring: [:bar | tasks
                do: [:block |
                    bar value: block printString.
                    [block value]
                        on: Error
                        do: [:error | Transcript show: error;
                                 cr]]].
    SystemNavigation default obsoleteClasses isEmpty
        ifTrue: [SmalltalkImage current saveSession]
        ifFalse: [SystemNavigation default obsoleteClasses
                do: [:each |
                    self halt.
                    [PointerFinder on: each]
                        on: Error
                        do: [:error | Transcript show: error;
                                 cr]]]! !

Edgar

MessageNotUnderstood: Array>>isByteString
9 February 2010 5:07:38.355 pm

VM: Mac OS - a
SmalltalkImage
Image: Squeak3.11alpha [latest update: #8931]

SecurityManager
state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir
/Users/edgar/SqueakDevelop/imagesZip/Squeak3.11-8931-alpha
Trusted Dir
/foobar/tooBar/forSqueak/bogus
Untrusted Dir
/Users/edgar/Library/Preferences/Squeak/Internet/My
Squeak

Array(Object)>>doesNotUnderstand: #isByteString
	Receiver:
#('*MinimalMorphic-changeset utilities' #basicNewChangeSet: #changeSetNamed:)
	Arguments and
temporary variables: 
		aMessage: 	isByteString
		exception: 	MessageNotUnderstood:
Array>>isByteString
		resumeValue: 	nil
	Receiver's instance variables:

#('*MinimalMorphic-changeset utilities' #basicNewChangeSet:
#changeSetNamed:)
ByteSymbol(String)>>compare:with:collated:
	Receiver:
#SmalltalkImage
	Arguments and temporary variables: 
		string1: 	#SmalltalkImage
		string2:
	#('*MinimalMorphic-changeset utilities' #basicNewChangeSet: #changeSet...etc...
		order:
	#[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26...etc...
	Receiver's instance variables:

#SmalltalkImage
ByteSymbol(String)>>>=
	Receiver: #SmalltalkImage
	Arguments and temporary
variables: 
		aString: 	#('*MinimalMorphic-changeset utilities' #basicNewChangeSet:
#changeSet...etc...
	Receiver's instance variables:

#SmalltalkImage
SystemOrganizer(Categorizer)>>classify:under:suppressIfDefault:
	Receiver:
<<error during printing>>
	Arguments and temporary variables: 
		element:
	#SmalltalkImage
		heading: 	'7253SmalltalkImage-cleanup.1.cs'
		aBoolean: 	true
		catName:
	nil
		catIndex: 	1
		elemIndex: 	1
		realHeading: 	#'7253SmalltalkImage-cleanup.1.cs'
		i:
	nil
		iLimiT: 	nil
	Receiver's instance variables: 
		categoryArray:
	#(#'7253SmalltalkImage-cleanup.1.cs')
		categoryStops: 	#(1)
		elementArray:
	#(#('*MinimalMorphic-changeset utilities' #basicNewChangeSet: #ch...etc...


--- The full
stack ---
Array(Object)>>doesNotUnderstand:
#isByteString
ByteSymbol(String)>>compare:with:collated:
ByteSymbol(String)>>>=
SystemOrganizer(Categorizer)>>classify:under:suppressIfDefault:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SystemOrganizer(Categorizer)>>classify:under:
[] in
SystemOrganizer(Categorizer)>>classifyAll:under:
Array(SequenceableCollection)>>do:
SystemOrganizer(Categorizer)>>classifyAll:under:
[]
in FileContentsBrowser
class>>browseStream:named:
BlockClosure>>ensure:
CursorWithMask(Cursor)>>showWhile:
FileContentsBrowser
class>>browseStream:named:
FileContentsBrowser
class>>browseStream:
SimpleServiceEntry>>performServiceFor:
[] in ExternalDropHandler
class>>lookupServiceBasedHandler:
ExternalDropHandler>>handle:in:dropEvent:
[] in
PasteUpMorph>>dropFiles:
BlockClosure>>ensure:
PasteUpMorph>>dropFiles:
PasteUpMorph(Morph)>>handleDropFiles:
DropFilesEvent>>sentTo:
PasteUpMorph(Morph)>>handleEvent:
MorphicEventDispatcher>>dispatchDefault:with:
MorphicEventDispatcher>>dispatchEvent:with:
PasteUpMorph(Morph)>>processEvent:using:
PasteUpMorph>>processEvent:using:
PasteUpMorph(Morph)>>processEvent:
HandMorph>>sendEvent:focus:clear:
HandMorph>>sendEvent:focus:
HandMorph>>handleEvent:
HandMorph>>processEvents
[]
in
WorldState>>doOneCycleNowFor:
Array(SequenceableCollection)>>do:
WorldState>>handsDo:
WorldState>>doOneCycleNowFor:
WorldState>>doOneCycleFor:
PasteUpMorph>>doOneCycle
[]
in Project class>>spawnNewProcess
[] in BlockClosure>>newProcess


Gmane