[BUG][FIX] Generated files

Mats Nygren nygren at sics.se
Mon Sep 18 08:34:58 UTC 2000


Hi,

(this is from my attachment-unaware squeak image)

'From Squeak2.8 of 13 June 2000 [latest update: #2359] on 18 September
2000 at 11:30:50 am'!
"Change Set:		CGFiles
Date:			18 September 2000
Author:			Mats Nygren

Makes all generated file respect (InterpreterPlugin baseDirectoryName).
Changing
that and generating (Interpreter translate: 'interp.c' doInlining: true)
puts
them all in the directory named baseDirectoryName. This is useful for
making
different versions."!


!B3DRasterizerPlugin class methodsFor: 'translation' stamp: 'mn
9/18/2000 11:30'!
writeSupportCode: inlineFlag
	"B3DRasterizerPlugin writeSupportCode: true"
	"B3DRasterizerPlugin writeSupportCode: false"
	"Translate all the C support files for the Balloon 3D rasterizer
plugin."
	| src fs fd |
	fd _ FileDirectory on: InterpreterPlugin baseDirectoryName.

	#(
		(b3dTypesH 'b3dTypes.h')
		(b3dAllocH 'b3dAlloc.h')
		(b3dHeaderH 'b3d.h')

		(b3dInitC 'b3dInit.c')
		(b3dAllocC 'b3dAlloc.c')
		(b3dRemapC 'b3dRemap.c')
		(b3dDrawC 'b3dDraw.c')
		(b3dMainC 'b3dMain.c')
	) do:[:spec|
		src _ self perform: (spec at: 1).
		src _ self translateSupportCode: src inlining: inlineFlag.
		fs _ CrLfFileStream
			newFileNamed: (fd fullNameFor: (spec at: 2)).
		fs nextPutAll: src.
		fs close.
	].! !


!Interpreter class methodsFor: 'translation' stamp: 'mn 9/18/2000
11:11'!
translate: fileName doInlining: inlineFlag forBrowserPlugin: pluginFlag
	"Note: The pluginFlag is meaningless on Windows and Unix. On these
platforms Squeak runs as it's own process and doesn't need any special
attention from the VMs point of view. Meaning that NONE of the required
additional functions will be supported. In other words, the pluginFlag
is not needed and not supported."
	"Translate the Smalltalk description of the virtual machine into C. If
inlineFlag is true,
small method bodies are inlined to reduce procedure call overhead. On
the PPC, this results in a factor of three speedup with only 30%
increase in code size. If pluginFlag is true, generate code for an
interpreter that runs as a browser plugin (Netscape or IE)."

	| doInlining cg exports fd |
	doInlining _ inlineFlag.
	pluginFlag ifTrue: [doInlining _ true].  "must inline when generating
browser plugin"
	fd _ FileDirectory on: InterpreterPlugin baseDirectoryName.

	cg _ CCodeGenerator new initialize.

	Interpreter initialize.
	cg addClass: Interpreter.
	Interpreter declareCVarsIn: cg.

	ObjectMemory initialize.
	cg addClass: ObjectMemory.
	ObjectMemory declareCVarsIn: cg.

	GenerateBrowserPlugin _ pluginFlag.

	"Get all the named prims from the VM.
	Note: the format of exports is:
		pluginName -> Array of: primitiveName.
	so we can generate a nice table from it."
	exports _ Array with: '' -> cg exportedPrimitiveNames asArray.
	cg storeCodeOnFile: (fd fullNameFor: fileName) doInlining: doInlining.
	"Add our plugins"
	{
		"Graphics"
			"Note: BitBltSimulation should go first, 
			because three of it's entries might be 
			looked up quite often (due to refs from 
			InterpreterProxy). This will go away at
			some point but for now it's a good idea
			to have those entries early in the table."
		BitBltSimulation.	
		BalloonEnginePlugin. 
		SurfacePlugin. "To support OS surfaces through FXBlt"

		"I/O subsystems"
		FilePlugin.
		SocketPlugin. 
		SoundPlugin. 
		MIDIPlugin. 
		SerialPlugin. 
		JoystickTabletPlugin. 
		AsynchFilePlugin. 

	 	"Numerics"
		LargeIntegersPlugin.
		FFTPlugin. 
		FloatArrayPlugin. 
		Matrix2x3Plugin. 

		"Compression"
		DeflatePlugin.

		"Others"
		KlattSynthesizerPlugin.
		SoundCodecPlugin.
		B3DEnginePlugin.
		FFIPlugin.

		"Note: Optionally, you can translate the following as builtins.
		As of Squeak 2.7 they are not builtins by default:
			DSAPlugin.
		"
	} do:[:plugin|
		cg _ plugin translate: plugin moduleName, '.c'
					doInlining: doInlining
					locally: true.
		exports _ exports copyWith: 
			(plugin moduleName -> cg exportedPrimitiveNames asArray).
	].
	self storeExports: exports on: (fd fullNameFor: 'sqNamedPrims.h').! !





More information about the Squeak-dev mailing list