1 /* yForth? - Written by Luca Padovani (C) 1996/97
2 * ------------------------------------------------------------------------
3 * This software is FreeWare as long as it comes with this header in each
4 * source file, anyway you can use it or any part of it whatever
5 * you want. It comes without any warranty, so use it at your own risk.
6 * ------------------------------------------------------------------------
7 * Module name: exceptio.c
8 * Abstract: exception word set
17 /**************************************************************************/
18 /* VARIABLES **************************************************************/
19 /**************************************************************************/
21 struct exception_frame *top_frame; /* ptr to the top of exception stack */
23 /**************************************************************************/
24 /* WORDS ******************************************************************/
25 /**************************************************************************/
28 register struct exception_frame *frame =
29 (struct exception_frame *) malloc(sizeof(struct exception_frame));
32 if ((ret_val = setjmp(frame->catch_buf)) == 0) {
33 /* Executed when "catch" is invoked */
34 save_input_specification();
39 frame->last = top_frame;
41 exec_word((struct word_def *) *sp++);
43 } else *--sp = ret_val;
48 top_frame = frame->last;
50 restore_input_specification();
55 register Cell n = *sp++;
57 if (top_frame) longjmp(top_frame->catch_buf, n);
59 else if (n == -2) _type();
61 longjmp(warm_start_jump, 1);