Hi,
the official DBusPlugin source file defines argumentsAddInt16toIter() as
static sqInt argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) { dbus_int16_t intArg;
if (!((oop & 1))) { msg("Oop is no integer value"); return interpreterProxy->primitiveFail(); } intArg = (oop >> 1); if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &intArg))) { msg("Can not add Int16 argument."); return interpreterProxy->primitiveFail(); } }
however, if I generate the sources using VMMaker, I get
static void argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) { dbus_int16_t intArg;
if (!((oop & 1))) { msg("Oop is no integer value"); interpreterProxy->primitiveFail(); return; } intArg = interpreterProxy->integerValueOf(oop); if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &intArg))) { msg("Can not add Int16 argument."); interpreterProxy->primitiveFail(); return; } }
The implementation and signature are different which makes the use of this function not compile anymore:
[...] _return_value = argumentsAddInt16toIter(arg, iter); if (interpreterProxy->failed()) { return null; } interpreterProxy->popthenPush(3, _return_value); [...]
How can I change this code so that it works with the generated definition of argumentsAddInt16toIter()?
Thank you
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
On 16.05.2012, at 17:41, Damien Cassou wrote:
Hi,
the official DBusPlugin source file defines argumentsAddInt16toIter() as
static sqInt argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) { dbus_int16_t intArg;
if (!((oop & 1))) { msg("Oop is no integer value"); return interpreterProxy->primitiveFail(); } intArg = (oop >> 1); if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &intArg))) { msg("Can not add Int16 argument."); return interpreterProxy->primitiveFail(); } }
however, if I generate the sources using VMMaker, I get
static void argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) { dbus_int16_t intArg;
if (!((oop & 1))) { msg("Oop is no integer value"); interpreterProxy->primitiveFail(); return; } intArg = interpreterProxy->integerValueOf(oop); if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &intArg))) { msg("Can not add Int16 argument."); interpreterProxy->primitiveFail(); return; }
}
The implementation and signature are different which makes the use of this function not compile anymore:
[...] _return_value = argumentsAddInt16toIter(arg, iter); if (interpreterProxy->failed()) { return null; } interpreterProxy->popthenPush(3, _return_value); [...]
How can I change this code so that it works with the generated definition of argumentsAddInt16toIter()?
Looks like VMMaker nowadays defaults to void? You could either declare the return type of argumentsAddInt16toIter, or change its call to not use the value. For reference, here's the original source: 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, &intArg)') ifFalse:[self msg: 'Can not add Int16 argument.'. ^interpreterProxy primitiveFail].
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: '&(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 ].
- Bert -
On Wed, May 16, 2012 at 5:57 PM, Bert Freudenberg bert@freudenbergs.dewrote:
Looks like VMMaker nowadays defaults to void? You could either declare the return type of argumentsAddInt16toIter, or change its call to not use the value.
I changed ifTrue:[^ self argumentsAddByte: arg toIter: iter ]. to ifTrue:[self argumentsAddByte: arg toIter: iter. ^self ].
does that make sense? If yes, can I send you the resulting mcz?
On 16.05.2012, at 18:02, Damien Cassou wrote:
On Wed, May 16, 2012 at 5:57 PM, Bert Freudenberg bert@freudenbergs.de wrote: Looks like VMMaker nowadays defaults to void? You could either declare the return type of argumentsAddInt16toIter, or change its call to not use the value.
I changed ifTrue:[^ self argumentsAddByte: arg toIter: iter ]. to ifTrue:[self argumentsAddByte: arg toIter: iter. ^self ].
does that make sense? If yes, can I send you the resulting mcz?
Sure. Looks reasonable.
- Bert -
On 16.05.2012, at 18:05, Bert Freudenberg wrote:
On 16.05.2012, at 18:02, Damien Cassou wrote:
On Wed, May 16, 2012 at 5:57 PM, Bert Freudenberg bert@freudenbergs.de wrote: Looks like VMMaker nowadays defaults to void? You could either declare the return type of argumentsAddInt16toIter, or change its call to not use the value.
I changed ifTrue:[^ self argumentsAddByte: arg toIter: iter ]. to ifTrue:[self argumentsAddByte: arg toIter: iter. ^self ].
does that make sense? If yes, can I send you the resulting mcz?
Sure. Looks reasonable.
- Bert -
... and I just gave you commit rights, so feel free to commit directly to the dbus repository.
- Bert -
On Wed, May 16, 2012 at 6:10 PM, Bert Freudenberg bert@freudenbergs.dewrote:
... and I just gave you commit rights, so feel free to commit directly to the dbus repository.
done, thank you
On Wed, May 16, 2012 at 05:57:53PM +0200, Bert Freudenberg wrote:
On 16.05.2012, at 17:41, Damien Cassou wrote:
Hi,
the official DBusPlugin source file defines argumentsAddInt16toIter() as
static sqInt argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) { dbus_int16_t intArg;
if (!((oop & 1))) { msg("Oop is no integer value"); return interpreterProxy->primitiveFail(); } intArg = (oop >> 1); if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &intArg))) { msg("Can not add Int16 argument."); return interpreterProxy->primitiveFail(); } }
however, if I generate the sources using VMMaker, I get
static void argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) { dbus_int16_t intArg;
if (!((oop & 1))) { msg("Oop is no integer value"); interpreterProxy->primitiveFail(); return; } intArg = interpreterProxy->integerValueOf(oop); if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &intArg))) { msg("Can not add Int16 argument."); interpreterProxy->primitiveFail(); return; }
}
The implementation and signature are different which makes the use of this function not compile anymore:
[...] _return_value = argumentsAddInt16toIter(arg, iter); if (interpreterProxy->failed()) { return null; } interpreterProxy->popthenPush(3, _return_value); [...]
How can I change this code so that it works with the generated definition of argumentsAddInt16toIter()?
Looks like VMMaker nowadays defaults to void? You could either declare the return type of argumentsAddInt16toIter, or change its call to not use the value.
FYI, this is a change to code generation in the oscog branch of VMMaker that has not yet been incorporated in trunk VMMaker, which currently still translates the method as:
static sqInt argumentsAddInt16toIter(sqInt oop, DBusMessageIter*iter) { dbus_int16_t intArg;
if (!((oop & 1))) { msg("Oop is no integer value"); return interpreterProxy->primitiveFail(); } intArg = (oop >> 1); if (!(dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &intArg))) { msg("Can not add Int16 argument."); return interpreterProxy->primitiveFail(); } }
On Wed, May 16, 2012 at 06:11:34PM +0200, Damien Cassou wrote:
On Wed, May 16, 2012 at 6:10 PM, Bert Freudenberg bert@freudenbergs.dewrote:
... and I just gave you commit rights, so feel free to commit directly to the dbus repository.
done, thank you
To confirm: The DBus-Plugin-DamienCassou.34 update compiles cleanly on trunk VMMaker also, so good fix.
Dave
vm-dev@lists.squeakfoundation.org