Skip to content

Commit

Permalink
Merge branch 'master' into BrakepointFixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paxcut authored Oct 23, 2024
2 parents db753a6 + 3739bcc commit 80f5975
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cmake-build-*/
build*/
local/
venv/
.cache/

*.mgc
*.kdev4
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ include("${IMHEX_BASE_FOLDER}/cmake/ide_helpers.cmake")
# Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include("${IMHEX_BASE_FOLDER}/cmake/build_helpers.cmake")

# Setup project
Expand Down
2 changes: 1 addition & 1 deletion lib/external/pattern_language
Submodule pattern_language updated 39 files
+0 −5 cli/source/subcommands/docs.cpp
+4 −1 generators/include/pl/formatters/formatter_html.hpp
+5 −0 generators/include/pl/formatters/formatter_json.hpp
+5 −0 generators/include/pl/formatters/formatter_yaml.hpp
+1 −0 lib/CMakeLists.txt
+5 −4 lib/include/pl/api.hpp
+23 −0 lib/include/pl/core/ast/ast_node_imported_type.hpp
+24 −2 lib/include/pl/core/evaluator.hpp
+5 −5 lib/include/pl/core/parser.hpp
+2 −2 lib/include/pl/core/resolvers.hpp
+2 −1 lib/include/pl/core/token.hpp
+1 −0 lib/include/pl/core/tokens.hpp
+33 −10 lib/include/pl/pattern_language.hpp
+31 −5 lib/include/pl/patterns/pattern.hpp
+15 −7 lib/include/pl/patterns/pattern_array_dynamic.hpp
+1 −1 lib/include/pl/patterns/pattern_array_static.hpp
+4 −4 lib/include/pl/patterns/pattern_bitfield.hpp
+1 −1 lib/include/pl/patterns/pattern_string.hpp
+15 −20 lib/include/pl/patterns/pattern_struct.hpp
+15 −19 lib/include/pl/patterns/pattern_union.hpp
+1 −1 lib/include/pl/patterns/pattern_wide_string.hpp
+1 −1 lib/source/pl/core/api.cpp
+1 −1 lib/source/pl/core/ast/ast_node_array_variable_decl.cpp
+33 −0 lib/source/pl/core/ast/ast_node_attribute.cpp
+1 −1 lib/source/pl/core/ast/ast_node_bitfield_array_variable_decl.cpp
+44 −0 lib/source/pl/core/ast/ast_node_imported_type.cpp
+11 −1 lib/source/pl/core/ast/ast_node_struct.cpp
+1 −1 lib/source/pl/core/ast/ast_node_type_decl.cpp
+11 −1 lib/source/pl/core/ast/ast_node_union.cpp
+3 −3 lib/source/pl/core/evaluator.cpp
+44 −19 lib/source/pl/core/parser.cpp
+5 −15 lib/source/pl/core/preprocessor.cpp
+1 −1 lib/source/pl/core/resolvers.cpp
+1 −0 lib/source/pl/core/token.cpp
+25 −0 lib/source/pl/lib/std/core.cpp
+91 −36 lib/source/pl/pattern_language.cpp
+1 −1 tests/include/test_patterns/test_pattern_bitfields.hpp
+1 −1 tests/include/test_patterns/test_pattern_placement.hpp
+1 −1 tests/include/test_patterns/test_pattern_pointers.hpp
2 changes: 0 additions & 2 deletions lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,6 @@ void TextEditor::EnterCharacter(ImWchar aChar, bool aShift) {
auto coord = GetActualCursorCoordinates();
u.mAddedStart = coord;

assert(!mLines.empty());

if (aChar == '\n') {
InsertLine(coord.mLine + 1);
auto &line = mLines[coord.mLine];
Expand Down
6 changes: 3 additions & 3 deletions main/gui/source/window/linux_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace hex {
&& FcPatternGetString(font, FC_FAMILY, 0, &fullName) != FcResultMatch) {
continue;
}

registerFont(reinterpret_cast<const char *>(fullName), reinterpret_cast<const char *>(file));
}

Expand Down Expand Up @@ -123,7 +123,7 @@ namespace hex {
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);

#if defined(GLFW_WAYLAND_APP_ID)
glfwWindowHintString(GLFW_WAYLAND_APP_ID, "imhex");
glfwWindowHintString(GLFW_WAYLAND_APP_ID, "imhex");
#endif
}

