size_t TokensTree::ReserveFileForParsing(const cc_string& filename,bool preliminary) { size_t index = GetFileIndex(filename); if ( m_FilesToBeReparsed.count(index) && ( !m_FilesStatus.count(index) || m_FilesStatus[index]==fpsDone) ) { eraseFile(filename); m_FilesToBeReparsed.erase(index); m_FilesStatus[index]=fpsNotParsed; } if(m_FilesStatus.count(index)) { FileParsingStatus status = m_FilesStatus[index]; if(preliminary) { if(status >= fpsAssigned) return 0; // Already assigned } else { if(status > fpsAssigned) return 0; // No parsing needed } } m_FilesToBeReparsed.erase(index); m_FilesStatus[index]=preliminary ? fpsAssigned : fpsBeingParsed; // Reserve file return index; }
DWORD CArchiveFS::GetFileIndex(char* szFileName) { // PRE: szFileName must be the filename only (no paths!) if (!m_bEntriesLoaded) LoadEntries(); CHAR szFileNameLC[MAX_PATH]; strcpy(szFileNameLC, szFileName); _strlwr(szFileNameLC); DWORD dwHash = this->HashString(szFileNameLC); DWORD dwIndex = GetFileIndex(dwHash); #ifdef _DEBUG if (dwIndex != FS_INVALID_FILE) { CHAR szDebugMsg[1024]; sprintf(szDebugMsg, "ArchiveFS: Requested file: %s...\n", szFileNameLC); OutputDebugString(szDebugMsg); } #endif return dwIndex; }
void CompilerPatternDlg::OnSubmit(wxCommandEvent& event) { if(GetPattern().Trim().IsEmpty() || GetFileIndex().Trim().IsEmpty() || GetLineIndex().Trim().IsEmpty()) { wxMessageBox(_("Please fill all the fields"), _("CodeLite"), wxOK | wxICON_INFORMATION, this); return; } EndModal(wxID_OK); }
bool TokensTree::IsFileParsed(const cc_string& filename) { size_t index = GetFileIndex(filename); bool parsed = (m_FilesMap.count(index) && m_FilesStatus[index]!=fpsNotParsed && !m_FilesToBeReparsed.count(index) ); return parsed; }
std::string ToAlgebraic(Napoleon::Square square) { if (square == Constants::Squares::Invalid) return "Invalid"; std::string str = ""; str += static_cast<char>(GetFileIndex(square) + 'a'); str += std::to_string(GetRankIndex(square) + 1); return str; }
void DbgInfoLine (void) /* Parse and handle LINE subcommand of the .dbg pseudo instruction */ { long Line; FilePos Pos = STATIC_FILEPOS_INITIALIZER; /* Any new line info terminates the last one */ if (CurLineInfo) { EndLine (CurLineInfo); CurLineInfo = 0; } /* If a parameters follow, this is actual line info. If no parameters ** follow, the last line info is terminated. */ if (CurTok.Tok == TOK_SEP) { return; } /* Parameters are separated by a comma */ ConsumeComma (); /* The name of the file follows */ if (CurTok.Tok != TOK_STRCON) { ErrorSkip ("String constant expected"); return; } /* Get the index in the file table for the name */ Pos.Name = GetFileIndex (&CurTok.SVal); /* Skip the name */ NextTok (); /* Comma expected */ ConsumeComma (); /* Line number */ Line = ConstExpression (); if (Line < 0) { ErrorSkip ("Line number is out of valid range"); return; } Pos.Line = Line; /* Generate a new external line info */ CurLineInfo = StartLine (&Pos, LI_TYPE_EXT, 0); }
void TokensTree::eraseFile(const cc_string& filename) { int index = GetFileIndex(filename); eraseFile(index); }
void TokensTree::FlagFileAsParsed(const cc_string& filename) { m_FilesStatus[GetFileIndex(filename)]=fpsDone; }
void TokensTree::FlagFileForReparsing(const cc_string& filename) { m_FilesToBeReparsed.insert(GetFileIndex(filename)); }
void TokensTree::MarkFileTokensAsLocal(const cc_string& filename, bool local, void* userData) { MarkFileTokensAsLocal(GetFileIndex(filename), local, userData); }
FILETIME ArchFile::GetFileTime(const WCHAR *fileName) { return GetFileTime(GetFileIndex(fileName)); }
char *ArchFile::GetFileDataByName(const WCHAR *fileName, size_t *len) { return GetFileDataByIdx(GetFileIndex(fileName), len); }
void TokensTree::RemoveFile(const wxString& filename) { int index = GetFileIndex(filename); RemoveFile(index); }