]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /** @file\r |
2 | The header <setjmp.h> defines the macro setjmp, and declares one function\r | |
3 | and one type, for bypassing the normal function call and return discipline.\r | |
4 | \r | |
5 | Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials are licensed and made available under\r | |
7 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
8 | The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | #ifndef _SETJMP_H\r | |
16 | #define _SETJMP_H\r | |
17 | #include <Library/BaseLib.h>\r | |
18 | #include <sys/EfiCdefs.h>\r | |
19 | \r | |
20 | /** jmp_buf is an array type suitable for holding the information needed to\r | |
21 | restore a calling environment. The environment of a call to the setjmp\r | |
22 | macro consists of information sufficient for a call to the longjmp function\r | |
23 | to return execution to the correct block and invocation of that block, were\r | |
24 | it called recursively. It does not include the state of the floating-point\r | |
25 | status flags, of open files, or of any other component of the abstract\r | |
26 | machine.\r | |
27 | **/\r | |
28 | typedef BASE_LIBRARY_JUMP_BUFFER jmp_buf[1];\r | |
29 | \r | |
30 | /** The setjmp macro saves its calling environment in its jmp_buf argument for\r | |
31 | later use by the longjmp function.\r | |
32 | \r | |
33 | The Standard does not specify whether setjmp is a macro or an identifier\r | |
34 | declared with external linkage. If a macro definition is suppressed in\r | |
35 | order to access an actual function, or a program defines an external\r | |
36 | identifier with the name setjmp, the behavior is undefined by the Standard.\r | |
37 | \r | |
38 | @param[in,out] env A jmp_buf type object into which\r | |
39 | the current environment is stored.\r | |
40 | \r | |
41 | @return If the return is from a direct invocation, the setjmp macro\r | |
42 | returns the value zero. If the return is from a call to the longjmp\r | |
43 | function, the setjmp macro returns a nonzero value.\r | |
44 | **/\r | |
45 | #define setjmp(env) (INTN)SetJump((env))\r | |
46 | \r | |
47 | /** The longjmp function restores the environment saved by the most recent\r | |
48 | invocation of the setjmp macro in the same invocation of the program with\r | |
49 | the corresponding jmp_buf argument. If there has been no such invocation,\r | |
50 | or if the function containing the invocation of the setjmp macro has\r | |
51 | terminated execution in the interim, or if the invocation of the setjmp\r | |
52 | macro was within the scope of an identifier with variably modified type and\r | |
53 | execution has left that scope in the interim, the behavior is undefined.\r | |
54 | \r | |
55 | After longjmp is completed, program execution continues as if the\r | |
56 | corresponding invocation of the setjmp macro had just returned the value\r | |
57 | specified by val. The longjmp function cannot cause the setjmp macro to\r | |
58 | return the value 0; if val is 0, the setjmp macro returns the value 1.\r | |
59 | **/\r | |
60 | extern void longjmp(jmp_buf env, int val);\r | |
61 | \r | |
62 | #endif /* _SETJMP_H */\r |