error.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* $Header$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. /* 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 */
  7. #include <system.h>
  8. #include "errout.h"
  9. #include "LLlex.h"
  10. /* This file contains the (non-portable) error-message and diagnostic
  11. functions. Beware, they are called with a variable number of
  12. arguments!
  13. */
  14. int err_occurred;
  15. err_hdr(s)
  16. char *s;
  17. {
  18. fprint(ERROUT, "\"%s\", line %d: %s", FileName, LineNumber, s);
  19. }
  20. /*VARARGS1*/
  21. error(fmt, args)
  22. char *fmt;
  23. {
  24. err_hdr("");
  25. doprnt(ERROUT, fmt, &args);
  26. fprint(ERROUT, "\n");
  27. }
  28. /*VARARGS1*/
  29. warning(fmt, args)
  30. char *fmt;
  31. {
  32. err_hdr("warning ");
  33. doprnt(ERROUT, fmt, &args);
  34. fprint(ERROUT, "\n");
  35. }
  36. /*VARARGS1*/
  37. crash(fmt, args)
  38. char *fmt;
  39. int args;
  40. {
  41. err_hdr("crash ");
  42. doprnt(ERROUT, fmt, &args);
  43. fprint(ERROUT, "\n");
  44. sys_stop(S_ABORT);
  45. }
  46. /*VARARGS1*/
  47. fatal(fmt, args)
  48. char *fmt;
  49. int args;
  50. {
  51. err_hdr("fatal ");
  52. doprnt(ERROUT, fmt, &args);
  53. fprint(ERROUT, "\n");
  54. sys_stop(S_EXIT);
  55. }