[comp.lang.smalltalk] ChangeList modification free code

bnfb@june.cs.washington.edu (Bjorn Freeman-Benson) (12/22/88)

Here is a little modification that John Maloney and I wrote
to make ParcPlace Smalltalk-80 ChangeLists read the output of
fileOutChanges.

"ChangesReorgGoodie.st by Bjorn Freeman-Benson and John Maloney.
This goodie updates the ChangeList classes so that they can handle
class protocol reorganizations that are written out by fileOutChanges."

'From Smalltalk-80, Version 2.3 of 13 June 1988 on 21 December 1988 at 4:51:30 pm'!

!ChangeScanner methodsFor: 'file scanning'!

scanSpecialDo: aBlock
	"Scan a chunk of file beginning with a !!.  For now, the only thing I understand is method definitions."
	| class category tmp |
	(class _ self nextClass) notNil ifTrue:
		[(tokenType == #keyword and: [token = 'methodsFor:']) ifTrue:
			[self scanToken.
			tokenType == #string ifTrue:
				[category _ token.
				self scanToken.
				tokenType == #doIt ifTrue:
					[^self scanMethodsClass: class category: category asSymbol do: aBlock]]]].
"Now, thanks to Bjorn Freeman-Benson and John Maloney, I understand class reorganizations as well."
(tokenType == #word and: [token = 'reorganize'])
	ifTrue:
		[self scanToken.
		tmp _ (ClassReorgChange file: file position: file position)
			className: class ; type: #reorganize.
		self nextChunkStream.
		^aBlock value: tmp].
	"I don't understand what's on the file.  Scan for a blank chunk and hope for the best."
	[self nextChunkStream atEnd] whileFalse: []! !

ClassOtherChange subclass: #ClassReorgChange
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'System-Changes'!


!ClassReorgChange methodsFor: 'accessing'!

text
	file position: position.
	^className, ' reorganize
', file nextChunk! !

!ClassReorgChange methodsFor: 'fileIn/Out'!

fileOutOn: aStream
	file position: position.
	aStream nextPut: $!!.
	aStream nextChunkPut: (className, ' reorganize') ; cr.
	aStream nextChunkPut: file nextChunk ; cr ; cr.! !