| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#ifndef ECL_STACKS_H |
| 16 |
#define ECL_STACKS_H |
| 17 |
|
| 18 |
#include <ecl/ecl_atomics.h> |
| 19 |
|
| 20 |
#ifdef __cplusplus |
| 21 |
extern "C" { |
| 22 |
#endif |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifdef ECL_DOWN_STACK |
| 29 |
#define ecl_cs_check(env,var) \ |
| 30 |
if (ecl_unlikely((char*)(&var) <= (env)->c_stack.limit)) ecl_cs_overflow() |
| 31 |
#else |
| 32 |
#define ecl_cs_check(env,var) \ |
| 33 |
if (ecl_unlikely((char*)(&var) >= (env)->c_stack.limit)) ecl_cs_overflow() |
| 34 |
#endif |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
typedef struct ecl_bds_frame { |
| 76 |
cl_object symbol; |
| 77 |
cl_object value; |
| 78 |
} *ecl_bds_ptr; |
| 79 |
|
| 80 |
#define ecl_bds_check(env) \ |
| 81 |
(ecl_unlikely(env->bds_stack.top >= env->bds_stack.limit)? (ecl_bds_overflow(),1) : 0) |
| 82 |
|
| 83 |
#define ECL_MISSING_SPECIAL_BINDING (~((cl_index)0)) |
| 84 |
|
| 85 |
extern ECL_API ecl_bds_ptr ecl_bds_overflow(void); |
| 86 |
extern ECL_API void ecl_bds_bind(cl_env_ptr env, cl_object symbol, cl_object v); |
| 87 |
extern ECL_API void ecl_bds_push(cl_env_ptr env, cl_object symbol); |
| 88 |
extern ECL_API void ecl_bds_unwind1(cl_env_ptr env); |
| 89 |
extern ECL_API void ecl_bds_unwind_n(cl_env_ptr env, int n); |
| 90 |
#ifdef ECL_THREADS |
| 91 |
extern ECL_API cl_object ecl_bds_read(cl_env_ptr env, cl_object s); |
| 92 |
extern ECL_API cl_object *ecl_bds_ref(cl_env_ptr env, cl_object s); |
| 93 |
extern ECL_API cl_object ecl_bds_set(cl_env_ptr env, cl_object s, cl_object v); |
| 94 |
# define ECL_SYM_VAL(env,s) (ecl_bds_read(env,s)) |
| 95 |
# define ECL_SET(s,v) ((s)->symbol.value=(v)) |
| 96 |
# define ECL_SETQ(env,s,v) (*ecl_bds_ref(env,s)=(v)) |
| 97 |
#else |
| 98 |
# define ECL_SYM_VAL(env,s) ((s)->symbol.value) |
| 99 |
# define ECL_SET(s,v) ((s)->symbol.value=(v)) |
| 100 |
# define ECL_SETQ(env,s,v) ((s)->symbol.value=(v)) |
| 101 |
#endif |
| 102 |
|
| 103 |
#ifdef ECL_THREADS |
| 104 |
static inline void |
| 105 |
ecl_bds_bind_inl(cl_env_ptr env, cl_object s, cl_object v) |
| 106 |
{ |
| 107 |
ecl_bds_ptr slot; |
| 108 |
cl_object *location; |
| 109 |
const cl_index index = s->symbol.binding; |
| 110 |
if (index >= env->bds_stack.tl_bindings_size) { |
| 111 |
ecl_bds_bind(env,s,v); |
| 112 |
} else { |
| 113 |
location = env->bds_stack.tl_bindings + index; |
| 114 |
slot = env->bds_stack.top+1; |
| 115 |
if (slot >= env->bds_stack.limit) slot = ecl_bds_overflow(); |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
slot->symbol = ECL_DUMMY_TAG; |
| 120 |
AO_nop_full(); |
| 121 |
++env->bds_stack.top; |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
ecl_disable_interrupts_env(env); |
| 126 |
slot->symbol = s; |
| 127 |
slot->value = *location; |
| 128 |
*location = v; |
| 129 |
ecl_enable_interrupts_env(env); |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
static inline void |
| 134 |
ecl_bds_push_inl(cl_env_ptr env, cl_object s) |
| 135 |
{ |
| 136 |
ecl_bds_ptr slot; |
| 137 |
cl_object *location; |
| 138 |
const cl_index index = s->symbol.binding; |
| 139 |
if (index >= env->bds_stack.tl_bindings_size) { |
| 140 |
ecl_bds_push(env, s); |
| 141 |
} else { |
| 142 |
location = env->bds_stack.tl_bindings + index; |
| 143 |
slot = env->bds_stack.top+1; |
| 144 |
if (slot >= env->bds_stack.limit) slot = ecl_bds_overflow(); |
| 145 |
slot->symbol = ECL_DUMMY_TAG; |
| 146 |
AO_nop_full(); |
| 147 |
++env->bds_stack.top; |
| 148 |
ecl_disable_interrupts_env(env); |
| 149 |
slot->symbol = s; |
| 150 |
slot->value = *location; |
| 151 |
if (*location == ECL_NO_TL_BINDING) *location = s->symbol.value; |
| 152 |
ecl_enable_interrupts_env(env); |
| 153 |
} |
| 154 |
} |
| 155 |
|
| 156 |
static inline void |
| 157 |
ecl_bds_unwind1_inl(cl_env_ptr env) |
| 158 |
{ |
| 159 |
cl_object s = env->bds_stack.top->symbol; |
| 160 |
cl_object *location = env->bds_stack.tl_bindings + s->symbol.binding; |
| 161 |
*location = env->bds_stack.top->value; |
| 162 |
--env->bds_stack.top; |
| 163 |
} |
| 164 |
|
| 165 |
static inline cl_object |
| 166 |
ecl_bds_read_inl(cl_env_ptr env, cl_object s) |
| 167 |
{ |
| 168 |
cl_index index = s->symbol.binding; |
| 169 |
if (index < env->bds_stack.tl_bindings_size) { |
| 170 |
cl_object x = env->bds_stack.tl_bindings[index]; |
| 171 |
if (x != ECL_NO_TL_BINDING) return x; |
| 172 |
} |
| 173 |
return s->symbol.value; |
| 174 |
} |
| 175 |
static inline cl_object * |
| 176 |
ecl_bds_ref_inl(cl_env_ptr env, cl_object s) |
| 177 |
{ |
| 178 |
cl_index index = s->symbol.binding; |
| 179 |
if (index < env->bds_stack.tl_bindings_size) { |
| 180 |
cl_object *location = env->bds_stack.tl_bindings + index; |
| 181 |
if (*location != ECL_NO_TL_BINDING) return location; |
| 182 |
} |
| 183 |
return &s->symbol.value; |
| 184 |
} |
| 185 |
|
| 186 |
# define ecl_bds_set(env,s,v) (*ecl_bds_ref_inl(env,s)=(v)) |
| 187 |
# define ecl_bds_read ecl_bds_read_inl |
| 188 |
|
| 189 |
#else |
| 190 |
static inline void |
| 191 |
ecl_bds_bind_inl(cl_env_ptr env, cl_object s, cl_object v) |
| 192 |
{ |
| 193 |
ecl_bds_ptr slot; |
| 194 |
slot = ++env->bds_stack.top; |
| 195 |
if (slot >= env->bds_stack.limit) slot = ecl_bds_overflow(); |
| 196 |
ecl_disable_interrupts_env(env); |
| 197 |
slot->symbol = s; |
| 198 |
slot->value = s->symbol.value; |
| 199 |
s->symbol.value = v; |
| 200 |
ecl_enable_interrupts_env(env); |
| 201 |
} |
| 202 |
|
| 203 |
static inline void |
| 204 |
ecl_bds_push_inl(cl_env_ptr env, cl_object s) |
| 205 |
{ |
| 206 |
ecl_bds_ptr slot; |
| 207 |
slot = ++env->bds_stack.top; |
| 208 |
if (slot >= env->bds_stack.limit) slot = ecl_bds_overflow(); |
| 209 |
ecl_disable_interrupts_env(env); |
| 210 |
slot->symbol = s; |
| 211 |
slot->value = s->symbol.value; |
| 212 |
ecl_enable_interrupts_env(env); |
| 213 |
} |
| 214 |
|
| 215 |
static inline void |
| 216 |
ecl_bds_unwind1_inl(cl_env_ptr env) |
| 217 |
{ |
| 218 |
cl_object s = env->bds_stack.top->symbol; |
| 219 |
s->symbol.value = env->bds_stack.top->value; |
| 220 |
--env->bds_stack.top; |
| 221 |
} |
| 222 |
#endif |
| 223 |
|
| 224 |
#define ecl_bds_bind ecl_bds_bind_inl |
| 225 |
#define ecl_bds_push ecl_bds_push_inl |
| 226 |
#define ecl_bds_unwind1 ecl_bds_unwind1_inl |
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
typedef struct ecl_ihs_frame { |
| 233 |
struct ecl_ihs_frame *next; |
| 234 |
cl_object function; |
| 235 |
cl_object lex_env; |
| 236 |
cl_index index; |
| 237 |
cl_index bds; |
| 238 |
} *ecl_ihs_ptr; |
| 239 |
|
| 240 |
#define ecl_ihs_push(env,rec,fun,lisp_env) do { \ |
| 241 |
const cl_env_ptr __the_env = (env); \ |
| 242 |
ecl_ihs_ptr const r = (ecl_ihs_ptr const)(rec); \ |
| 243 |
r->next=__the_env->ihs_stack.top; \ |
| 244 |
r->function=(fun); \ |
| 245 |
r->lex_env=(lisp_env); \ |
| 246 |
r->index=__the_env->ihs_stack.top->index+1; \ |
| 247 |
r->bds=__the_env->bds_stack.top - __the_env->bds_stack.org; \ |
| 248 |
__the_env->ihs_stack.top = r; \ |
| 249 |
} while(0) |
| 250 |
|
| 251 |
#define ecl_ihs_pop(env) do { \ |
| 252 |
const cl_env_ptr __the_env = (env); \ |
| 253 |
ecl_ihs_ptr r = __the_env->ihs_stack.top; \ |
| 254 |
if (r) __the_env->ihs_stack.top = r->next; \ |
| 255 |
} while(0) |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
typedef struct ecl_frame { |
| 281 |
jmp_buf frs_jmpbuf; |
| 282 |
cl_object frs_val; |
| 283 |
ecl_ihs_ptr frs_ihs; |
| 284 |
cl_index frs_bds_ndx; |
| 285 |
cl_index frs_run_ndx; |
| 286 |
} *ecl_frame_ptr; |
| 287 |
|
| 288 |
extern ECL_API ecl_frame_ptr _ecl_frs_push(cl_env_ptr); |
| 289 |
#define ecl_frs_push(env,val) \ |
| 290 |
ecl_frame_ptr __frame = _ecl_frs_push(env); \ |
| 291 |
ecl_disable_interrupts_env(env); \ |
| 292 |
__frame->frs_val = val; \ |
| 293 |
int __ecl_frs_push_result = ecl_setjmp(__frame->frs_jmpbuf); \ |
| 294 |
ecl_enable_interrupts_env(env) |
| 295 |
|
| 296 |
#define ecl_frs_pop(env) ((env)->frs_stack.top--) |
| 297 |
#define ecl_frs_pop_n(env,n) ((env)->frs_stack.top-=n) |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
#define ecl_va_start(a,p,n,k) { \ |
| 324 |
a[0].narg = (n)-(k); \ |
| 325 |
va_start(a[0].args,p); \ |
| 326 |
a[0].sp = ((n) <= ECL_C_ARGUMENTS_LIMIT)? 0 : _ecl_va_sp(k); } |
| 327 |
#define ecl_va_arg(a) \ |
| 328 |
(a[0].narg--,(a[0].sp? *(a[0].sp++) : va_arg(a[0].args,cl_object))) |
| 329 |
#define ecl_va_copy(dest,orig) { \ |
| 330 |
dest[0].narg = orig[0].narg; \ |
| 331 |
dest[0].sp = orig[0].sp; \ |
| 332 |
va_copy(dest[0].args,orig[0].args); \ |
| 333 |
} |
| 334 |
#define ecl_va_end(a) \ |
| 335 |
va_end(a[0].args) |
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
#define ecl_nth_value(env,n) ((env)->values[n]) |
| 342 |
#define ecl_nvalues(env) ((env)->nvalues) |
| 343 |
#define ecl_return0(env) \ |
| 344 |
do { (env)->nvalues = 0; return ECL_NIL; } while (0) |
| 345 |
#define ecl_return1(env,x) \ |
| 346 |
do { (env)->nvalues = 1; return (x); } while (0) |
| 347 |
#define ecl_return2(env,x,y) \ |
| 348 |
do { \ |
| 349 |
cl_env_ptr __ecl_env = (env); \ |
| 350 |
cl_object __aux1 = (x), __aux2=(y); \ |
| 351 |
__ecl_env->values[1] = __aux2; \ |
| 352 |
__ecl_env->nvalues = 2; return __aux1; \ |
| 353 |
} while (0) |
| 354 |
#define ecl_return3(env,x,y,z) \ |
| 355 |
do { \ |
| 356 |
cl_env_ptr __ecl_env = (env); \ |
| 357 |
cl_object __aux1=(x), __aux2=(y), __aux3=(z); \ |
| 358 |
__ecl_env->values[1] = __aux2; \ |
| 359 |
__ecl_env->values[2] = __aux3; \ |
| 360 |
__ecl_env->nvalues = 3; return __aux1; \ |
| 361 |
} while (0) |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
static inline void |
| 368 |
ecl_data_stack_push(cl_env_ptr env, cl_object o) { |
| 369 |
cl_object *new_top = env->run_stack.top; |
| 370 |
if (ecl_unlikely(new_top >= env->run_stack.limit)) { |
| 371 |
new_top = ecl_data_stack_grow(env); |
| 372 |
} |
| 373 |
env->run_stack.top = new_top+1; |
| 374 |
*new_top = (o); |
| 375 |
} |
| 376 |
|
| 377 |
static inline void |
| 378 |
ecl_data_stack_push_n(cl_env_ptr env, cl_index n) { |
| 379 |
cl_object *new_top = env->run_stack.top; |
| 380 |
while (ecl_unlikely((env->run_stack.limit - new_top) <= n)) { |
| 381 |
new_top = ecl_data_stack_grow(env); |
| 382 |
} |
| 383 |
env->run_stack.top = new_top + n; |
| 384 |
} |
| 385 |
|
| 386 |
static inline cl_object |
| 387 |
ecl_data_stack_pop_unsafe(cl_env_ptr env) |
| 388 |
{ |
| 389 |
return *(--((env)->run_stack.top)); |
| 390 |
} |
| 391 |
|
| 392 |
static inline void |
| 393 |
ecl_data_stack_pop_n_unsafe(cl_env_ptr env, cl_index n) |
| 394 |
{ |
| 395 |
env->run_stack.top -= n; |
| 396 |
} |
| 397 |
|
| 398 |
static inline cl_index |
| 399 |
ecl_data_stack_index(cl_env_ptr env) { |
| 400 |
return (env)->run_stack.top - (env)->run_stack.org; |
| 401 |
} |
| 402 |
|
| 403 |
static inline void |
| 404 |
ecl_data_stack_set_index(cl_env_ptr env, cl_index ndx) |
| 405 |
{ |
| 406 |
env->run_stack.top = env->run_stack.org + (ndx); |
| 407 |
} |
| 408 |
|
| 409 |
#define ECL_STACK_REF(env,n) ((env)->run_stack.top[n]) |
| 410 |
#define ECL_STACK_INDEX(env) ecl_data_stack_index(env) |
| 411 |
#define ECL_STACK_UNWIND(env,ndx) ecl_data_stack_set_index(env,ndx) |
| 412 |
#define ECL_STACK_PUSH_N(env,n) ecl_data_stack_push_n(env,n) |
| 413 |
#define ECL_STACK_PUSH(env,o) ecl_data_stack_push(env,o) |
| 414 |
#define ECL_STACK_POP_UNSAFE(env) ecl_data_stack_pop_unsafe(env) |
| 415 |
#define ECL_STACK_POP_N_UNSAFE(env,o) ecl_data_stack_pop_n_unsafe(env,o) |
| 416 |
|
| 417 |
#define ECL_STACK_FRAME_REF(f,ndx) \ |
| 418 |
((f)->frame.env->run_stack.org[(f)->frame.base+(ndx)]) |
| 419 |
#define ECL_STACK_FRAME_SET(f,ndx,o) \ |
| 420 |
do { ECL_STACK_FRAME_REF(f,ndx) = (o); } while(0) |
| 421 |
|
| 422 |
#define ECL_STACK_FRAME_PTR(f) \ |
| 423 |
((f)->frame.env->run_stack.org+(f)->frame.base) |
| 424 |
#define ECL_STACK_FRAME_TOP(f) \ |
| 425 |
((f)->frame.env->run_stack.org+(f)->frame.sp) |
| 426 |
|
| 427 |
#define ECL_STACK_FRAME_COPY(dest,orig) do { \ |
| 428 |
cl_object __dst = (dest); \ |
| 429 |
cl_object __src = (orig); \ |
| 430 |
cl_index __size = __src->frame.size; \ |
| 431 |
ecl_stack_frame_open(__src->frame.env, __dst, __size); \ |
| 432 |
memcpy(ECL_STACK_FRAME_PTR(__dst), \ |
| 433 |
ECL_STACK_FRAME_PTR(__src), \ |
| 434 |
__size * sizeof(cl_object)); \ |
| 435 |
} while (0); |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
#define ECL_UNWIND_PROTECT_BEGIN(the_env) do { \ |
| 442 |
bool __unwinding; ecl_frame_ptr __next_fr; \ |
| 443 |
const cl_env_ptr __the_env = (the_env); \ |
| 444 |
cl_index __nr; \ |
| 445 |
ecl_frs_push(__the_env,ECL_PROTECT_TAG); \ |
| 446 |
if (__ecl_frs_push_result) { \ |
| 447 |
__unwinding=1; __next_fr=__the_env->frs_stack.nlj_fr; \ |
| 448 |
} else { |
| 449 |
|
| 450 |
#define ECL_UNWIND_PROTECT_EXIT \ |
| 451 |
__unwinding=0; } \ |
| 452 |
ecl_frs_pop(__the_env); \ |
| 453 |
__nr = ecl_data_stack_push_values(__the_env); |
| 454 |
|
| 455 |
#define ECL_UNWIND_PROTECT_END \ |
| 456 |
ecl_data_stack_pop_values(__the_env,__nr); \ |
| 457 |
if (__unwinding) ecl_unwind(__the_env,__next_fr); } while(0) |
| 458 |
|
| 459 |
|
| 460 |
#define ECL_UNWIND_PROTECT_THREAD_SAFE_EXIT \ |
| 461 |
__unwinding=0; } \ |
| 462 |
ecl_bds_bind(__the_env,ECL_INTERRUPTS_ENABLED,ECL_NIL); \ |
| 463 |
ecl_frs_pop(__the_env); \ |
| 464 |
__nr = ecl_data_stack_push_values(__the_env); |
| 465 |
|
| 466 |
#define ECL_UNWIND_PROTECT_THREAD_SAFE_END \ |
| 467 |
ecl_data_stack_pop_values(__the_env,__nr); \ |
| 468 |
ecl_bds_unwind1(__the_env); \ |
| 469 |
ecl_check_pending_interrupts(__the_env); \ |
| 470 |
if (__unwinding) ecl_unwind(__the_env,__next_fr); } while(0) |
| 471 |
|
| 472 |
#define ECL_NEW_FRAME_ID(env) ecl_make_fixnum(env->frs_stack.frame_id++) |
| 473 |
|
| 474 |
#define ECL_BLOCK_BEGIN(the_env,id) do { \ |
| 475 |
const cl_object __id = ECL_NEW_FRAME_ID(the_env); \ |
| 476 |
const cl_env_ptr __the_env = (the_env); \ |
| 477 |
ecl_frs_push(__the_env,__id); \ |
| 478 |
if (__ecl_frs_push_result == 0) |
| 479 |
|
| 480 |
#define ECL_BLOCK_END \ |
| 481 |
ecl_frs_pop(__the_env); } while(0) |
| 482 |
|
| 483 |
#define ECL_CATCH_BEGIN(the_env,tag) do { \ |
| 484 |
const cl_env_ptr __the_env = (the_env); \ |
| 485 |
ecl_frs_push(__the_env,tag); \ |
| 486 |
if (__ecl_frs_push_result == 0) { |
| 487 |
|
| 488 |
#define ECL_CATCH_END } \ |
| 489 |
ecl_frs_pop(__the_env); } while (0) |
| 490 |
|
| 491 |
#define ECL_RESTART_CASE_BEGIN(the_env, names) do { \ |
| 492 |
const cl_env_ptr __the_env = (the_env); \ |
| 493 |
const cl_object __ecl_tag = ecl_list1(names); \ |
| 494 |
ecl_bds_bind(__the_env, ECL_RESTART_CLUSTERS, \ |
| 495 |
si_bind_simple_restarts(__ecl_tag, names)); \ |
| 496 |
ecl_frs_push(__the_env,__ecl_tag); \ |
| 497 |
if (__ecl_frs_push_result == 0) { |
| 498 |
|
| 499 |
#define ECL_RESTART_CASE(code, args) \ |
| 500 |
} else if (__the_env->values[0] == ecl_make_fixnum(code)) { \ |
| 501 |
const cl_object args = __the_env->values[1]; |
| 502 |
|
| 503 |
#define ECL_RESTART_CASE_END } \ |
| 504 |
ecl_frs_pop(__the_env); \ |
| 505 |
ecl_bds_unwind1(__the_env); \ |
| 506 |
} while (0) |
| 507 |
|
| 508 |
#define ECL_HANDLER_CASE_BEGIN(the_env, names) do { \ |
| 509 |
const cl_env_ptr __the_env = (the_env); \ |
| 510 |
const cl_object __ecl_tag = ecl_list1(names); \ |
| 511 |
ecl_bds_bind(__the_env, ECL_HANDLER_CLUSTERS, \ |
| 512 |
si_bind_simple_handlers(__ecl_tag, names)); \ |
| 513 |
ecl_frs_push(__the_env,__ecl_tag); \ |
| 514 |
if (__ecl_frs_push_result == 0) { |
| 515 |
|
| 516 |
#define ECL_HANDLER_CASE(code, args) \ |
| 517 |
} else if (__the_env->values[0] == ecl_make_fixnum(code)) { \ |
| 518 |
const cl_object args = __the_env->values[1]; |
| 519 |
|
| 520 |
#define ECL_HANDLER_CASE_END } \ |
| 521 |
ecl_frs_pop(__the_env); \ |
| 522 |
ecl_bds_unwind1(__the_env); \ |
| 523 |
} while (0) |
| 524 |
|
| 525 |
#if defined(_MSC_VER) |
| 526 |
# define ECL_CATCH_ALL_BEGIN(the_env) do { \ |
| 527 |
const cl_env_ptr __the_env = (the_env); \ |
| 528 |
_try { \ |
| 529 |
const cl_env_ptr __the_env = (the_env); \ |
| 530 |
ecl_frs_push(__the_env,ECL_PROTECT_TAG); \ |
| 531 |
if (__ecl_frs_push_result == 0) { |
| 532 |
# define ECL_CATCH_ALL_IF_CAUGHT } else { |
| 533 |
# define ECL_CATCH_ALL_END }} \ |
| 534 |
_except(_ecl_w32_exception_filter(GetExceptionInformation())) \ |
| 535 |
{ (void)0; } \ |
| 536 |
ecl_frs_pop(__the_env); } while(0) |
| 537 |
#else |
| 538 |
# define ECL_CATCH_ALL_BEGIN(the_env) do { \ |
| 539 |
const cl_env_ptr __the_env = (the_env); \ |
| 540 |
ecl_frs_push(__the_env,ECL_PROTECT_TAG); \ |
| 541 |
if (__ecl_frs_push_result == 0) { |
| 542 |
# define ECL_CATCH_ALL_IF_CAUGHT } else { |
| 543 |
# define ECL_CATCH_ALL_END } \ |
| 544 |
ecl_frs_pop(__the_env); } while(0) |
| 545 |
#endif |
| 546 |
|
| 547 |
|
| 548 |
#ifdef __cplusplus |
| 549 |
} |
| 550 |
#endif |
| 551 |
|
| 552 |
#endif |