ScriptFile* ResourceMgr::GetScriptFile(const string& Path) { if (ScriptFile* pCache = CacheHolder.Read(Path)) return pCache; ScriptFile* pScript = ReadScriptFile(Path); if (!pScript) return nullptr; for (const string& i : pScript->GetIncludes()) GetScriptFile(i); CacheHolder.Write(Path, pScript); return pScript; }
ScriptView::ScriptView(ScriptFile& script) : QPlainTextEdit(nullptr), ui(new Ui::ScriptView), mpScriptFile(&script), mpHighlighter(nullptr), mpLineNumberArea(nullptr), mCountCache(), mTabWidth(0) { ui->setupUi(this); script.ensureLoaded(); QTextDocument& doc = script.getDocument(); setDocument(&doc); setWindowTitle(script.getPath()); installFont(); installHighlighter(); installLineNumberArea(); }
bool ScriptReader::readScript(const LinkerConfig& pConfig, ScriptFile& pScriptFile) { Input& input = pScriptFile.input(); size_t size = input.memArea()->size(); llvm::StringRef region = input.memArea()->request(input.fileOffset(), size); std::stringbuf buf(region.data()); std::istream in(&buf); ScriptScanner scanner(&in); ScriptParser parser(pConfig, pScriptFile, scanner, m_ObjectReader, m_ArchiveReader, m_DynObjReader, m_GroupReader); return parser.parse() == 0; }
bool ScriptReader::readScript(const LinkerConfig& pConfig, ScriptFile& pScriptFile) { bool result = false; Input& input = pScriptFile.input(); size_t size = input.memArea()->size(); llvm::StringRef region = input.memArea()->request(input.fileOffset(), size); std::stringbuf buf(region.data()); std::istream in(&buf); ScriptScanner scanner(&in); ScriptParser parser(pConfig, pScriptFile, scanner, m_GroupReader); result = (0 == parser.parse());; return result; }
bool ScriptReader::readScript(const LinkerConfig& pConfig, ScriptFile& pScriptFile) { bool result = false; std::stringbuf buf; Input& input = pScriptFile.input(); size_t size = input.memArea()->size(); MemoryRegion* region = input.memArea()->request(input.fileOffset(), size); char* str = reinterpret_cast<char*>(region->getBuffer()); buf.pubsetbuf(str, size); std::istream in(&buf); ScriptScanner scanner(&in); ScriptParser parser(pConfig, pScriptFile, scanner, m_GroupReader); result = (0 == parser.parse());; input.memArea()->release(region); return result; }