ElfMapper::ElfMapper(ElfObj *eo, uint8_t *buf) { this->eo = eo; this->buf = buf; this->virt_base_valid = false; _scan(); }
/// /// Initializes a new instance of the class. The specified input stream /// provides tokens for the expression. /// \param in The input stream providing tokens. /// explicit basic_shunting_yard(std::istream & in) : _args () , _queue () { std::vector<_token> tokens; _scan(in, tokens); _enqueue(tokens); for (const auto & t : _queue) if (t.type == _token::variable) _args[t.text] = float_type(0); evaluate(_args); }
void lexer_process(void) { token_t token; token_t (*process_token)(void) = NULL; if (_.eoi_reached) return; _scan(); _flush_buffer(); switch (_cur_char()) { case '\0': process_token = _process_eoi; _.eoi_reached = true; break; case SIGIL_STR_VAR: case SIGIL_INT_VAR: case SIGIL_BOOL_VAR: process_token = _process_variable; break; case DELIMITER_STR: process_token = _process_string; break; default: // identifer if (_char_is_alpha(_cur_char())) { process_token = _process_identifier; break; } // literal unsigned integer without prefix sign if (_char_is_digit(_cur_char())) { process_token = _process_luinteger; break; } // unknown process_token = _process_unknown; } token = process_token(); _set_token(token); }
void CClientExtractor::_scan(const string& dir) { QDir directory(dir); if (!directory.exists()) return; const QStringList files = directory.entryList(QStringList("*.res"), QDir::Files); for (int i = 0; i < files.size(); i++) m_files.append(dir % '/' % files[i]); QStringList subDirs = directory.entryList(QDir::Dirs); if (subDirs.size() > 0) { subDirs.removeAll("."); subDirs.removeAll(".."); for (int i = 0; i < subDirs.size(); i++) _scan(dir % '/' % subDirs[i]); } }
void CClientExtractor::ExtractAll() { const string root = ui.dir->text(); if (root.isEmpty()) return; _scan(root); if (m_files.size() > 0) { ui.progress->setMaximum(m_files.size()); qApp->processEvents(); CFileModel* model; for (int i = 0; i < m_files.size(); i++) { const string filename = m_files[i]; model = new CFileModel(this); if (model->Load(filename)) model->ExtractAllFiles(QFileInfo(filename).dir().path(), ui.replaceFiles->isChecked()); Delete(model); if (ui.deleteRes->isChecked()) QFile::remove(filename); ui.progress->setValue(i + 1); qApp->processEvents(); } } QMessageBox::information(this, tr("Terminé"), tr("Tous les fichiers ont été extraits.")); close(); }