Diff for /parser3/src/include/pa_exception.h between versions 1.4 and 1.10

version 1.4, 2001/02/21 14:59:41 version 1.10, 2001/03/19 15:29:37
Line 1 Line 1
 /*  /** @file
   $Id$          Parser
           Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
           Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
   
           $Id$
 */  */
   
 #ifndef PA_EXCEPTION_H  #ifndef PA_EXCEPTION_H
Line 10 Line 14
 #include "pa_types.h"  #include "pa_types.h"
 #include "pa_string.h"  #include "pa_string.h"
   
   /// Just simple longjump mechanizm dressed in class clothes. use Temp_exception
 class Exception {  class Exception {
 public:  public:
   
         // address for long jump to jump to           /**
         // regretfully public:                  address for long jump to jump to 
         //   can't make local unless sure of inlining                  regretfully public:
         //   for to-die stack frame ruins it all                  can't make local unless sure of inlining
         jmp_buf mark;                  for to-die stack frame ruins it all
           */
           mutable jmp_buf mark;
   
         void raise(          /// throws an exception[really goes to mark-ed position
           void _throw(
                 const String *atype, const String *acode,                  const String *atype, const String *acode,
                 const String *aproblem_source,                   const String *aproblem_source, 
                 const char *comment_fmt, ...);                  const char *comment_fmt, ...) const;
   
         const String *type() { return ftype; }          /// extracts exception type
         const String *code() { return fcode; }          const String *type() const { return ftype; }
         const String *problem_source() { return fproblem_source; }          /// extracts exception code
         const char *comment() { return fcomment[0]?fcomment:0; }          const String *code() const { return fcode; }
           /// extracts exception problem_source
           const String *problem_source() const { return fproblem_source; }
           /// extracts exception comment
           const char *comment() const { return fcomment[0]?fcomment:0; }
   
 private:  private:
   
         const String *ftype, *fcode, *fproblem_source;          mutable const String *ftype, *fcode, *fproblem_source;
         char fcomment[MAX_STRING];          mutable char fcomment[MAX_STRING];
 };  };
   
 #define EXCEPTION_TRY(e) (setjmp((e).mark)==0)  
 // usage:  
 //   if(EXCEPTION_TRY(e)) { ...; if(?) e.raise(?); ...; } else { catch-code }  
   
 #endif  #endif

Removed from v.1.4  
changed lines
  Added in v.1.10


E-mail: