|
|
1.1 root 1: /***
2: *setjmp.h - definitions/declarations for setjmp/longjmp routines
3: *
4: * Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
5: *
6: *Purpose:
7: * This file defines the machine-dependent buffer used by
8: * setjmp/longjmp to save and restore the program state, and
9: * declarations for those routines.
10: * [ANSI/System V]
11: *
1.1.1.2 root 12: * The setjmp() that will be used by those who include this file
13: * is _setjmpex, which is safe for use with try/except/finally,
14: * but is slow. See <crt/setjmpex.h> and <crt/setjmp.h> for more.
15: *
1.1 root 16: ****/
17:
18: #ifndef _INC_SETJMP
19:
1.1.1.2 root 20: #include <signal.h>
21:
1.1 root 22: #ifndef __cplusplus
23:
24:
25: /*
26: * Conditional macro definition for function calling type and variable type
27: * qualifiers.
28: */
29: #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
30:
31: /*
32: * Definitions for MS C8-32 (386/486) compiler
33: */
34: #define _CRTAPI1 __cdecl
35: #define _CRTAPI2 __cdecl
36:
37: #elif ( _MSC_VER == 600 )
38:
39: /*
40: * Definitions for old MS C6-386 compiler
41: */
42: #define _CRTAPI1 _cdecl
43: #define _CRTAPI2 _cdecl
44: #define _M_IX86 300
45:
46: #else
47:
48: /*
49: * Other compilers (e.g., MIPS)
50: */
51: #define _CRTAPI1
52: #define _CRTAPI2
53:
54: #endif
55:
56: /*
1.1.1.2 root 57: * Posix programs use _setjmpex by default.
58: */
59:
60: #define setjmp _setjmpex
61:
62: /*
1.1 root 63: * Definitions specific to particular setjmp implementations.
64: */
65: #ifdef _M_IX86
66:
67: /*
68: * MS C8-32 or older MS C6-386 compilers
69: */
70: #define _JBLEN 8
1.1.1.2 root 71: #define _JBTYPE int
72:
73: /*
74: * Define jump buffer layout for x86 setjmp/longjmp
75: */
76:
77: typedef struct __JUMP_BUFFER {
78: unsigned long Ebp;
79: unsigned long Ebx;
80: unsigned long Edi;
81: unsigned long Esi;
82: unsigned long Esp;
83: unsigned long Eip;
84: unsigned long Registration;
85: unsigned long TryLevel;
86: } _JUMP_BUFFER;
1.1 root 87:
88: #else
89:
90: /*
91: * Assume compiler implements setjmp as a function
92: */
93:
94: #define _setjmp setjmp
95:
96: #endif
97:
98:
1.1.1.2 root 99: #if ( defined(_M_RX000) || defined(_MIPS_) )
100: /*
101: * All MIPS implementations need _JBLEN of 16
102: */
103: #define _JBLEN 16
104: #define _JBTYPE double
105:
106: /*
107: * Define jump buffer layout for MIPS setjmp/longjmp.
108: */
109:
110: typedef struct __JUMP_BUFFER {
111: unsigned long FltF20;
112: unsigned long FltF21;
113: unsigned long FltF22;
114: unsigned long FltF23;
115: unsigned long FltF24;
116: unsigned long FltF25;
117: unsigned long FltF26;
118: unsigned long FltF27;
119: unsigned long FltF28;
120: unsigned long FltF29;
121: unsigned long FltF30;
122: unsigned long FltF31;
123: unsigned long IntS0;
124: unsigned long IntS1;
125: unsigned long IntS2;
126: unsigned long IntS3;
127: unsigned long IntS4;
128: unsigned long IntS5;
129: unsigned long IntS6;
130: unsigned long IntS7;
131: unsigned long IntS8;
132: unsigned long Type;
133: unsigned long Fir;
134: } _JUMP_BUFFER;
135:
136: #endif
137:
138: #if defined(_ALPHA_)
139:
1.1 root 140: /*
1.1.1.3 ! root 141: * Alpha implementations use a _JBLEN of 24 quadwords.
! 142: * A double is used only to obtain quadword size and alignment.
1.1 root 143: */
1.1.1.2 root 144:
1.1.1.3 ! root 145: #define _JBLEN 24
1.1.1.2 root 146: #define _JBTYPE double
1.1 root 147:
1.1.1.3 ! root 148: /*
! 149: * Define jump buffer layout for Alpha setjmp/longjmp.
! 150: * A double is used only to obtain quadword size and alignment.
! 151: */
! 152:
! 153: typedef struct __JUMP_BUFFER {
! 154: unsigned long Fp;
! 155: unsigned long Pc;
! 156: unsigned long Seb;
! 157: unsigned long Type;
! 158: double FltF2;
! 159: double FltF3;
! 160: double FltF4;
! 161: double FltF5;
! 162: double FltF6;
! 163: double FltF7;
! 164: double FltF8;
! 165: double FltF9;
! 166: double IntS0;
! 167: double IntS1;
! 168: double IntS2;
! 169: double IntS3;
! 170: double IntS4;
! 171: double IntS5;
! 172: double IntS6;
! 173: double IntSp;
! 174: double Fir;
! 175: double Fill[5];
! 176: } _JUMP_BUFFER;
! 177:
1.1 root 178: #endif
179:
180: /* define the buffer type for holding the state information */
181:
182: #ifndef _JMP_BUF_DEFINED
1.1.1.2 root 183: typedef _JBTYPE jmp_buf[_JBLEN];
1.1 root 184: #define _JMP_BUF_DEFINED
185: #endif
186:
187: #ifndef _SIGJMP_BUF_DEFINED
188: #define _SIGJMP_BUF_DEFINED
189: /*
190: * sigjmp buf is just a jmp_buf plus an int to say whether the sigmask
191: * is saved or not, and a sigmask_t for the mask if it is saved.
1.1.1.2 root 192: */
1.1 root 193:
1.1.1.2 root 194: typedef _JBTYPE sigjmp_buf[_JBLEN + 2];
1.1 root 195: #endif /* _SIGJMP_BUF_DEFINED */
196:
1.1.1.2 root 197: extern _JBTYPE * _CRTAPI1 _sigjmp_store_mask(sigjmp_buf, int);
198:
199: #define sigsetjmp(_env, _save) \
200: setjmp(_sigjmp_store_mask((_env), (_save)))
1.1 root 201:
202: /* function prototypes */
203:
204: int _CRTAPI1 setjmp(jmp_buf);
205: void _CRTAPI1 longjmp(jmp_buf, int);
206: void _CRTAPI1 siglongjmp(sigjmp_buf, int);
207:
208: /* function prototypes */
209:
210: #endif /* __cplusplus */
211:
212: #define _INC_SETJMP
213: #endif /* _INC_SETJMP */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.