| 128 | } |
| 129 | |
| 130 | bool findVersionStatement( const char *lineStart, int *versionNumberOut ) |
| 131 | { |
| 132 | const int VERSION_KEYWORD_LEN = 7; |
| 133 | const char *c = lineStart; |
| 134 | consumeWhiteSpace( &c ); |
| 135 | // leading '#' |
| 136 | if( isTerminated( c ) || ( *c != '#' ) ) |
| 137 | return false; |
| 138 | ++c; |
| 139 | consumeWhiteSpace( &c ); |
| 140 | if( isTerminated( c ) ) |
| 141 | return false; |
| 142 | // version keyword |
| 143 | if( strncmp( c, "version", VERSION_KEYWORD_LEN ) ) // 7 == strlen( "version" ) |
| 144 | return false; |
| 145 | c += VERSION_KEYWORD_LEN; |
| 146 | consumeWhiteSpace( &c ); |
| 147 | // leading digit |
| 148 | if( isTerminated( c ) || (! isdigit( *c )) ) |
| 149 | return false; |
| 150 | if( versionNumberOut ) |
| 151 | *versionNumberOut = (int)std::strtol( c, nullptr, 0 ); |
| 152 | return true; |
| 153 | } |
| 154 | } // anonymous namespace |
| 155 | |
| 156 | ShaderPreprocessor::ShaderPreprocessor() |
no test coverage detected