123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- /*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
- #if __STDC__
- #include <stdarg.h>
- #endif
- #include <stdlib.h>
- #include <stdio.h>
- #include "varinfo.h"
- #include "output.h"
- #if __STDC__
- void error(char *fmt, ...);
- #else
- void error();
- #endif
- int nerrors=0;
- void yyerror(char *s)
- {
- error("Parser gives %s",s);
- }
- void goodbye()
- {
- error("This was fatal, goodbye!");
- #ifndef NDEBUG
- abort();
- #endif
- }
- #if __STDC__
- /*VARARGS1*/
- void error(char *fmt, ...)
- {
- extern int lineno;
- extern char *filename;
- va_list ap;
- fprintf(stderr,"\"%s\", line %d:",filename,lineno);
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
- va_end(ap);
- nerrors++;
- }
- /*VARARGS1*/
- void fatal(char *fmt, ...)
- {
- extern int lineno;
- extern char *filename;
-
- va_list ap;
- fprintf(stderr,"\"%s\", line %d:",filename,lineno);
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
- va_end(ap);
- nerrors++;
- errorexit();
- goodbye();
- exit(-1);
- }
- #else /* __STDC__ */
- /*VARARGS1*/
- fatal(s,a,b,c,d) char *s; {
- error(s,a,b,c,d);
- errorexit();
- goodbye();
- exit(-1);
- }
- /*VARARGS1*/
- error(s,a,b,c,d) char *s; {
- extern int lineno;
- extern char *filename;
- fprintf(stderr,"\"%s\", line %d:",filename,lineno);
- fprintf(stderr,s,a,b,c,d);
- fprintf(stderr,"\n");
- nerrors++;
- }
- #endif
- #ifndef NDEBUG
- void badassertion(char *string, char *file, int line)
- {
- fprintf(stderr,"\"%s\", line %d: Assertion failed \"%s\"\n",
- file,line,string);
- goodbye();
- }
- #endif
- int tabovf(char *string)
- {
- fatal("%s overflow", string);
- return 0;
- }
|