[squeak-dev] Re: Empty categories

Andreas Raab andreas.raab at gmx.de
Tue Feb 9 20:30:46 UTC 2010


Thanks, Edgar! That's a really useful script.

Cheers,
   - Andreas

Edgar J. De Cleene wrote:
> 
> 
> 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
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 




More information about the Squeak-dev mailing list