Annotation of parser3/src/main/pa_error.C, revision 1.1
1.1 ! paf 1: /*
! 2: $Id: pa_table.C,v 1.1 2001/01/29 15:56:04 paf Exp $
! 3: */
! 4:
! 5: #include <stdio.h>
! 6: #include <stdlib.h>
! 7:
! 8: #include "pa_error.h"
! 9: #include "pa_common.h"
! 10:
! 11: void Error::die(char *acomment) {
! 12: // FIX: log(LOG_ERROR, acomment)
! 13: exit(1);
! 14: }
! 15:
! 16: bool Error::begin() {
! 17: fproblem_source=0;
! 18: fcomment[0]=0;
! 19: valid=true;
! 20:
! 21: return setjmp(mark)==0;
! 22: }
! 23:
! 24: void Error::raise(String *aproblem_source, char *comment_fmt, ...) {
! 25: if(!valid)
! 26: die("Error::raise(...) -- without begin()");
! 27:
! 28: fproblem_source=aproblem_source;
! 29:
! 30: va_list args;
! 31: va_start(args, comment_fmt);
! 32: int r=vsnprintf(fcomment, MAX_STRING, comment_fmt, args);
! 33: va_end(args);
! 34:
! 35: longjmp(mark, 1);
! 36: }
! 37:
! 38: String *Error::problem_source() {
! 39: if(!valid)
! 40: die("Error::problem_source() -- without begin()");
! 41:
! 42: return fproblem_source;
! 43: }
! 44:
! 45: char *Error::comment() {
! 46: if(!valid)
! 47: die("Error::comment() -- without begin()");
! 48:
! 49: return fcomment;
! 50: }
E-mail: