<br><br><div class="gmail_quote">On Tue, Feb 12, 2013 at 2:47 PM, tim Rowledge <span dir="ltr">&lt;<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
On 12-02-2013, at 12:38 PM, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Feb 12, 2013 at 12:30 PM, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Feb 12, 2013 at 11:48 AM, tim Rowledge &lt;<a href="mailto:tim@rowledge.org">tim@rowledge.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I never knew that you could declare an argument in C with &quot;sqInt (*thingy[])(void)&quot; ! I hope it actually does what i think it oughta.<br>
&gt;<br>
&gt; yes it does :)<br>
&gt;<br>
&gt; see e.g. <a href="http://stackoverflow.com/questions/5488608/how-define-an-array-of-function-pointers-in-c" target="_blank">http://stackoverflow.com/questions/5488608/how-define-an-array-of-function-pointers-in-c</a>.  But what&#39;s the relevance?  I don&#39;t see any obvious candidates in the VM source.  Can you point me to the example?<br>

<br>
</div></div>The primitive table is (or should be) typed as an array of pointers to function with void arg and sqInt return (although I think that likely really ought to be void return, requiring some other fixes in the translator code depths). </blockquote>
<div><br></div><div>This is fixed in the Cog branch.  primitives therein are void primitiveFunc(void).</div><div> </div><div>static void (*primitiveFunctionPointer)();</div><div><div>static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = {</div>
<div>...</div></div><div><br></div><div>And the bug that excludes primitiveFunctionPointer from the struct is the includes: $( in CCodeGeneratorGlobalStructure&gt;&gt;placeInStructure:.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Following from that you need to suitably match types all over the place - which is why the original slang code wimped out and used int *everywhere* and cast things if really, really needed. Which lead to some really ugly code.<br>

Example - dispatchFunctionPointerOn:in:<br></blockquote><div><br></div><div>Again fixed in the Cog branch.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im"><br>
<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" target="_blank">http://www.rowledge.org/tim</a><br>
</div>Useful Latin Phrases:- Aio, quantitas magna frumentorum est. = Yes, that is a very large amount of corn.<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>