Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
931 B

4 years ago
  1. #include "y2.h"
  2. void cpyunion(void)
  3. {
  4. /* copy the union declaration to the output, and the define file if present */
  5. int level, c;
  6. writeline(ftable);
  7. fprintf( ftable, "\n#define UNION 1\n");
  8. fprintf( ftable, "typedef union " );
  9. if( fdefine ) fprintf( fdefine, "\ntypedef union " );
  10. level = 0;
  11. for(;;)
  12. {
  13. if( (c=unix_getc(finput)) < 0 ) error( "EOF encountered while processing %%union" );
  14. putc( c, ftable );
  15. if( fdefine ) putc( c, fdefine );
  16. switch( c )
  17. {
  18. case '\n':
  19. ++lineno;
  20. break;
  21. case '{':
  22. ++level;
  23. break;
  24. case '}':
  25. --level;
  26. if( level == 0 )
  27. {
  28. /* we are finished copying */
  29. fprintf( ftable, " YYSTYPE;\n" );
  30. if( fdefine ) fprintf( fdefine, " YYSTYPE;\nextern YYSTYPE yylval;\n" );
  31. return;
  32. }
  33. }
  34. }
  35. }