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