home *** CD-ROM | disk | FTP | other *** search
- /*
- Testing routines for NROFF suppression.
- */
-
- #include cc.h
- #include lex.h
-
- .comment
- /*
- Return the next character from the current input stream.
- Advance past the character just returned.
-
- Switch input streams on END_FILE.
- Return EOF_CHAR on end-of-file.
- Return EOP_CHAR on end-of-program.
- */
- .endcomment
-
- .code
- int
- get_chr()
- {
- int c;
-
- if (tok_bufp > 0) {
- return tok_buffer [--tok_bufp];
- }
-
- else {
- /* Reset recursion detection count. */
- tok_count = 0;
- c = sysgetc(tok_input);
- if (c == END_FILE) {
- return do_eof();
- }
- else {
- return c;
- }
- }
- }
- .endcode
-
-
- .comment
- /*
- Return the next character from the input stream.
- This is a "lookahead" function.
- */
- .endcomment this is a test
-
- .code
- int
- nxt_chr()
- {
- int c;
-
- if (tok_bufp > 0) {
- return tok_buffer [tok_bufp - 1];
- }
- else {
- c = sysgetc(tok_input);
- if (c == END_FILE) {
- c = do_eof();
- }
- tok_buffer [tok_bufp++] = c;
- return c;
- }
- }
- .endcode
-
-
- .cm
- .cm this is an nroff comment
- .cm
- expand(handle)
- struct st_node * handle;
- {}
-
- do_pp()
- {
- get_chr();
- }
-
- int
- do_eof()
- {
- printf("In do_eof: End of file\n");
- return EOF_CHAR;
- }
-
- tok_error(message)
- char * message;
- {
- printf("%s\n", message);
- }
-
- fatal(message)
- char * message;
- {
- printf("%s\n", message);
- }
-