MCPcopy Create free account
hub / github.com/cinder/Cinder / findVersionStatement

Function findVersionStatement

src/cinder/gl/ShaderPreprocessor.cpp:130–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130bool 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
156ShaderPreprocessor::ShaderPreprocessor()

Callers 1

parseDirectivesMethod · 0.85

Calls 2

consumeWhiteSpaceFunction · 0.85
isTerminatedFunction · 0.85

Tested by

no test coverage detected