1989-10-23 10:35:56 +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".
|
|
|
|
*/
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1989-10-23 10:35:56 +00:00
|
|
|
/* E R R O R A N D D I A G N O S T I C R O U T I N E S */
|
|
|
|
|
|
|
|
#include <system.h>
|
1995-08-17 16:43:36 +00:00
|
|
|
#if __STDC__
|
|
|
|
#include <stdarg.h>
|
|
|
|
#else
|
1989-10-23 10:35:56 +00:00
|
|
|
#include <varargs.h>
|
1995-08-17 16:43:36 +00:00
|
|
|
#endif
|
1989-10-23 10:35:56 +00:00
|
|
|
|
2013-05-12 19:45:55 +00:00
|
|
|
#include "parameters.h"
|
1989-10-23 10:35:56 +00:00
|
|
|
#include "arith.h"
|
|
|
|
#include "LLlex.h"
|
|
|
|
|
|
|
|
/* This file contains the (non-portable) error-message and diagnostic
|
|
|
|
functions. Beware, they are called with a variable number of
|
|
|
|
arguments!
|
|
|
|
*/
|
|
|
|
|
|
|
|
int err_occurred;
|
|
|
|
|
|
|
|
err_hdr(s)
|
|
|
|
char *s;
|
|
|
|
{
|
|
|
|
if (FileName) {
|
1993-03-18 13:24:20 +00:00
|
|
|
fprint(ERROUT, "\"%s\", line %d: %s", FileName, (int)LineNumber, s);
|
1989-10-23 10:35:56 +00:00
|
|
|
}
|
|
|
|
else fprint(ERROUT, s);
|
|
|
|
}
|
|
|
|
|
1995-08-17 16:43:36 +00:00
|
|
|
#if __STDC__
|
|
|
|
/*VARARGS*/
|
|
|
|
error(char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_occurred = 1;
|
|
|
|
err_hdr("");
|
|
|
|
va_start(ap, fmt);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*VARARGS*/
|
|
|
|
warning(char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("(warning) ");
|
|
|
|
va_start(ap, fmt);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*VARARGS*/
|
|
|
|
strict(char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("(strict) ");
|
|
|
|
va_start(ap, fmt);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*VARARGS*/
|
|
|
|
crash(char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("CRASH\007 ");
|
|
|
|
va_start(ap, fmt);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
sys_stop(S_ABORT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*VARARGS*/
|
|
|
|
fatal(char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("fatal error -- ");
|
|
|
|
va_start(ap, fmt);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
sys_stop(S_EXIT);
|
|
|
|
}
|
|
|
|
#else
|
1993-03-18 13:24:20 +00:00
|
|
|
/*VARARGS*/
|
1989-10-23 10:35:56 +00:00
|
|
|
error(va_alist)
|
|
|
|
va_dcl
|
|
|
|
{
|
|
|
|
char *fmt;
|
|
|
|
va_list ap;
|
|
|
|
|
1989-11-03 10:36:56 +00:00
|
|
|
err_occurred = 1;
|
1989-10-23 10:35:56 +00:00
|
|
|
err_hdr("");
|
|
|
|
va_start(ap);
|
|
|
|
fmt = va_arg(ap, char *);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
1993-03-18 13:24:20 +00:00
|
|
|
/*VARARGS*/
|
1989-10-23 10:35:56 +00:00
|
|
|
warning(va_alist)
|
|
|
|
va_dcl
|
|
|
|
{
|
|
|
|
char *fmt;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("(warning) ");
|
|
|
|
va_start(ap);
|
|
|
|
fmt = va_arg(ap, char *);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
1993-03-18 13:24:20 +00:00
|
|
|
/*VARARGS*/
|
1989-10-23 10:35:56 +00:00
|
|
|
strict(va_alist)
|
|
|
|
va_dcl
|
|
|
|
{
|
|
|
|
char *fmt;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("(strict) ");
|
|
|
|
va_start(ap);
|
|
|
|
fmt = va_arg(ap, char *);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
1993-03-18 13:24:20 +00:00
|
|
|
/*VARARGS*/
|
1989-10-23 10:35:56 +00:00
|
|
|
crash(va_alist)
|
|
|
|
va_dcl
|
|
|
|
{
|
|
|
|
char *fmt;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("CRASH\007 ");
|
|
|
|
va_start(ap);
|
|
|
|
fmt = va_arg(ap, char *);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
sys_stop(S_ABORT);
|
|
|
|
}
|
|
|
|
|
1993-03-18 13:24:20 +00:00
|
|
|
/*VARARGS*/
|
1989-10-23 10:35:56 +00:00
|
|
|
fatal(va_alist)
|
|
|
|
va_dcl
|
|
|
|
{
|
|
|
|
char *fmt;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
err_hdr("fatal error -- ");
|
|
|
|
va_start(ap);
|
|
|
|
fmt = va_arg(ap, char *);
|
|
|
|
doprnt(ERROUT, fmt, ap);
|
|
|
|
fprint(ERROUT, "\n");
|
|
|
|
va_end(ap);
|
|
|
|
sys_stop(S_EXIT);
|
|
|
|
}
|
1995-08-17 16:43:36 +00:00
|
|
|
#endif
|