home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2-YACC.ZIP / YDFOUT.2C < prev    next >
Text File  |  1989-09-29  |  1KB  |  51 lines

  1. /*
  2.   HEADER: CUG     nnn.nn;
  3.   TITLE:     YACC - Yet Another Compilier-Compilier
  4.   VERSION:     1.0 for IBM-PC
  5.   DATE:      JAN 28, 1985
  6.   DESCRIPTION:     LALR(1) Parser Generator. From UNIX
  7.   KEYWORDS:     Parser Generator Compilier-Compilier YACC
  8.   SYSTEM:     IBM-PC and Compatiables
  9.   FILENAME:      YDFOUT.2C
  10.   WARNINGS:     This program is not for the casual user. It will
  11.          be useful primarily to expert developers.
  12.   CRC:         N/A
  13.   SEE-ALSO:     LEX and PREP
  14.   AUTHORS:     Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:     UNIX Systems Manuals
  17. */
  18.  
  19. #include "y2.h"
  20.  
  21. void defout( void )
  22.    {
  23.    /* write out the defines (at the end of the declaration section) */
  24.  
  25.    register int i, c;
  26.    register char *cp;
  27.  
  28.    for( i=ndefout; i<=ntokens; ++i )
  29.       {
  30.  
  31.       cp = tokset[i].name;
  32.       if( *cp == ' ' ) ++cp;  /* literals */
  33.  
  34.       for( ; (c= *cp)!='\0'; ++cp )
  35.          {
  36.  
  37.          if( islower(c) || isupper(c) || isdigit(c) || c=='_' );  /* VOID */
  38.          else goto nodef;
  39.          }
  40.  
  41.       fprintf( ftable, "# define %s %d\n", tokset[i].name, tokset[i].value );
  42.       if( fdefine != NULL ) fprintf( fdefine, "# define %s %d\n", tokset[i].name, tokset[i].value );
  43.  
  44. nodef:  
  45.       ;
  46.       }
  47.  
  48.    ndefout = ntokens+1;
  49.  
  50.    }
  51.