Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / libcc.ansi / headers / setjmp.h
1 /*
2  * setjmp.h - save/restore calling environment
3  *
4  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
5  * See the copyright notice in the ACK home directory, in the file "Copyright".
6  */
7 /* $Id: setjmp.h,v 1.8 1994/06/24 11:41:07 ceriel Exp $ */
8
9 #if     !defined(_SETJMP_H)
10 #define _SETJMP_H
11
12 /* In a jmp_buf, there is room for:  1 mask (long), 1 flag (int) and 3
13  * pointers (stack-pointer, local base and program-counter). This may be
14  * too big, but that doesn't matter. It could also be too small, when
15  * sigset_t is larger than a long.  The fields is in the structure have no
16  * meaning, they just get the size right.
17  * The identifier __setjmp has a special meaning to the compiler.
18  */
19
20 typedef struct {
21         long __mask;
22         int __flag;
23         void (*__pc)(void);
24         void *__sp;
25         void *__lb;
26 } jmp_buf[1];
27
28 int     __setjmp(jmp_buf _env, int _savemask);
29
30 #define setjmp(env)     __setjmp(env, 0)
31 void    longjmp(jmp_buf _env, int _val);
32
33 #if defined(_POSIX_SOURCE)
34 typedef jmp_buf sigjmp_buf;
35 #define sigsetjmp(env, savemask)        __setjmp(env, savemask)
36 int     siglongjmp(sigjmp_buf _env, int _val);
37 #endif
38
39 #endif  /* _SETJMP_H */