[squeak-dev] The Trunk: Sound-nice.28.mcz

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Apr 11 16:00:27 UTC 2011


2011/4/11 Levente Uzonyi <leves at elte.hu>:
> On Mon, 11 Apr 2011, commits at source.squeak.org wrote:
>
>> Nicolas Cellier uploaded a new version of Sound to project The Trunk:
>> http://source.squeak.org/trunk/Sound-nice.28.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Sound-nice.28
>> Author: nice
>> Time: 11 April 2011, 4:49:01.623 pm
>> UUID: 3de2013e-36c1-bd46-a5db-a56a85de109a
>> Ancestors: Sound-nice.27
>>
>> Use #repeat instead of [true] whileTrue
>
> Can VMMaker compile #repeat to C? According to
> http://wiki.squeak.org/squeak/2267 it can't, but the wiki page may not be up
> to date.
>
>
> Levente
>

Right, it sounds like CCodeGenerator>>initializeCTranslationDictionary
does not have #repeat translation.
Though it does not sound difficult to add:

generateRepeat: msgNode on: aStream indent: level
	"Generate do {stmtList} while(true)"

	| stmts testStmt |
	stmts := msgNode receiver statements.
	testStmt := TConstantNode new setValue: true.
	msgNode receiver setStatements: stmts.
	aStream nextPutAll: 'do {'; cr.
	msgNode receiver emitCCodeOn: aStream level: level + 1 generator: self.
	level timesRepeat: [ aStream tab ].
	aStream nextPutAll: '} while('.
	testStmt emitCCodeOn: aStream level: 0 generator: self.
	aStream nextPutAll: ')'.

Nicolas



More information about the Squeak-dev mailing list