MCPcopy Create free account
hub / github.com/carbonengine/trinity / IncludeFile

Method IncludeFile

shadercompiler/ParserState.cpp:991–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

989}
990
991void ParserState::IncludeFile( const InlineString& fileName )
992{
993 extern CachingIncludeHandler g_includeHandler;
994
995 std::string path( fileName.start + 1, fileName.end - 1 );
996 if( auto file = g_includeHandler.Open( path.c_str(), m_fileStack.back().code.start + 1 ) )
997 {
998 FileContents fileContents;
999
1000 size_t len = file->fullPath.size();
1001 char* fullPath = AllocateString( len );
1002 memcpy( fullPath, file->fullPath.data(), len );
1003 fileContents.location.fileName = MakeInlineString( fullPath, fullPath + len );
1004
1005 fileContents.location.lineNumber = 0;
1006 fileContents.code = MakeInlineString( file->data - 1, file->data + file->size );
1007 fileContents.position = file->data - 1;
1008 fileContents.isMacro = false;
1009
1010 m_fileStack.push_back( fileContents );
1011 }
1012 else
1013 {
1014 ShowMessage( EC_FILE_NOT_FOUND, path.c_str() );
1015 }
1016}
1017
1018void ParserState::ParseDefine( const PreprocessorDefine& define, const FileLocation& location, const std::vector<InlineString>& arguments )
1019{

Callers

nothing calls this directly

Calls 3

MakeInlineStringFunction · 0.85
OpenMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected