home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / comm / yaccunx / ydfout.2c < prev    next >
Encoding:
Text File  |  1983-12-23  |  698 b   |  33 lines

  1. #include "y2.h"
  2.  
  3. defout()
  4.    {
  5.    /* write out the defines (at the end of the declaration section) */
  6.  
  7.    register int i, c;
  8.    register char *cp;
  9.  
  10.    for( i=ndefout; i<=ntokens; ++i )
  11.       {
  12.  
  13.       cp = tokset[i].name;
  14.       if( *cp == ' ' ) ++cp;  /* literals */
  15.  
  16.       for( ; (c= *cp)!='\0'; ++cp )
  17.          {
  18.  
  19.          if( islower(c) || isupper(c) || isdigit(c) || c=='_' );  /* VOID */
  20.          else goto nodef;
  21.          }
  22.  
  23.       fprintf( ftable, "# define %s %d\n", tokset[i].name, tokset[i].value );
  24.       if( fdefine != NULL ) fprintf( fdefine, "# define %s %d\n", tokset[i].name, tokset[i].value );
  25.  
  26. nodef:  
  27.       ;
  28.       }
  29.  
  30.    ndefout = ntokens+1;
  31.  
  32.    }
  33.