-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- *
- * Small compiler - Error message system
+/* Small compiler - Error message system
* In fact a very simple system, using only 'panic mode'.
*
* Copyright (c) ITB CompuPhase, 1997-2003
* Version: $Id$
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#include "embryo_cc_sc.h"
#include "embryo_cc_sc5.scp"
* errors are ignored until lex() finds a semicolumn or a keyword
* (lex() resets "errflag" in that case).
*
- * Global references: inpfname (reffered to only)
- * fline (reffered to only)
- * fcurrent (reffered to only)
+ * Global references: inpfname (referred to only)
+ * fline (referred to only)
+ * fcurrent (referred to only)
* errflag (altered)
*/
int
error(int number, ...)
{
- static char *prefix[3] = { "error", "fatal error", "warning" };
static int lastline, lastfile, errorcount;
- char *msg, *pre;
+ char *msg;
va_list argptr;
char string[1024];
int start;
if (number < 100)
{
msg = errmsg[number - 1];
- pre = prefix[0];
errflag = TRUE; /* set errflag (skip rest of erroneous expression) */
errnum++;
}
else if (number < 200)
{
msg = fatalmsg[number - 100];
- pre = prefix[1];
errnum++; /* a fatal error also counts as an error */
}
else
{
msg = warnmsg[number - 200];
- pre = prefix[2];
warnnum++;
}
sc_error(0, "\nCompilation aborted.", NULL, 0, 0, argptr);
va_end(argptr);
- if (outf != NULL)
+ if (outf)
{
sc_closeasm(outf);
outf = NULL;