Thanks, John!<div><br></div><div>I DID manage to build a new VM from the C source code that is available; I have never yet GENERATED the source from VMMaker.</div><div>I guess once I figure that out I&#39;ll have a place to start now.</div>
<div><br></div><div>(I was poking around in the primitive table directly and recompiling!)</div><div><br></div><div>I did find ioExit() in the C-Code, but when I loaded VMMaker, I only found it in InterpreterSimulator.</div>
<div><br></div><div>What a lot to learn!</div><div><br></div><div>Thanks again for pointing me towards and example,</div><div><br></div><div>Rob</div><div><br></div><div><br><br><div class="gmail_quote">On Mon, Nov 23, 2009 at 12:19 AM, John M McIntosh <span dir="ltr">&lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Well yes you need to use VMMaker<br>
Look at the gcBiasToGrowGCLimit setup.<br>
gcBiasToGrowGCLimit is an instance var on Interpreter<br>
Then you need<br>
<br>
Interpreter&gt;&gt;primitiveSetGCBiasToGrowGCLimit<br>
        &quot;Primitive. If the GC logic has  bias to grow, set growth limit&quot;<br>
        | value |<br>
        self export: true.<br>
        value := self stackIntegerValue: 0.<br>
        successFlag ifTrue:[<br>
                gcBiasToGrowGCLimit := value.<br>
                //Other clutter here which is not important to the example<br>
                self pop: argumentCount.<br>
        ].<br>
<br>
Then an example to call it.<br>
<br>
SystemDictionary&gt;&gt;setGCBiasToGrowGCLimit: aNumber<br>
        &quot;Primitive. Indicate that the bias to grow logic should do a GC after aNumber Bytes&quot;<br>
        &lt;primitive: &#39;primitiveSetGCBiasToGrowGCLimit&#39;&gt;<br>
        ^self primitiveFailed<br>
&quot;Example:<br>
        Smalltalk setGCBiasToGrowGCLimit: 16*1024*1024.<br>
&quot;<br>
<br>
Squeak calls the routine ioExit() to exit, which is platform dependent, in that routine you<br>
would need to load the return code and do something interesting with it.<br>
<div><div></div><div class="h5"><br>
<br>
On 2009-11-22, at 5:12 AM, Rob Rothwell wrote:<br>
<br>
&gt;<br>
&gt; On 22.11.2009, at 05:07, Rob Rothwell wrote:<br>
&gt; &gt; Hello...<br>
&gt; &gt;<br>
&gt; &gt; For scripting purposes, I just want to be able to do something like:<br>
&gt; &gt;<br>
&gt; &gt; SmalltalkImage current quit: errorCode.<br>
&gt; &gt;<br>
&gt; &gt; So that in the VM I can essentially do:<br>
&gt; &gt;<br>
&gt; &gt; return errorCode.<br>
&gt; &gt;<br>
&gt; &gt; at the end of sqMain?<br>
&gt; &gt;<br>
&gt; &gt; Any pointers on how to push a value BACK to the VM?  I have only barely dabbled with adding some custom menu commands to the VM long ago, and have no idea where to start.<br>
&gt;<br>
&gt; You would need to add a primitive to set the errorCode. This would be stored in an interpreter variable. Then the VM&#39;s exit code would be modified to retrieve that value.<br>
&gt;<br>
&gt; So, unlike all the other examples out there, this would probably be best if it were NOT an external plugin?  Would you be able to use VMMaker to do this (I&#39;ve never done that before), or just go hand code some stuff?<br>

&gt;<br>
&gt; Do you think this seems like a generically pretty useful think to add to the VM?  If so, I suppose I would like to do it right!<br>
&gt;<br>
&gt; I hacked a temporary solution together with batch files and unique file names, but it feels a little sloppy.<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; Rob<br>
<br>
</div></div><font color="#888888">--<br>
===========================================================================<br>
John M. McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>&gt;   Twitter:  squeaker68882<br>
Corporate Smalltalk Consulting Ltd.  <a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><br>
===========================================================================<br>
<br>
<br>
<br>
<br>
</font></blockquote></div><br></div>