--- parser3/src/main/pa_exception.C 2001/08/27 13:40:41 1.13 +++ parser3/src/main/pa_exception.C 2001/10/22 16:44:42 1.22 @@ -2,20 +2,18 @@ Parser: exception class. Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) -*/ -static const char *RCSId="$Id: pa_exception.C,v 1.13 2001/08/27 13:40:41 parser Exp $"; -#include -#include + $Id: pa_exception.C,v 1.22 2001/10/22 16:44:42 parser Exp $ +*/ #include "pa_common.h" #include "pa_exception.h" -void Exception::_throw(const String *atype, const String *acode, +Exception::Exception(const String *atype, const String *acode, const String *aproblem_source, - const char *comment_fmt, ...) const { + const char *comment_fmt, ...) { + //_asm int 3; ftype=atype; fcode=acode; fproblem_source=aproblem_source; @@ -23,15 +21,94 @@ void Exception::_throw(const String *aty if(comment_fmt) { va_list args; va_start(args, comment_fmt); + fcomment=(char *)malloc(MAX_STRING); vsnprintf(fcomment, MAX_STRING, comment_fmt, args); va_end(args); } else - fcomment[0]=0; + fcomment=0; +} + +#ifdef XML +void Exception::provide_source(Pool& pool, const String *source, const XSLException& e) { + if(e.getURI().empty()) + throw Exception(0, 0, + source, + "%s (%s)", + pool.transcode_cstr(e.getMessage()), // message for exception + pool.transcode_cstr(e.getType()) // type of exception + ); + else + throw Exception(0, 0, + source, + "%s (%s). %s(%d:%d)'", + pool.transcode_cstr(e.getMessage()), // message for exception + pool.transcode_cstr(e.getType()), // type of exception + + pool.transcode_cstr(e.getURI()), // URI for the associated document, if any + e.getLineNumber(), // line number, or -1 if unknown + e.getColumnNumber() // column number, or -1 if unknown + ); +} - int *p=(int *)(void *)&mark; - for(int i=0; i