home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Club Elmshorn Atari PD
/
CCE_PD.iso
/
pc
/
0600
/
CCE_0638.ZIP
/
CCE_0638
/
GNULIB
/
LIBSRC93.ZOO
/
catch.c
next >
Wrap
C/C++ Source or Header
|
1991-04-12
|
371b
|
19 lines
#include <setjmp.h>
static int _catchval; /* catch/throw return value */
int catch(id, fn) /* execute fn() within a catch frame */
register jmp_buf id;
register int (*fn)(void);
{
return(setjmp(id) ? _catchval : ((*fn)()));
}
void throw(id, rv) /* return rv to the id catch */
register jmp_buf id;
register int rv;
{
_catchval = rv;
longjmp(id, 1);
}