Vincent Trouilliez <[EMAIL PROTECTED]> wrote:

> struct menu {
>       .....;
>       .....;
>       int (*fp)()[];  //table to store all the pointers
> };

Better declare them in a prototyped fashion:

        int (*fp)(void)[];

> //definition for a menu
> const struct menu __ATTR_PROGMEM__ menu_foo = {
>       .....,
>       .....,
>       {fn1, fn2, ... }
> };

Don't forget to pull out each entry from progmem.  It's probably best
to copy over an entire struct menu item at a time using memcpy_P(),
as opposed to copy in each of the struct elements individually.

> //run the specified menu using the structure passed as argument
> void menu_run(const struct menu * p)
> {
>       int r;
>       .....
>       r = (p->fp[0])();       //call the first function

Basically yes (I think), but *p needs to be in RAM already.

-- 
J"org Wunsch                                           Unix support engineer
[EMAIL PROTECTED]        http://www.interface-systems.de/~j/


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to