ack/util/opt/util.c

48 lines
942 B
C
Raw Normal View History

/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*
* Author: Hans van Staveren
*/
#include <stdlib.h>
1984-05-17 13:42:36 +00:00
#include <stdio.h>
#include <stdarg.h>
1984-05-17 13:42:36 +00:00
#include "param.h"
#include "types.h"
#include "tes.h"
1984-05-17 13:42:36 +00:00
#include "lookup.h"
#include "proinf.h"
#include "optim.h"
#include "util.h"
1984-05-17 13:42:36 +00:00
#include "ext.h"
/* VARARGS1 */
void error(char *s, ...)
{
va_list ap;
va_start(ap, s);
1984-05-17 13:42:36 +00:00
fprintf(stderr, "%s: error on line %u", progname, linecount);
1984-05-17 13:42:36 +00:00
if (prodepth != 0)
fprintf(stderr, "(%.*s)", IDL, curpro.symbol->s_name);
fprintf(stderr, ": ");
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
#ifndef NDEBUG
1984-05-17 13:42:36 +00:00
abort();
#endif
exit(EXIT_FAILURE);
1984-05-17 13:42:36 +00:00
}
#ifdef DIAGOPT
void optim(int n)
{
1984-05-17 13:42:36 +00:00
fprintf(stderr,"Made optimization %d",n);
if (prodepth)
fprintf(stderr," (%.*s)",IDL,curpro.symbol->s_name);
1984-05-17 13:42:36 +00:00
fprintf(stderr,"\n");
}
#endif