home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progasm / asca11.arj / ASSUBR.C < prev    next >
C/C++ Source or Header  |  1990-11-23  |  1KB  |  93 lines

  1. /* assubr.c */
  2.  
  3. /*
  4.  * (C) Copyright 1989,1990
  5.  * All Rights Reserved
  6.  *
  7.  * Alan R. Baldwin
  8.  * 721 Berkeley St.
  9.  * Kent, Ohio  44240
  10.  */
  11.  
  12. #include <stdio.h>
  13. #include <setjmp.h>
  14. #include <string.h>
  15. #include <alloc.h>
  16. #include "asm.h"
  17.  
  18. /*
  19.  * Note an error.
  20.  * If the error is already in the
  21.  * error buffer don't note it again.
  22.  * If the error is serious enough to
  23.  * stop the parse (a `q' error) just
  24.  * give up.
  25.  */
  26. VOID
  27. err(c)
  28. register c;
  29. {
  30.     register char *p;
  31.  
  32.     p = eb;
  33.     while (p < ep)
  34.         if (*p++ == c)
  35.             return;
  36.     if (p < &eb[NERR]) {
  37.         *p++ = c;
  38.         ep = p;
  39.     }
  40.     if (c == 'q')
  41.         longjmp(jump_env, -1);
  42. }
  43.  
  44. /*
  45.  * Send errors to the standard output.
  46.  */
  47. VOID
  48. diag()
  49. {
  50.     register char *p;
  51.  
  52.     if (eb != ep) {
  53.         p = eb;
  54.         while (p < ep) {
  55.             fprintf(stderr, "%c", *p++);
  56.         }
  57.         fprintf(stderr, " %04d\n", line);
  58.     }
  59. }
  60.  
  61. /*
  62.  * Note an 'r' error.
  63.  */
  64. VOID
  65. rerr()
  66. {
  67.     err('r');
  68. }
  69.  
  70. /*
  71.  * Note an 'a' error.
  72.  */
  73. VOID
  74. aerr()
  75. {
  76.     err('a');
  77. }
  78.  
  79. /*
  80.  * Note a 'q' error.
  81.  */
  82. VOID
  83. qerr()
  84. {
  85.     err('q');
  86. }
  87.  
  88.     G (o)        <cr>    - Go to PC
  89.             NNNN    - Go to NNNN
  90.  
  91.  
  92.     L (oad)        Load a S1-S9 format data
  93.