llmess.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #include "tokentab.h"
  6. /* Mod van gertjan */
  7. extern int LLsymb;
  8. extern int toknum;
  9. error_char(format,ch)
  10. char *format;
  11. char ch;
  12. {
  13. extern int listing,errorcnt;
  14. extern int basicline;
  15. if ( !listing ) fprint(STDERR, "LINE %d:",basicline);
  16. fprint(STDERR, format,ch);
  17. errorcnt++;
  18. }
  19. error_string(format,str)
  20. char *format;
  21. char *str;
  22. {
  23. extern int listing,errorcnt;
  24. extern int basicline;
  25. if ( !listing ) fprint(STDERR, "LINE %d:",basicline);
  26. fprint(STDERR, format,str);
  27. errorcnt++;
  28. }
  29. LLmessage( insertedtok )
  30. int insertedtok;
  31. {
  32. if ( insertedtok < 0 ) {
  33. error("Fatal stack overflow\n");
  34. C_close();
  35. sys_stop( S_EXIT );
  36. }
  37. if ( insertedtok == 0 )
  38. if ( LLsymb < 256 )
  39. error_char("%c deleted\n", (char)LLsymb);
  40. else
  41. error_string("%s deleted\n", tokentab[ LLsymb-256 ]);
  42. else {
  43. if ( insertedtok < 256 )
  44. error_char("%c inserted\n", (char)insertedtok);
  45. else
  46. error_string("%s inserted\n", tokentab[ insertedtok-256 ]);
  47. toknum = insertedtok;
  48. }
  49. }