David - Thanks for the help. It worked.
Cory - not quite. Interestingly enough, how you solved the problem is exactly how I had my program working until now. However, I need to be able to call the variable-argument-list function from my module, but I do not want the code for the vararg function in that module. That means that myfun() in your example would need to be a command. As far as I understand, the limitation with nesC is that there cannot be varargs in commands (externally exposed), but they are acceptable in internal functions.
Thanks again for the help, guys.
Cheers.
Cory - not quite. Interestingly enough, how you solved the problem is exactly how I had my program working until now. However, I need to be able to call the variable-argument-list function from my module, but I do not want the code for the vararg function in that module. That means that myfun() in your example would need to be a command. As far as I understand, the limitation with nesC is that there cannot be varargs in commands (externally exposed), but they are acceptable in internal functions.
Thanks again for the help, guys.
Cheers.
-jay
On 7/7/06, Cory Sharp <
[EMAIL PROTECTED]> wrote:
Jay, this works fine for me. Does it do what you want?
// a portion of a nesC module implementation
uint16_t m_count;
void myfun( int n, ... ) {
va_list args;
int count;
va_start( args, n );
count = va_arg( args, int );
va_end( args );
call Leds.set( count );
}
event void Timer.fired() {
m_count++;
myfun( 1, m_count );
}
- Cory
On 7/7/06, Jay Taneja < [EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a program where some processing is performed in an included C
> function. Ideally, I would like the C function to call and return the
> result of a nesC command. The reason I am using C is because the
> function takes a variable number of arguments, a feature not yet
> supported in nesC. However, I am unsure if there is any way to call a
> nesC command in my C function. I realize it is possible to have the C
> function simply return the parameters to be passed to the nesC
> command, but that involves two separate operations to be called in my
> module. Any ideas how to get around this?
>
> Here is some simple code:
>
> # myfile.h
> bool my_func(int number, ...);
>
> # myfile.c
> bool my_func(int number, ...) {
> return call MyProg.my_cmd(number);
> }
>
> Hopefully I've described the issue enough. Thanks.
>
> -jay
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
