In BalloonEnginePlugin>>#primitiveSetBitBltPlugin, #stringOf: is sent to the interpreterProxy which does not understand the message.
Could someone please have a look at this?
On Wed, May 16, 2018 at 3:51 AM, Fabio Niephaus <[hidden email]> wrote:
To be accurate, BalloonEngineSimulation sends stringOf: to interpreterProxy. BalloonEngineBase>>#
length := interpreterProxy byteSizeOf: pluginName.
length >= 256
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)
(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.
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.
On Wed, May 16, 2018 at 6:21 PM Eliot Miranda <[hidden email]> wrote:
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...
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.
In reply to this post by Eliot Miranda-2
On Wed, May 16, 2018 at 9:21 AM, Eliot Miranda <[hidden email]> wrote:
No, I read that wrong. The BalloonEngineBase primitive does allow one to change the name; it is the BalloonEngineSimulation that doesn't. I *hate* these crappy overrides :-)
In reply to this post by fniephaus
On Wed, May 16, 2018 at 9:36 AM, Fabio Niephaus <[hidden email]> wrote:
Build a VMMaker image from the image/buildspurtrunkvmmaker64image.sh script and you'll be able to browse for InterpreterPrimitives>>#cStringOrNilFor: and InterpreterProxy>>#cStringOrNilFor::
InterpreterProxy methods for simulation
"Answer either a malloced string with the null-terminated contents of oop if oop is a string,
or the null pointer if oop is nil, or fail. It is the client's responsibility to free the string later."
<returnTypeC: #'char *'>
oop isString ifTrue: [^oop] ifFalse: [self primitiveFail. ^0]
Ignore this suggestion. I misread the code. We need BalloonEngineSimulation>>primitiveSetBitBltPlugin to follow BalloonEngineBase>>#
|Free forum by Nabble||Edit this page|