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 >
Wrap
Text File
|
1991-11-15
|
1KB
|
102 lines
/*
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);
}