/* * Exception * Handles odd errors in Steel programs * * 1.00 (24 September 1991) * * © 1991-1998 Straylight */ /*----- Licensing note ----------------------------------------------------* * * This file is part of Straylight's Steel library. * * Steel is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * Steel is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Steel. If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __exception_h #define __exception_h #ifndef __setjmp_h #include #endif #ifndef __dll_h #include "dll.h" #endif typedef struct { jmp_buf j; int sp; } exception_handler; /* * int exception_registerHandler(exception_handler env) * * Use * Registers the current point as being a sensible place to go after an * exception. This is implemented as a macro for the simple reason that * things tend to go a tad wrong if you define your jmp_bufs in a function * and then return. * * Parameters * exception_handler env == an undefined variable of the type jmp_buf. */ #ifndef exception_registerHandler #define exception_registerHandler(exc) \ ( \ ( exc.sp=_dll_setjmp() ), \ ( exception__registerHandler((exc.j),setjmp(exc.j)) ? \ (_dll_longjmped(exc.sp),1) : \ 0) \ ) #endif /* * void exception_generate(char *message,...) * * Use * Generates an ArmenLib exception, to be handled in an appropriate manner. * * Parameters * char *message == printf()-type format string */ void exception_generate(char *message,...); /* * int exception__registerHandler(jmp_buf handler) * * Use * This routine is for the use of exception segment only, and should not * be called from your code. */ int exception__registerHandler(jmp_buf handler,int result); #endif