Lets see if i understand how setjmp/longjmp works. Using the following
sample code down below, i would call some_function from my exit function.
The call to longjmp transfers control to the line
value=setjmp(environment_buffer) Inplace of the the printf, i would put my
handling code?
#include<setjmp.h>
#include<stdio.h>
void some_function(jmp_buf);
int main(void)
{
int value;
jmp_buf environment_buffer;
value=setjmp(environment_buffer);
if(value!=0)
{
printf("Reached this point from a longjmp with value=%d.\n",value);
exit(0);
}
printf("Calling function.\n");
some_function(environment_buffer);
return 0;
}
void some_function(jmp_buf env_buf)
{
longjmp(env_buf,5);
}
Thanks,
Andrew
Adam Wozniak <[EMAIL PROTECTED]> wrote in message
news:21207@palm-dev-forum...
>
> Andrew Lathrop wrote:
>
> > I
> > have been able to write a way around most of the other c functions, but
i
> > can't figure out a way around the exit. Any ideas?
>
> setjmp/longjmp worked well enough for me...
>
> setjmp() somewhere early on where you can handle the recovery
> scenario and write a little function called exit() which calls
> longjmp().
>
> --
> Adam Wozniak Senior Software Design Engineer
> Surveyor Corporation
> [EMAIL PROTECTED] 4548 Broad Street
> [EMAIL PROTECTED] San Luis Obispo, CA 93401
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/