/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1989-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* *18***********************************************************************/19#pragma prototyped20/*21* Glenn Fowler22* AT&T Research23*24* expression library25*/2627#include <exlib.h>2829/*30* library error handler31*/3233void34exerror(const char* format, ...)35{36Sfio_t* sp;3738if (expr.program->disc->errorf && !expr.program->errors && (sp = sfstropen()))39{40va_list ap;41char* s;42char buf[64];4344expr.program->errors = 1;45excontext(expr.program, buf, sizeof(buf));46sfputr(sp, buf, -1);47va_start(ap, format);48sfvprintf(sp, format, ap);49va_end(ap);50if (!(s = sfstruse(sp)))51s = "out of space";52(*expr.program->disc->errorf)(expr.program, expr.program->disc, (expr.program->disc->flags & EX_FATAL) ? 3 : 2, "%s", s);53sfclose(sp);54}55else if (expr.program->disc->flags & EX_FATAL)56exit(1);57}585960