home *** CD-ROM | disk | FTP | other *** search
- /*
- HEADER: CUG nnn.nn;
- TITLE: YACC - Yet Another Compilier-Compilier
- VERSION: 1.0 for IBM-PC
- DATE: JAN 28, 1985
- DESCRIPTION: LALR(1) Parser Generator. From UNIX
- KEYWORDS: Parser Generator Compilier-Compilier YACC
- SYSTEM: IBM-PC and Compatiables
- FILENAME: YDFOUT.2C
- WARNINGS: This program is not for the casual user. It will
- be useful primarily to expert developers.
- CRC: N/A
- SEE-ALSO: LEX and PREP
- AUTHORS: Scott Guthery 11100 leafwood lane Austin, TX 78750
- COMPILERS: DESMET-C
- REFERENCES: UNIX Systems Manuals
- */
-
- #include "y2.h"
-
- void defout( void )
- {
- /* write out the defines (at the end of the declaration section) */
-
- register int i, c;
- register char *cp;
-
- for( i=ndefout; i<=ntokens; ++i )
- {
-
- cp = tokset[i].name;
- if( *cp == ' ' ) ++cp; /* literals */
-
- for( ; (c= *cp)!='\0'; ++cp )
- {
-
- if( islower(c) || isupper(c) || isdigit(c) || c=='_' ); /* VOID */
- else goto nodef;
- }
-
- fprintf( ftable, "# define %s %d\n", tokset[i].name, tokset[i].value );
- if( fdefine != NULL ) fprintf( fdefine, "# define %s %d\n", tokset[i].name, tokset[i].value );
-
- nodef:
- ;
- }
-
- ndefout = ntokens+1;
-
- }
-