| 1045 | } |
| 1046 | |
| 1047 | bool CPreprocessor::HandleIfDef( Token &iBody, int iLine ) |
| 1048 | { |
| 1049 | if( EnableOutput & ( 1u << 31u ) ) |
| 1050 | { |
| 1051 | Error( iLine, "Too many embedded #if directives" ); |
| 1052 | return false; |
| 1053 | } |
| 1054 | |
| 1055 | CPreprocessor cpp( iBody, iLine ); |
| 1056 | |
| 1057 | Token t = cpp.GetToken( false ); |
| 1058 | |
| 1059 | if( t.Type != Token::TK_KEYWORD ) |
| 1060 | { |
| 1061 | Error( iLine, "Expecting a macro name after #ifdef, got", &t ); |
| 1062 | return false; |
| 1063 | } |
| 1064 | |
| 1065 | EnableOutput <<= 1; |
| 1066 | if( IsDefined( t ) ) |
| 1067 | EnableOutput |= 1; |
| 1068 | |
| 1069 | do |
| 1070 | { |
| 1071 | t = cpp.GetToken( false ); |
| 1072 | } while( t.Type == Token::TK_WHITESPACE || t.Type == Token::TK_COMMENT || |
| 1073 | t.Type == Token::TK_LINECOMMENT ); |
| 1074 | |
| 1075 | if( t.Type != Token::TK_EOS ) |
| 1076 | Error( iLine, "Warning: Ignoring garbage after directive", &t ); |
| 1077 | |
| 1078 | return true; |
| 1079 | } |
| 1080 | |
| 1081 | CPreprocessor::Token CPreprocessor::ExpandDefined( CPreprocessor *iParent, int iNumArgs, |
| 1082 | Token *iArgs ) |