local void getPackArgs( void ) /****************************/ { struct pack_info *pi; /* check to make sure it is a numeric token */ if( PragIdRecog( "push" ) ) { /* 29-sep-94 */ pi = (struct pack_info *)CMemAlloc( sizeof( struct pack_info ) ); pi->next = PackInfo; pi->pack_amount = PackAmount; PackInfo = pi; if( CurToken == T_COMMA ) { PPCTL_ENABLE_MACROS(); NextToken(); PPCTL_DISABLE_MACROS(); if( ExpectingConstant() ) { SetPackAmount(); } NextToken(); } } else if( PragIdRecog( "pop" ) ) { pi = PackInfo; if( pi != NULL ) { PackAmount = pi->pack_amount; PackInfo = pi->next; CMemFree( pi ); } } else { CErr1( ERR_NOT_A_CONSTANT_EXPR ); } }
bool PragRecog( // RECOGNIZE PRAGMA ID char *what ) // - id { if( IS_ID_OR_KEYWORD( CurToken ) ) { return( PragIdRecog( what ) ); } return( false ); }
int PragRecog( char *what ) /*************************/ { if( IS_ID_OR_KEYWORD( CurToken ) ) { return( PragIdRecog( what ) ); } return( 0 ); }
static void pragPack( // #PRAGMA PACK void ) { if( ExpectingToken( T_LEFT_PAREN ) ) { PPCTL_ENABLE_MACROS(); NextToken(); PPCTL_DISABLE_MACROS(); switch( CurToken ) { case T_ID: if( PragIdRecog( "pop" ) ) { popPrag( &HeadPacks, &PackAmount ); } else if( PragIdRecog( "push" ) ) { if( CurToken == T_RIGHT_PAREN ) { pushPrag( &HeadPacks, PackAmount ); } else { if( ExpectingToken( T_COMMA ) ) { PPCTL_ENABLE_MACROS(); NextToken(); PPCTL_DISABLE_MACROS(); } if( CurToken == T_CONSTANT ) { pushPrag( &HeadPacks, PackAmount ); PackAmount = VerifyPackAmount( U32Fetch( Constant64 ) ); NextToken(); } else { MustRecog( T_CONSTANT ); } } } else { CErr( ERR_EXPECTING_BUT_FOUND, "push or pop", Buffer ); } break; case T_CONSTANT: PackAmount = VerifyPackAmount( U32Fetch( Constant64 ) ); NextToken(); break; case T_RIGHT_PAREN: PackAmount = GblPackAmount; break; default: break; } MustRecog( T_RIGHT_PAREN ); } }
static bool startPragRecog( char *id ) { bool retb; PPCTL_ENABLE_MACROS(); retb = PragIdRecog( id ); PPCTL_DISABLE_MACROS(); return( retb ); }
local int startPragRecog( char *what ) /************************************/ { int rc; PPCTL_ENABLE_MACROS(); rc = PragIdRecog( what ); PPCTL_DISABLE_MACROS(); return( rc ); }
void CPragma( void ) // PROCESS A PRAGMA { bool check_end = true; SrcFileGuardStateSig(); CompFlags.in_pragma = 1; NextToken(); if( PragRecog( "include_alias" ) ) { pragIncludeAlias(); } else if( CompFlags.cpp_output ) { PPCTL_ENABLE_MACROS(); fprintf( CppFile, "#pragma " ); for( ; CurToken != T_NULL; ) { PrtToken(); GetNextToken(); } PPCTL_DISABLE_MACROS(); } else if( IS_ID_OR_KEYWORD( CurToken ) ) { if( PragIdRecog( "on" ) ) { pragFlag( true ); } else if( PragIdRecog( "off" ) ) { pragFlag( false ); } else if( PragIdRecog( "aux" ) || PragIdRecog( "linkage" ) ) { PragAux(); } else if( PragIdRecog( "library" ) ) { pragLibs(); } else if( PragIdRecog( "once" ) ) { pragOnce(); } else if( PragIdRecog( "extref" ) ) { pragExtRef(); } else if( PragIdRecog( "comment" ) ) { pragComment(); } else if( PragIdRecog( "pack" ) ) { pragPack(); } else if( PragIdRecog( "warning" ) ) { if( pragWarning() ) { /* ignore #pragma warning */ check_end = false; /* skip rest of line */ } } else if( PragIdRecog( "enable_message" ) ) { pragEnableMessage(); } else if( PragIdRecog( "disable_message" ) ) { pragDisableMessage(); } else if( PragIdRecog( "code_seg" ) ) { pragCodeSeg(); } else if( PragIdRecog( "data_seg" ) ) { pragDataSeg(); } else if( PragIdRecog( "initialize" ) ) { pragInitialize(); } else if( PragIdRecog( "init_seg" ) ) { pragInitSeg(); } else if( PragIdRecog( "inline_depth" ) ) { pragInlineDepth(); } else if( PragIdRecog( "template_depth" ) ) { pragTemplateDepth(); } else if( PragIdRecog( "inline_recursion" ) ) { pragInlineRecursion(); } else if( PragIdRecog( "intrinsic" ) ) { pragIntrinsic( true ); } else if( PragIdRecog( "function" ) ) { pragIntrinsic( false ); } else if( PragIdRecog( "destruct" ) ) { pragDestruct(); } else if( PragIdRecog( "enum" ) ) { pragEnum(); } else if( PragIdRecog( "dump_object_model" ) ) { pragDumpObjectModel(); } else if( startPragRecog( "read_only_file" ) ) { pragReadOnlyFile(); } else if( startPragRecog( "read_only_directory" ) ) { pragReadOnlyDir(); } else if( PragIdRecog( "include_alias" ) ) { pragIncludeAlias(); } else if( PragIdRecog( "message" ) ) { pragMessage(); } else if( PragIdRecog( "error" ) ) { pragError(); #ifndef NDEBUG } else if( PragIdRecog( "break" ) ) { pragBreak(); #endif } else { /* unknown pragma */ check_end = false; /* skip rest of line */ } } else { /* unknown pragma */ check_end = false; /* skip rest of line */ } if( check_end ) { endOfPragma(); } CompFlags.in_pragma = 0; }
void CPragma( void ) /******************/ { bool check_end = TRUE; /* Note that the include_alias pragma must always be processed * because it's intended for the preprocessor, not the compiler. */ CompFlags.in_pragma = 1; NextToken(); if( PragRecog( "include_alias" ) ) { PragIncludeAlias(); } else if( CompFlags.cpp_output ) { PPCTL_ENABLE_MACROS(); CppPrtf( "#pragma " ); for( ; CurToken != T_NULL; ) { CppPrtToken(); GetNextToken(); } PPCTL_DISABLE_MACROS(); } else if( IS_ID_OR_KEYWORD( CurToken ) ) { if( PragIdRecog( "on" ) ) { PragFlag( 1 ); } else if( PragIdRecog( "off" ) ) { PragFlag( 0 ); } else if( PragIdRecog( "aux" ) || PragIdRecog( "linkage" ) ) { PragAux(); } else if( PragIdRecog( "library" ) ) { PragLibs(); } else if( PragIdRecog( "comment" ) ) { PragComment(); } else if( PragIdRecog( "pack" ) ) { PragPack(); } else if( PragIdRecog( "alloc_text" ) ) { PragAllocText(); } else if( PragIdRecog( "code_seg" ) ) { PragCodeSeg(); } else if( PragIdRecog( "data_seg" ) ) { PragDataSeg(); } else if( PragIdRecog( "disable_message" ) ) { PragEnableDisableMessage( 0 ); } else if( PragIdRecog( "enable_message" ) ) { PragEnableDisableMessage( 1 ); } else if( PragIdRecog( "include_alias" ) ) { PragIncludeAlias(); } else if( PragIdRecog( "message" ) ) { PragMessage(); } else if( PragIdRecog( "intrinsic" ) ) { PragIntrinsic( 1 ); } else if( PragIdRecog( "function" ) ) { PragIntrinsic( 0 ); } else if( PragIdRecog( "enum" ) ) { PragEnum(); } else if( startPragRecog( "read_only_file" ) ) { PragReadOnlyFile(); } else if( startPragRecog( "read_only_directory" ) ) { PragReadOnlyDir(); } else if( PragIdRecog( "once" ) ) { PragOnce(); } else if( PragIdRecog( "unroll" ) ) { PragUnroll(); } else if( PragIdRecog( "STDC" ) ) { PragSTDC(); } else if( PragIdRecog( "extref" ) ) { PragExtRef(); } else if( PragIdRecog( "alias" ) ) { PragAlias(); } else { check_end = FALSE; } } else { check_end = FALSE; } if( check_end ) EndOfPragma(); CompFlags.in_pragma = 0; }