/*
 * Copyright (c) 1996-2006 MIPS Technologies, Inc.
 * 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *      * Redistributions of source code must retain the above copyright
 *        notice, this list of conditions and the following disclaimer.
 *      * Redistributions in binary form must reproduce the above
 *      copyright
 *        notice, this list of conditions and the following disclaimer
 *        in the documentation and/or other materials provided with
 *        the distribution.
 *      * Neither the name of MIPS Technologies Inc. nor the names of its
 *        contributors may be used to endorse or promote products derived
 *        from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * setjmp.h : setjmp/lonjmp definitions
 */


#ifndef __SETJMP_H
#ifdef __cplusplus
extern "C" {
#endif
#define __SETJMP_H


/* --- Constants --- */
#ifndef _JB_LEN

#if defined(i8088)
#define _JB_LEN	3
#elif defined(ATARI_ST)
#define _JB_LEN	13
#elif defined(__MIPSEB__) || defined(__MIPSEL__)
#define _JB_LEN 24		/* lots of registers */
#define _JB_TYPE long long	/* always use max reg size */
#elif defined(__sparc__)
#define _JB_LEN 9		/* tiny */
#elif defined(__mc68000__) || defined(__mc68020__) || defined (__mc68030__) 
#define _JB_LEN 14		/* enough */
#elif defined(__ns32000__)
#define _JB_LEN 14
#elif defined(__i386__)
#define _JB_LEN 6
#else
#error _JB_LEN not defined
#endif

#endif

#ifndef _JB_TYPE
#define _JB_TYPE int
#endif

/* --- Types --- */
typedef _JB_TYPE	jmp_buf[_JB_LEN];
typedef _JB_TYPE	sigjmp_buf[_JB_LEN + 1];

/* --- Prototypes --- */
int	setjmp (jmp_buf);
void	longjmp (jmp_buf, int);
int	sigsetjmp (sigjmp_buf, int);
void	siglongjmp (sigjmp_buf, int);
#ifndef _POSIX_SOURCE
int	_setjmp (jmp_buf);
void	_longjmp (jmp_buf, int);
#endif

#ifdef __cplusplus
}
#endif
#endif /* !defined __SETJMP_H */
