/* SETJMP.h
 *
 * That jmp_buf is declared as a typdefed array is a pain when trying
 * declare functions returning them.
 *
 * This is a work-around that encapsulates the jmp_buf in a struct.
 */

#ifndef JUMP_H_INCLUDED
#define JUMP_H_INCLUDED

#include <setjmp.h>

typedef struct { jmp_buf jmp; } _JMP_BUF;

#define JMP_BUF _JMP_BUF

#if DBUG
#define SETJMP(buf) (fprintf(stderr,"setjmp(%p)\n", (buf).jmp), \
		     setjmp((buf).jmp))
#define LONGJMP(buf, value) \
(fprintf(stderr, "longjmp(%p, %d)\n", (buf).jmp, (value)), \
 longjmp((buf).jmp, (value)))
#else
#define SETJMP(buf) (setjmp((buf).jmp))
#define LONGJMP(buf, value) (longjmp((buf).jmp, (value)))
#endif
#endif JUMP_H_INCLUDED
