<div dir="ltr">Hi Eliot,<br><br><div class="gmail_quote"><div dir="ltr">On Wed, May 16, 2018 at 6:21 PM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div dir="ltr">Hi Fabio,<div class="gmail_extra"><br><div class="gmail_quote"></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 16, 2018 at 3:51 AM, Fabio Niephaus <span dir="ltr"><<a href="mailto:lists@fniephaus.com" target="_blank">lists@fniephaus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">Hi all,<div><br></div><div>In BalloonEnginePlugin>>#primitiveSetBitBltPlugin, #stringOf: is sent to the interpreterProxy which does not understand the message.<br></div><div>Could someone please have a look at this?<br></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>To be accurate, BalloonEngineSimulation sends stringOf: to interpreterProxy.   BalloonEngineBase>>#primitiveSetBitBltPlugin (inherited by BalloonEnginePlugin) inlines the code:</div><div><br></div><div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>length := interpreterProxy byteSizeOf: pluginName.</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>length >= 256 </div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">           </span>ifTrue:[^interpreterProxy primitiveFail].</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>ptr := interpreterProxy firstIndexableField: pluginName.</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>needReload := false.</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>0 to: length-1 do:[:i|</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">               </span>"Compare and store the plugin to be used"</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">          </span>(bbPluginName at: i) = (ptr at: i) ifFalse:[</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">                 </span>bbPluginName at: i put: (ptr at: i).</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">                 </span>needReload := true]].</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>(bbPluginName at: length) = 0 ifFalse:[</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>bbPluginName at: length put: 0.</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>needReload := true].</div></div><div><br></div><div>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.</div><div><br></div><div>Something like this should work:</div><div><br></div><div><div>primitiveSetBitBltPlugin</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>"Primitive. Set the BitBlt plugin to use."</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>| pluginName |</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>pluginName := interpreterProxy stackValue: 0.</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>"Must be string to work"</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>(interpreterProxy isBytes: pluginName) </div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">             </span>ifFalse:[^interpreterProxy primitiveFail].</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>(interpreterProxy cStringOrNilFor: pluginName) = bbPluginName</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>ifTrue: [interpreterProxy pop: 1. "Return receiver"]</div><div><span class="m_7265696111428950513gmail-Apple-tab-span" style="white-space:pre-wrap">               </span>ifFalse: [^interpreterProxy primitiveFail]</div></div><div><br></div><div>Please test it both in your VM and in the simulator on a simulated image.</div></div></div></div></blockquote><div><br></div><div>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...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>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.</div></div></div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>Cheers,</div><div>Fabio</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div></div><div class="gmail_extra"><br></div><div class="m_7265696111428950513gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>
</blockquote></div></div>