+++ /dev/null
-/** @file\r
- This file defines the macro setjmp, and declares the function longjmp\r
- and the type jmp_buf, for bypassing the normal function call and return discipline.\r
-\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#ifndef _SETJMP_H\r
-#define _SETJMP_H\r
-#include <Library/BaseLib.h>\r
-#include <sys/EfiCdefs.h>\r
-\r
-/** jmp_buf is an array type suitable for holding the information needed to\r
- restore a calling environment. The environment of a call to the setjmp\r
- macro consists of information sufficient for a call to the longjmp function\r
- to return execution to the correct block and invocation of that block, were\r
- it called recursively. It does not include the state of the floating-point\r
- status flags, of open files, or of any other component of the abstract\r
- machine.\r
-**/\r
-typedef BASE_LIBRARY_JUMP_BUFFER jmp_buf[1];\r
-\r
-/** The setjmp macro saves its calling environment in its jmp_buf argument for\r
- later use by the longjmp function.\r
-\r
- The Standard does not specify whether setjmp is a macro or an identifier\r
- declared with external linkage. If a macro definition is suppressed in\r
- order to access an actual function, or a program defines an external\r
- identifier with the name setjmp, the behavior is undefined by the Standard.\r
-\r
- @param[in,out] env A jmp_buf type object into which\r
- the current environment is stored.\r
-\r
- @return If the return is from a direct invocation, the setjmp macro\r
- returns the value zero. If the return is from a call to the longjmp\r
- function, the setjmp macro returns a nonzero value based upon the value\r
- of the second argument to the longjmp function.\r
-**/\r
-#define setjmp(env) (INTN)SetJump((env))\r
-\r
-/** The longjmp function restores the environment saved by the most recent\r
- invocation of the setjmp macro in the same invocation of the program with\r
- the corresponding jmp_buf argument. If there has been no such invocation,\r
- or if the function containing the invocation of the setjmp macro has\r
- terminated execution in the interim, or if the invocation of the setjmp\r
- macro was within the scope of an identifier with variably modified type and\r
- execution has left that scope in the interim, the behavior is undefined.\r
-\r
- @param[in] env The jump buffer containing the environment to be returned to.\r
- @param[in] val A non-zero value to be returned from setjmp.\r
-\r
- @return After longjmp is completed, program execution continues as if the\r
- corresponding invocation of the setjmp macro had just returned the value\r
- specified by val. The longjmp function cannot cause the setjmp macro to\r
- return the value 0; if val is 0, the setjmp macro returns the value 1.\r
-**/\r
-extern void longjmp(jmp_buf env, int val);\r
-\r
-#endif /* _SETJMP_H */\r