Porting to VW

Michael S. Klein mklein at alumni.caltech.edu
Thu Nov 12 20:03:03 UTC 1998


> Has anybody had any luck using Squeak fileouts to filein to VW?

Yeah, but some of it was bad luck ;-)

> I have
> some Squeak stuff I want to play with in VW.

I know its not quite what you wanted, but here a couple of mods to the 
ChangeScanner to support Squeak code.

> I figured out the
> methodsFor:stamp:, that was easy. But this commentStamp:prior:
> message... making that be a pass through to comment:, does not seem to
> work. It appears that in VW fileout format, the comments are dealt with
> as just straight message sends, whereas in Squeak they are done using
> the chunk format.

You need to make reader just for the class comment. Can you say
"agglutination of features".  Personally, I think extending the smalltalk's
chunk-style fileOuts are the wrong way to go for source.

-- MIke

P.S. yet here I go using it :-)

"Changes in change set SqueakCompatibility"
'From VisualWorks. Non-Commercial, Release 3.0 of May 8, 1998 on 
September 18, 1998 at 3:46:17 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 |
	(class := self nextClass) notNil ifTrue:
		[(tokenType == #keyword
		and: [token = 'methodsFor:'
			or: [token = 'publicMethodsFor:'
			or: [token = 'privateMethodsFor:'
			or: [token = 'methodsForUndefined:']]]]) ifTrue:
			[self scanToken.
			tokenType == #string ifTrue:
				[category := token.
				self scanToken.
				"Squeak compatibility"
				(tokenType == #keyword and: [token = 
'stamp:']) ifTrue:
					[self scanToken; scanToken].
				tokenType == #doIt ifTrue:
					[^self scanMethodsClass: class 
category: category asSymbol do: aBlock]]].

		(tokenType == #keyword
		and: [token = 'commentStamp:']) ifTrue:
			[self scanToken.
			tokenType == #string ifTrue:
				[self scanToken.
				"Squeak compatibility"
				(tokenType == #keyword and: [token = 
'prior:']) ifTrue:
					[self scanToken; scanToken].
				tokenType == #doIt ifTrue:
					[^self scanSqueakClassComment: 
class do: aBlock]]].

		(tokenType == #word
		and: [token = 'methods']) ifTrue:
			[self scanToken.
			tokenType == #doIt ifTrue:
				[^self scanMethodsClass: class category: 
nil do: aBlock]]].
	"I don't understand what's on the file.  Scan for a blank chunk 
and hope for the best."
	[self nextChunkStream atEnd] whileFalse.!

scanSqueakClassComment: class do: aBlock
	| theChange |

	theChange := ClassCommentChange new file: file position: file 
position; className: class; yourself.
	self nextChunkStream.
	file skipSeparators peek = $] ifTrue: [
		self nextChunkStream.  "The style"
	].
	^aBlock value: theChange! !





More information about the Squeak-dev mailing list