mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
patterns: Update pattern language
This commit is contained in:
@@ -122,7 +122,7 @@ namespace hex::plugin::builtin {
|
||||
std::atomic<bool> m_triggerAutoEvaluate = false;
|
||||
|
||||
volatile bool m_lastEvaluationProcessed = true;
|
||||
bool m_lastEvaluationResult = false;
|
||||
int m_lastEvaluationResult = false;
|
||||
|
||||
std::atomic<u32> m_runningEvaluators = 0;
|
||||
std::atomic<u32> m_runningParsers = 0;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace hex::plugin::builtin {
|
||||
m_foundPattern = pattern;
|
||||
|
||||
constexpr static auto DataDescriptionFunction = "get_data_description";
|
||||
if (runtime.executeFile(pattern.patternFilePath)) {
|
||||
if (runtime.executeFile(pattern.patternFilePath) == 0) {
|
||||
const auto &evaluator = runtime.getInternals().evaluator;
|
||||
const auto &functions = evaluator->getCustomFunctions();
|
||||
if (const auto function = functions.find(DataDescriptionFunction); function != functions.end()) {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::PatternLanguage::configureRuntime(runtime, &m_provider);
|
||||
|
||||
constexpr static auto DataDescriptionFunction = "get_data_description";
|
||||
if (runtime.executeFile(m_foundPatterns.front().patternFilePath)) {
|
||||
if (runtime.executeFile(m_foundPatterns.front().patternFilePath) == 0) {
|
||||
const auto &evaluator = runtime.getInternals().evaluator;
|
||||
const auto &functions = evaluator->getCustomFunctions();
|
||||
if (const auto function = functions.find(DataDescriptionFunction); function != functions.end()) {
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
ContentRegistry::PatternLanguage::configureRuntime(m_runtime, &m_provider);
|
||||
if (!m_runtime.executeString(this->m_sourceCode)) {
|
||||
if (m_runtime.executeString(this->m_sourceCode) != 0) {
|
||||
ui::ToastError::open("hex.builtin.view.fullscreen.save_editor.error.failed_execution"_lang);
|
||||
for (const auto &error : m_runtime.getCompileErrors()) {
|
||||
log::error("Save Editor Error: {}", error.format());
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void ViewDataInspector::executeInspector(const std::string& code, const std::fs::path& path, const std::map<std::string, pl::core::Token::Literal>& inVariables) {
|
||||
if (!m_runtime.executeString(code, pl::api::Source::DefaultSource, {}, inVariables, true)) {
|
||||
if (m_runtime.executeString(code, pl::api::Source::DefaultSource, {}, inVariables, true) == 0) {
|
||||
|
||||
auto displayFunction = createPatternErrorDisplayFunction();
|
||||
|
||||
|
||||
@@ -1335,7 +1335,7 @@ namespace hex::plugin::builtin {
|
||||
return;
|
||||
|
||||
if (!m_lastEvaluationProcessed) {
|
||||
if (!m_lastEvaluationResult) {
|
||||
if (m_lastEvaluationResult != 0) {
|
||||
const auto processMessage = [](const auto &message) {
|
||||
auto lines = wolv::util::splitString(message, "\n");
|
||||
|
||||
@@ -1796,7 +1796,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
m_lastEvaluationResult = runtime.executeString(code, pl::api::Source::DefaultSource, envVars, inVariables);
|
||||
if (!m_lastEvaluationResult) {
|
||||
if (m_lastEvaluationResult != 0) {
|
||||
*m_lastEvaluationError = runtime.getEvalError();
|
||||
*m_lastCompileError = runtime.getCompileErrors();
|
||||
*m_callStack = &runtime.getInternals().evaluator->getCallStack();
|
||||
|
||||
Reference in New Issue
Block a user