"*********************************************************************
******************File Out MODE Categories****************************

Script to file *out* the MODE categories, i.e., write source.

(Do a pattern match on 'Music' and 'MusicUI" in the system org.)"

( | dirName fs |
	dirName := 'mode/music/'.
	(Smalltalk organization categories select: [ :cat | | siz |
			siz := 'Music-' size.
			(cat size >= siz) and: [(cat copyFrom: 1 to: siz) = 'Music-']])
	  do: [ :catName | 
		fs := SourceCodeStream on: ((dirName, catName asString, '.st') 
						asFilename writeStream).
		[Smalltalk organization fileOutCategorySource: catName on: fs]
			valueNowOrOnUnwindDo: [fs close].
		(Smalltalk organization superclassOrder: catName)
			do: [ :cl | ChangeSet current removeClass: cl]].

	dirName := 'mode/musicUI/'.
	(Smalltalk organization categories select: [ :cat | | siz |
			siz := 'MusicUI-' size.
			(cat size >= siz) and: [(cat copyFrom: 1 to: siz) = 'MusicUI-']])
	  do: [ :catName | 
		fs := SourceCodeStream on: ((dirName, catName asString, '.st') 
						asFilename writeStream).
		[Smalltalk organization fileOutCategorySource: catName on: fs]
			valueNowOrOnUnwindDo: [fs close].
		(Smalltalk organization superclassOrder: catName)
			do: [ :cl | ChangeSet current removeClass: cl]]
)
