[Tinyos-devel] Proposed interface for Nucleus attributes, events, and commands

David Gay dgay42 at gmail.com
Wed Feb 16 16:45:30 PST 2005

>     // I am unsure whether an @-tag can be attached to a statement like this
>     // In my preferred interface, fire() would be a varargs function
> like printf.
>     // In the meantime, you would have to fill a structure and pass
> the structure
>     // as an argument.
>     signal BoringEvent.fire(&boring)
>       @nucleusEventString("This event is boring event number %d");

No '@' annotations on statements or expressions, for now at least.
However, there's a good chance you'll get varargs functions in
interfaces w/ nesC 1.2...

Summary of how that would work:

interface Foo {
  command void myvarargs(int x, ...);

module Blah {
  provides interface Foo;
implementation {
  command void Foo.myvarags(int x, va_list args) {
     /* va_start and va_end have alreasdy been called! */

Note that the modules will get called with a va_list argument, not
with the "..." (if you think about multiply-wired functions, you'll
see that this is pretty much a requirement).

To support interposition, designers of interfaces with vararg
functions should always provide the va_list based version too (this is
a good idea anyway...), i.e.,

interface IO {
  command void printf(char *format, ...);
  command void vprintf(char *format, va_list args);


More information about the Tinyos-devel mailing list