This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

goto to a pointer

Hello NG,
I've got the following problem: I want to store the current position in a interrupt routine and leave it. By entering the routine after the next interrupt, I want to jump to this stored position. My first idea was the following:

void irq (void) interrupt 0x14 using irq_level_2
{
static int flag = 0;
static void (*cont_here) ();

if (flag!=0) goto *cont_here;
...
if (something)
{
flag = 1;
cont_here = &here1;
goto end_irq;
}
here1:
...
if (something_else)
{
flag = 1;
cont_here = &here2;
goto end_irq;
}
here2:
...
end_irq:
}

But it doesn't work, 'cause labels and variables aren't the same and goto *bla doesn't work.
Is there a solution besides the using of setjmp and longjump (which got too much, in this case, senseless overhead)?

Thanks for any ideas - Peter

0