I have a bizarre problem… adding a #web_update directive causes my program to not compile.
I’m trying to create a web interface to change some system parameters, including the RTC and some controller setpoints.
The code structure is as follows:
// Function prototypes, including functions I want to use as callbacks
// MIMETABLE
// RESOURCETABLE
// Global variables needed for the web
// #web directives including web guards
// #web_update directives
// function definitions
// main()
if I leave out the web directives, everything compiles and runs fine - save for the few bugs that I could solve with callback functions
As soon as I add the #web_update line, using the same format as in the web_update example, I get these errors:
line 458 : ERROR ATMOSV0_4_RWEB.C : Need function definition or declaration.
line 458 : ERROR ATMOSV0_4_RWEB.C : Syntax error - or garbage at end of program.
What is going on? Are there any unwritten rules about web_update functions? I’m not trying to pass arguments, nor are my variables anything but simple.
I’ll post more code if it helps - but it’s too large to post at this point.
Hi
Try to change the order of declaration and definitions like
// Global variables needed for the web
// Function prototypes, including functions I want to use as callbacks
// #web directives including web guards
// #web_update directives
// #ximport line if ur importin any html or zhtml pages
// MIMETABLE
// RESOURCETABLE
probably this will work
reards
Aby
Abhilash,
Thanks for your response.
I think I found the cause of the problem. Here’s the documentation snippet from http://www.rabbit.com/documentation/docs/modules/RabbitWeb/
#web_update bar user_callback()
#web_update bar.a differentuser_callback()
If bar.b is updated, user_callback() is called, but if bar.a is updated, the function differentuser_callback() is called and not user_callback().
(Emphasis added)
The example code does not use the () after the callback function… here’s the web_update example from the TCPIP samples
// Each of the ports[] array elements gets its own #web_update statement so that
// we can call different update functions for each element.
#web_update ports[0] port0_update
#web_update ports[1] port1_update
#web_update ports[2] port2_update
That was the problem. Simple enough fix…
Cheers,
KB