<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 16.05.2012, at 17:41, Damien Cassou wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br><br>the official DBusPlugin source file defines argumentsAddInt16toIter() as<br><br><pre style="font-family:courier new,monospace">static sqInt argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) {
        dbus_int16_t intArg;

        if (!((oop &amp; 1))) {
                msg("Oop is no integer value");
                return interpreterProxy-&gt;primitiveFail();
        }
        intArg = (oop &gt;&gt; 1);
        if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &amp;intArg))) {
                msg("Can not add Int16 argument.");
                return interpreterProxy-&gt;primitiveFail();
        }
}</pre><br>        however, if I generate the sources using VMMaker, I get<br><br><font face="courier new,monospace">static void<br>argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter)<br>{<br>&nbsp;&nbsp;&nbsp; dbus_int16_t intArg;<br><br>

&nbsp;&nbsp;&nbsp; if (!((oop &amp; 1))) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; msg("Oop is no integer value");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; interpreterProxy-&gt;primitiveFail(); return;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; intArg = interpreterProxy-&gt;integerValueOf(oop);<br>&nbsp;&nbsp;&nbsp; if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &amp;intArg))) {<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; msg("Can not add Int16 argument.");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; interpreterProxy-&gt;primitiveFail(); return;<br>&nbsp;&nbsp;&nbsp; }<br>}</font><br><br><br>The implementation and signature are different which makes the use of this function not compile anymore:<br>

<br><pre style="font-family:courier new,monospace">[...]<br>_return_value = argumentsAddInt16toIter(arg, iter);
if (interpreterProxy-&gt;failed()) {
        return null;
}
interpreterProxy-&gt;popthenPush(3, _return_value);<br>[...]<br></pre><br>How can I change this code so that it works with the generated definition of argumentsAddInt16toIter()?<br></blockquote></div><div><br></div><div>Looks like VMMaker nowadays defaults to void? You could either declare the return type&nbsp;of argumentsAddInt16toIter, or change its call to not use the value. For reference, here's the original source:</div><div><span class="Apple-style-span" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 15px; "><pre><code>argumentsAddInt16: oop toIter: iter

        | intArg |
        
        self var: #iter type: 'DBusMessageIter*'.
        self var: #intArg type: 'dbus_int16_t'.
        (self isIntegerObject: oop)
                ifFalse: [ self msg: 'Oop is no integer value'. ^ interpreterProxy primitiveFail ].
        intArg := interpreterProxy integerValueOf: oop.
        (self cCode:'dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &amp;intArg)') 
                ifFalse:[self msg: 'Can not add Int16 argument.'. ^interpreterProxy primitiveFail].</code></pre></span><div><br></div></div><div><span class="Apple-style-span" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 15px; "><div id="page" style="font-family: Geneva, Arial, Helvetica, sans-serif; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "></div></span></div><div><span class="Apple-style-span" style="font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 15px; "><pre><code>primitiveDBusAppendBasicArgument: arg ofType: t
        "append a basic type argument to the currently topmost iterator in the iterator stack"
        
        | iter |
        self var: #iter type: 'DBusMessageIter*'.
                
        self export: true.
        self primitive: 'primitiveDBusAppendBasicArgument' parameters: #(Oop SmallInteger).
        
        iter := self cCode: '&amp;(writeMessageIter[curWriteIter])'.
        
        (t = (self cCode: 'DBUS_TYPE_BYTE')) 
                ifTrue:[^ self argumentsAddByte: arg toIter: iter ]. 
        (t = (self cCode: 'DBUS_TYPE_INT16')) 
                ifTrue:[^ self argumentsAddInt16: arg toIter: iter ].                 
        (t = (self cCode: 'DBUS_TYPE_INT32')) 
                ifTrue:[^ self argumentsAddInt32: arg toIter: iter ]. 
        (t = (self cCode: 'DBUS_TYPE_INT64')) 
                ifTrue:[^ self argumentsAddInt64: arg toIter: iter ].
        (t = (self cCode: 'DBUS_TYPE_UINT16')) 
                ifTrue:[^ self argumentsAddUInt16: arg toIter: iter ]. </code></pre></span><div><br></div></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="font-family: Helvetica; "><span class="Apple-style-span" style="font-family: Helvetica; ">- Bert -</span></div><br class="Apple-interchange-newline"></span>
</div>
<br></body></html>