home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / source / iolib / scan3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1975-05-13  |  1.0 KB  |  70 lines

  1. _Ierr (message, a, b, c, d, e)
  2. char message[];
  3.     {
  4.     extern int cgoof;
  5.     printf("ERROR ");
  6.     printf(message, a, b, c, d, e);
  7.     cputc('\n');
  8.     cexit(cgoof);
  9.     }
  10. char _Iendm[128] {0};
  11. _Imtab (formatp)
  12. char **formatp;
  13. {
  14. /* make up special table of string ending characters */
  15. int i, normal;
  16. char ch;
  17. /* normally all characters end string except those listed */
  18. normal = 1;
  19. if (**formatp == '^')
  20.     {normal = 0; (*formatp)++;}
  21. for (i= 0; i < 128; i++)
  22.     _Iendm[i] = normal;
  23. while ((ch = *((*formatp)++)) != ']')
  24.     _Iendm[ch] = !_Iendm[ch];
  25.  
  26. }
  27.  
  28. _Inxch ()
  29. /* returns next character which is not _Ispce */
  30. {
  31.     extern int _Isfil, (*_Igetc)();
  32.         int ch;
  33. while ((ch = (*_Igetc)(_Isfil)) > 0 && _Ispce(ch));
  34. if  (ch > 0)
  35.     return (ch);
  36. return (-1);
  37. }
  38.  
  39. _Ispce (c)
  40. char c;
  41. {
  42. switch (c)
  43.     {
  44.     case ' ':
  45.     case '\n':
  46.     case '\t': return(1);
  47.     }
  48. return(0);
  49. }
  50.  
  51. _Ispnd (ch)
  52. char ch;
  53. {
  54. return (_Iendm[ch] > 0);
  55. }
  56.  
  57. char *_Iinpt;
  58. int (*_Igetc)(), (*_Iungc)();
  59. _Igstr ()
  60. {
  61. extern char *_Iinpt;
  62. return (*_Iinpt++);
  63. }
  64.  
  65. _Iungs(ch)
  66. {
  67. extern char *_Iinpt;
  68. *--_Iinpt = ch;
  69. }
  70.