[Vm-dev] Compiling DBusPlugin

David T. Lewis lewis at mail.msen.com
Wed May 16 23:27:00 UTC 2012


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 at freudenbergs.de>wrote:
>
> > ... 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



More information about the Vm-dev mailing list