Leaked source code of windows server 2003
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.

47 lines
1.0 KiB

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