/* $Header:opterror.c 12.0$ */
/* $ACIS:opterror.c 12.0$ */
/* $Source: /ibm/acis/usr/src/lib/c2_ca/RCS/opterror.c,v $ */

#ifndef lint
static char *rcsid = "$Header:opterror.c 12.0$";
#endif

/* ERROR.C */
 
#include "stdio.h"
#include "error.h"
#include "opt.h"
 
 
 
/* the error messages */
 
char *errmsgs[] = {
/*  0 */  "",
/*  1 */  "Invalid delimiter found scanning source statement:",
/*  2 */  "Ran out of storage",
/*  3 */  "Too many file names given:",
/*  4 */  "Problem scanning operand: ",
/*  5 */  "Too many labels; maximum is total length of ",
/*  6 */  "Error opening file ",
/*  7 */  "Invalid option: ",
/*  8 */  "Unknown opcode: ",
/*  9 */  "Instruction has wrong form",
/* 10 */  "No optimizable functions found"
};
 
 
 
/* print error messages */
 
Error(enumb, estr, sn)
int enumb;     /* number of message */
char *estr;   /* additional information */
struct snode *sn;
{
 
   if (enumb<0 || enumb>MAX_E)
        fprintf( stderr, "Invalid error message number: %d", enumb);
   else if (enumb == E_NOFUNCTIONS)
	fprintf( stderr, "(c2) WARNING: %s %s", errmsgs[enumb], estr );
   else 
	fprintf( stderr, "(c2) ERROR: %s %s", errmsgs[enumb], estr );
   if( sn != NULL )
      if( sn->lineno > 0 )
         fprintf( stderr, " at line %d ", sn->lineno );
   fprintf( stderr, "\n" );
   if (enumb == E_STORAGE)
      exit(E_STORAGE);
}
