#5108 - sgeos - Mon Apr 21, 2003 3:58 am
I'm currently calling main like this:
[code]
int main(void)
{
void *(*fptr)(void) = main_init; /* Start state */
while (fptr = fptr()); /* Note the semicolon */
return (0);
}[/code]
You return the address of a function to change to that state. The problem with this architecture is that I can't pass data from one state to another without global variables, and that would be very useful. Any ideas?
I think my functions might need a void pointer passed in, or soemthing to that effect.
-Brendan
[code]
int main(void)
{
void *(*fptr)(void) = main_init; /* Start state */
while (fptr = fptr()); /* Note the semicolon */
return (0);
}[/code]
You return the address of a function to change to that state. The problem with this architecture is that I can't pass data from one state to another without global variables, and that would be very useful. Any ideas?
I think my functions might need a void pointer passed in, or soemthing to that effect.
-Brendan