Annotation of parser3/src/include/pa_exception.h, revision 1.10
1.10 ! paf 1: /** @file
1.6 paf 2: Parser
3: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.7 paf 4: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.6 paf 5:
1.10 ! paf 6: $Id: pa_exception.h,v 1.9 2001/03/13 11:19:30 paf Exp $
1.1 paf 7: */
8:
9: #ifndef PA_EXCEPTION_H
10: #define PA_EXCEPTION_H
11:
12: #include <setjmp.h>
13:
14: #include "pa_types.h"
15: #include "pa_string.h"
16:
1.10 ! paf 17: /// Just simple longjump mechanizm dressed in class clothes. use Temp_exception
1.1 paf 18: class Exception {
19: public:
20:
1.10 ! paf 21: /**
! 22: address for long jump to jump to
! 23: regretfully public:
! 24: can't make local unless sure of inlining
! 25: for to-die stack frame ruins it all
! 26: */
1.5 paf 27: mutable jmp_buf mark;
1.1 paf 28:
1.10 ! paf 29: /// throws an exception[really goes to mark-ed position
1.5 paf 30: void _throw(
1.1 paf 31: const String *atype, const String *acode,
32: const String *aproblem_source,
1.5 paf 33: const char *comment_fmt, ...) const;
1.1 paf 34:
1.10 ! paf 35: /// extracts exception type
1.5 paf 36: const String *type() const { return ftype; }
1.10 ! paf 37: /// extracts exception code
1.5 paf 38: const String *code() const { return fcode; }
1.10 ! paf 39: /// extracts exception problem_source
1.5 paf 40: const String *problem_source() const { return fproblem_source; }
1.10 ! paf 41: /// extracts exception comment
1.5 paf 42: const char *comment() const { return fcomment[0]?fcomment:0; }
1.1 paf 43:
44: private:
45:
1.5 paf 46: mutable const String *ftype, *fcode, *fproblem_source;
47: mutable char fcomment[MAX_STRING];
1.1 paf 48: };
49:
50: #endif
E-mail: