OSDN Git Service

Apply LICENSE to all files as appropriate.
[mingw/mingw-org-wsl.git] / include / setjmp.h
1 /**
2  * @file setjmp.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 /* 
25  * setjmp.h
26  * This file has no copyright assigned and is placed in the Public Domain.
27  * This file is a part of the mingw-runtime package.
28  * No warranty is given; refer to the file DISCLAIMER within the package.
29  *
30  * Declarations supporting setjmp and longjump, a method for avoiding
31  * the normal function call return sequence. (Bleah!)
32  *
33  */
34
35 #ifndef _SETJMP_H_
36 #define _SETJMP_H_
37
38 /* All the headers include this file. */
39 #include <_mingw.h>
40
41 #ifndef RC_INVOKED
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /*
48  * The buffer used by setjmp to store the information used by longjmp
49  * to perform it's evil goto-like work. The size of this buffer was
50  * determined through experimentation; it's contents are a mystery.
51  * NOTE: This was determined on an i386 (actually a Pentium). The
52  *       contents could be different on an Alpha or something else.
53  */
54 #define _JBLEN 16
55 #define _JBTYPE int
56 typedef _JBTYPE jmp_buf[_JBLEN];
57
58 /*
59  * The function provided by CRTDLL which appears to do the actual work
60  * of setjmp.
61  */
62 _CRTIMP int __cdecl __MINGW_NOTHROW _setjmp (jmp_buf);
63
64 #define setjmp(x)       _setjmp(x)
65
66 /*
67  * Return to the last setjmp call and act as if setjmp had returned
68  * nVal (which had better be non-zero!).
69  */
70 _CRTIMP void __cdecl __MINGW_NOTHROW longjmp (jmp_buf, int) __MINGW_ATTRIB_NORETURN;
71
72 #ifdef __cplusplus
73 }
74 #endif
75
76 #endif  /* Not RC_INVOKED */
77
78 #endif  /* Not _SETJMP_H_ */
79