Expand Down Expand Up @@ -190,4 +190,4 @@ namespace hex {

}

#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ namespace hex::plugin::builtin {
PerProvider<std::unordered_set<u32>> m_breakpoints;
PerProvider<std::optional<pl::core::err::PatternLanguageError>> m_lastEvaluationError;
PerProvider<std::vector<pl::core::err::CompileError>> m_lastCompileError;
PerProvider<std::vector<const pl::core::ast::ASTNode*>> m_callStack;
PerProvider<const std::vector<std::unique_ptr<pl::core::ast::ASTNode>>*> m_callStack;
PerProvider<std::map<std::string, pl::core::Token::Literal>> m_lastEvaluationOutVars;
PerProvider<std::map<std::string, PatternVariable>> m_patternVariables;
PerProvider<std::map<u64, pl::api::Section>> m_sections;
Expand Down
4 changes: 2 additions & 2 deletions plugins/builtin/source/content/pl_pragmas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace hex::plugin::builtin {

void registerPatternLanguagePragmas() {

ContentRegistry::PatternLanguage::addPragma("base_address", [](const pl::PatternLanguage &runtime, const std::string &value) {
ContentRegistry::PatternLanguage::addPragma("base_address", [](pl::PatternLanguage &runtime, const std::string &value) {
auto baseAddress = strtoull(value.c_str(), nullptr, 0);

ImHexApi::Provider::get()->setBaseAddress(baseAddress);
Expand All @@ -27,4 +27,4 @@ namespace hex::plugin::builtin {
});
}

}
}
6 changes: 3 additions & 3 deletions plugins/builtin/source/content/views/view_pattern_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,8 +1353,8 @@ namespace hex::plugin::builtin {
};

TextEditor::ErrorMarkers errorMarkers;
if (!m_callStack->empty()) {
for (const auto &frame : *m_callStack | std::views::reverse) {
if (!(*m_callStack)->empty()) {
for (const auto &frame : **m_callStack | std::views::reverse) {
auto location = frame->getLocation();
std::string message;
if (location.source->source == pl::api::Source::DefaultSource) {
Expand Down Expand Up @@ -1816,7 +1816,7 @@ namespace hex::plugin::builtin {
if (!m_lastEvaluationResult) {
*m_lastEvaluationError = runtime.getEvalError();
*m_lastCompileError = runtime.getCompileErrors();
*m_callStack = reinterpret_cast<const std::vector<const pl::core::ast::ASTNode *> &>(runtime.getInternals().evaluator->getCallStack());
*m_callStack = &runtime.getInternals().evaluator->getCallStack();
}

TaskManager::doLater([code] {
Expand Down
1 change: 1 addition & 0 deletions plugins/ui/include/ui/pattern_drawer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,6 @@ namespace hex::ui {
std::function<void(const pl::ptrn::Pattern *)> m_hoverCallback = [](const pl::ptrn::Pattern *) { };

pl::gen::fmt::FormatterArray m_formatters;
u64 m_lastRunId = 0;
};
}
10 changes: 10 additions & 0 deletions plugins/ui/source/ui/pattern_drawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,16 @@ namespace hex::ui {
}

void PatternDrawer::draw(const std::vector<std::shared_ptr<pl::ptrn::Pattern>> &patterns, const pl::PatternLanguage *runtime, float height) {
if (runtime == nullptr) {
this->reset();
} else {
auto runId = runtime->getRunId();
if (runId != m_lastRunId) {
this->reset();
m_lastRunId = runId;
}
}

std::scoped_lock lock(s_resetDrawMutex);

m_hoverCallback(nullptr);
Expand Down

0 comments on commit 80f5975

Please sign in to comment.