Skip to content

Commit

Permalink
add python binding for kore_header constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwight Guth committed May 13, 2024
1 parent a995c17 commit 62e83cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bindings/python/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ void bind_proof_trace(py::module_ &m) {
return parser.parse_proof_trace(str);
},
py::arg("bytes"), py::arg("header"));

py::class_<kore_header, std::shared_ptr<kore_header>>(
proof_trace, "kore_header")
.def(py::init(&kore_header::create), py::arg("path"));
}

PYBIND11_MODULE(_kllvm, m) {
Expand Down
7 changes: 7 additions & 0 deletions include/kllvm/binary/deserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ class kore_header {

public:
kore_header(FILE *in);
static std::unique_ptr<kore_header> create(std::string path) {
FILE *f = fopen(path.c_str(), "rb");
auto *result = new kore_header(f);
fclose(f);
return std::unique_ptr<kore_header>(result);
}

[[nodiscard]] uint8_t get_arity(uint32_t offset) const {
return arities_[offset];
};
Expand Down

0 comments on commit 62e83cc

Please sign in to comment.