home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 357_01 / cstar1.exe / NROFF.PP < prev    next >
Text File  |  1991-11-15  |  1KB  |  102 lines

  1. /*
  2.     Testing routines for NROFF suppression.
  3. */
  4.  
  5. #include cc.h
  6. #include lex.h
  7.  
  8. .comment
  9. /*
  10.     Return the next character from the current input stream.
  11.     Advance past the character just returned.
  12.  
  13.     Switch input streams on END_FILE.
  14.     Return EOF_CHAR on end-of-file.
  15.     Return EOP_CHAR on end-of-program.
  16. */
  17. .endcomment
  18.  
  19. .code
  20. int
  21. get_chr()
  22. {
  23.     int c;
  24.  
  25.     if (tok_bufp > 0) {
  26.         return tok_buffer [--tok_bufp];
  27.     }
  28.  
  29.     else {
  30.         /* Reset recursion detection count. */
  31.         tok_count = 0;
  32.         c = sysgetc(tok_input);
  33.         if (c == END_FILE) {
  34.             return do_eof();
  35.         }
  36.         else {
  37.             return c;
  38.         }
  39.     }
  40. }
  41. .endcode
  42.  
  43.  
  44. .comment
  45. /*
  46.     Return the next character from the input stream.
  47.     This is a "lookahead" function.
  48. */
  49. .endcomment this is a test
  50.  
  51. .code
  52. int
  53. nxt_chr()
  54. {
  55.     int c;
  56.  
  57.     if (tok_bufp > 0) {
  58.         return tok_buffer [tok_bufp - 1];
  59.     }
  60.     else {
  61.         c = sysgetc(tok_input);
  62.         if (c == END_FILE) {
  63.             c = do_eof();
  64.         }
  65.         tok_buffer [tok_bufp++] = c;
  66.         return c;
  67.     }
  68. }
  69. .endcode
  70.  
  71.  
  72. .cm
  73. .cm this is an nroff comment
  74. .cm
  75. expand(handle)
  76. struct st_node * handle;
  77. {}
  78.  
  79. do_pp()
  80. {
  81.     get_chr();
  82. }
  83.  
  84. int
  85. do_eof()
  86. {
  87.     printf("In do_eof: End of file\n");
  88.     return EOF_CHAR;
  89. }
  90.  
  91. tok_error(message)
  92. char * message;
  93. {
  94.     printf("%s\n", message);
  95. }
  96.  
  97. fatal(message)
  98. char * message;
  99. {
  100.     printf("%s\n", message);
  101. }
  102.