[Vm-dev] DNU in BalloonEnginePlugin
lists at fniephaus.com
Wed May 16 16:36:57 UTC 2018
On Wed, May 16, 2018 at 6:21 PM Eliot Miranda <eliot.miranda at gmail.com>
> Hi Fabio,
> On Wed, May 16, 2018 at 3:51 AM, Fabio Niephaus <lists at fniephaus.com>
>> Hi all,
>> In BalloonEnginePlugin>>#primitiveSetBitBltPlugin, #stringOf: is sent to
>> the interpreterProxy which does not understand the message.
>> Could someone please have a look at this?
> To be accurate, BalloonEngineSimulation sends stringOf: to
> interpreterProxy. BalloonEngineBase>>#primitiveSetBitBltPlugin (inherited
> by BalloonEnginePlugin) inlines the code:
> length := interpreterProxy byteSizeOf: pluginName.
> length >= 256
> ifTrue:[^interpreterProxy primitiveFail].
> ptr := interpreterProxy firstIndexableField: pluginName.
> needReload := false.
> 0 to: length-1 do:[:i|
> "Compare and store the plugin to be used"
> (bbPluginName at: i) = (ptr at: i) ifFalse:[
> bbPluginName at: i put: (ptr at: i).
> needReload := true]].
> (bbPluginName at: length) = 0 ifFalse:[
> bbPluginName at: length put: 0.
> needReload := true].
> So it looks like stringOf: has never been implemented by InterpreterProxy
> because in the simulation work that Dan would have done to develop the
> plugin interpreterProxy would have been bound to an interpreter.
> Something like this should work:
> "Primitive. Set the BitBlt plugin to use."
> | pluginName |
> pluginName := interpreterProxy stackValue: 0.
> "Must be string to work"
> (interpreterProxy isBytes: pluginName)
> ifFalse:[^interpreterProxy primitiveFail].
> (interpreterProxy cStringOrNilFor: pluginName) = bbPluginName
> ifTrue: [interpreterProxy pop: 1. "Return receiver"]
> ifFalse: [^interpreterProxy primitiveFail]
> Please test it both in your VM and in the simulator on a simulated image.
Thanks for the info! Unfortunately, #cStringOrNilFor: is not implemented in
my image. Looking at other methods using an interpreterProxy, it seems I
need to use #byteSizeOf: as well as #firstIndexableField: and then collect
all bytes to get the string value? Is there a convenience method for this?
At least I couldn't find one...
> But this primitive is funny/strange/dubious. It doesn't actually allow
> one to change the name. It fails if the name isn't what it was already,
> and it gets initialized to "BitBltPlugin" in BalloonEngineBase
> class>>#declareCVarsIn: and by BalloonEngineSimulation>>initialize. So
> what it really does is force initialiseModule to be called. It might be
> better if it was replaced by e.g. primitiveReinitialiseModule.
I agree, but I'm not sure how things are being deprecated in the VMMaker
package and what this change would break in the first place.
> best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev