1987-03-09 19:15:41 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1985-01-08 09:59:28 +00:00
|
|
|
#ifndef NORCSID
|
1994-06-24 11:31:16 +00:00
|
|
|
static char rcsid[]= "$Id$";
|
1985-01-08 09:59:28 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-18 17:18:42 +00:00
|
|
|
#include <stdlib.h>
|
1985-01-08 09:59:28 +00:00
|
|
|
#include <stdio.h>
|
2013-05-10 11:04:21 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include "extern.h"
|
1985-01-08 09:59:28 +00:00
|
|
|
|
|
|
|
int nerrors=0;
|
|
|
|
|
2019-05-10 17:17:24 +00:00
|
|
|
void yyerror(char *s)
|
|
|
|
{
|
1985-01-08 09:59:28 +00:00
|
|
|
error("Parser gives %s",s);
|
|
|
|
}
|
|
|
|
|
2019-05-10 17:17:24 +00:00
|
|
|
void goodbye(void) {
|
1985-01-08 09:59:28 +00:00
|
|
|
|
|
|
|
error("This was fatal, goodbye!");
|
|
|
|
#ifndef NDEBUG
|
|
|
|
abort();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-05-10 11:04:21 +00:00
|
|
|
void errorv(const char* s, va_list ap)
|
|
|
|
{
|
|
|
|
extern int lineno;
|
|
|
|
extern char *filename;
|
|
|
|
|
|
|
|
fprintf(stderr, "\"%s\", line %d:", filename, lineno);
|
|
|
|
vfprintf(stderr, s, ap);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
nerrors++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void fatal(const char* s, ...)
|
|
|
|
{
|
|
|
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, s);
|
|
|
|
errorv(s, ap);
|
|
|
|
va_end(ap);
|
1985-01-08 09:59:28 +00:00
|
|
|
|
|
|
|
errorexit();
|
|
|
|
goodbye();
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2013-05-10 11:04:21 +00:00
|
|
|
void error(const char* s, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
1985-01-08 09:59:28 +00:00
|
|
|
|
2013-05-10 11:04:21 +00:00
|
|
|
va_start(ap, s);
|
|
|
|
errorv(s, ap);
|
|
|
|
va_end(ap);
|
1985-01-08 09:59:28 +00:00
|
|
|
}
|
|
|
|
|
2019-05-10 17:17:24 +00:00
|
|
|
int tabovf(char *string)
|
|
|
|
{
|
1985-01-08 09:59:28 +00:00
|
|
|
fatal("%s overflow",string);
|
2019-05-10 17:17:24 +00:00
|
|
|
return 0;
|
1985-01-08 09:59:28 +00:00
|
|
|
}
|