What more could I possibly want ? Well, there is one thing actually:
the pointer points to a function, any function. However if the item is
actually a sub-menu, then the 'menu_item' structure needs to store a
pointer to a 'menu' structure, so that I know what sub-menu to run.
So it would like this:
typedef struct {
char name[21];
void (*fp) (uint8_t);
menu *sub_menu; // I need to know what sub-menu to run !
}menu_item;
typedef struct menu {
char title[21];
uint8_t nb;
menu_item items[];
}menu;
But it's a bit strange no ? :-/ How can I declare a pointer of 'menu'
type... even before said type has been declared ! The two structures
would be interdependent... no solution in sight ! :o((((
I guess this is crap code again... heeelp...