|
|
| version 1.36, 2002/01/28 11:03:09 | version 1.41, 2002/08/01 11:26:50 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: exception class. | Parser: exception class. |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| $Id$ | |
| */ | */ |
| static const char* IDENT_EXCEPTION_C="$Id$"; | |
| #include "pa_common.h" | #include "pa_common.h" |
| #include "pa_exception.h" | #include "pa_exception.h" |
| #include "pa_globals.h" | #include "pa_globals.h" |
| #include "pa_sapi.h" | |
| Exception::Exception() { | Exception::Exception() { |
| ftype=fcode=fproblem_source=0; | ftype=0; |
| fproblem_source=0; | |
| owns_comment=false; fcomment=0; | owns_comment=false; fcomment=0; |
| } | } |
| Exception::Exception(const String *atype, const String *acode, | Exception::Exception(const char *atype, |
| const String *aproblem_source, | const String *aproblem_source, |
| const char *comment_fmt, ...) { | const char *comment_fmt, ...) { |
| //_asm int 3; | //_asm int 3; |
| //__asm__("int3"); | //__asm__("int3"); |
| ftype=atype; | ftype=atype; |
| fcode=acode; | |
| fproblem_source=aproblem_source; | fproblem_source=aproblem_source; |
| owns_comment=true; | owns_comment=true; |
| if(comment_fmt) { | if(comment_fmt) { |
| fcomment=(char *)malloc(MAX_STRING); | fcomment=(char *)malloc(MAX_STRING); |
| if(!fcomment) | |
| SAPI::die("out of memory in 'Exception::Exception', failed to allocated %u bytes", MAX_STRING); | |
| va_list args; | va_list args; |
| va_start(args, comment_fmt); | va_start(args, comment_fmt); |
| vsnprintf(fcomment, MAX_STRING, comment_fmt, args); | vsnprintf(fcomment, MAX_STRING, comment_fmt, args); |
| Line 36 Exception::Exception(const String *atype | Line 39 Exception::Exception(const String *atype |
| } | } |
| Exception::Exception(const Exception& src) : | Exception::Exception(const Exception& src) : |
| ftype(src.ftype), | ftype(src.ftype), |
| fcode(src.fcode), | |
| fproblem_source(src.fproblem_source), | fproblem_source(src.fproblem_source), |
| fcomment(src.fcomment), | fcomment(src.fcomment), |
| owns_comment(src.owns_comment) { | owns_comment(src.owns_comment) { |
| Line 45 Exception::Exception(const Exception& sr | Line 47 Exception::Exception(const Exception& sr |
| } | } |
| Exception& Exception::operator =(const Exception& src) { | Exception& Exception::operator =(const Exception& src) { |
| ftype=src.ftype; | ftype=src.ftype; |
| fcode=src.fcode; | |
| fproblem_source=src.fproblem_source; | fproblem_source=src.fproblem_source; |
| if(owns_comment) | if(owns_comment) |
| Line 63 Exception::~Exception() { | Line 64 Exception::~Exception() { |
| #ifdef XML | #ifdef XML |
| Exception::Exception( | Exception::Exception( |
| const String *atype, const String *acode, | |
| const String *aproblem_source, | const String *aproblem_source, |
| GdomeException& exc) : | GdomeException& exc) : |
| ftype(atype), | ftype("xml"), |
| fcode(acode), | |
| fproblem_source(aproblem_source), | fproblem_source(aproblem_source), |
| owns_comment(true) { | owns_comment(true) { |