diff options
author | Sam Clegg <sbc@chromium.org> | 2016-12-14 17:44:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-14 17:44:37 -0800 |
commit | cdcdda11bbdf2d39340ec9bdb51e6af8e2cb268c (patch) | |
tree | f0b5609e4404b0d4d44d3091809edbd749a0b27f /src/binary-reader.h | |
parent | 55293660eb9f01d50256cb272478e2ad86713c6b (diff) | |
download | wabt-cdcdda11bbdf2d39340ec9bdb51e6af8e2cb268c.tar.gz wabt-cdcdda11bbdf2d39340ec9bdb51e6af8e2cb268c.tar.bz2 wabt-cdcdda11bbdf2d39340ec9bdb51e6af8e2cb268c.zip |
Make some binary reading/writing utilities public (#245)
* Make some binary reading/writing utilities public
This is mostly a refactor to make some of the internal
binary reading/writing utilities public and available
to the wasm linker prototype that I'm working on.
Diffstat (limited to 'src/binary-reader.h')
-rw-r--r-- | src/binary-reader.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/binary-reader.h b/src/binary-reader.h index e51c0f01..93ffe1cc 100644 --- a/src/binary-reader.h +++ b/src/binary-reader.h @@ -49,6 +49,10 @@ typedef struct WasmBinaryReader { WasmResult (*begin_module)(uint32_t version, void* user_data); WasmResult (*end_module)(void* user_data); + WasmResult (*begin_section)(WasmBinaryReaderContext* ctx, + WasmBinarySection section_type, + uint32_t size); + /* custom section */ WasmResult (*begin_custom_section)(WasmBinaryReaderContext* ctx, uint32_t size, @@ -242,9 +246,10 @@ typedef struct WasmBinaryReader { void* user_data); WasmResult (*begin_elem_segment_init_expr)(uint32_t index, void* user_data); WasmResult (*end_elem_segment_init_expr)(uint32_t index, void* user_data); - WasmResult (*on_elem_segment_function_index_count)(uint32_t index, - uint32_t count, - void* user_data); + WasmResult (*on_elem_segment_function_index_count)( + WasmBinaryReaderContext* ctx, + uint32_t index, + uint32_t count); WasmResult (*on_elem_segment_function_index)(uint32_t index, uint32_t func_index, void* user_data); @@ -308,6 +313,14 @@ WasmResult wasm_read_binary(struct WasmAllocator* allocator, WasmBinaryReader* reader, uint32_t num_function_passes, const WasmReadBinaryOptions* options); + +size_t wasm_read_u32_leb128(const uint8_t* ptr, + const uint8_t* end, + uint32_t* out_value); + +size_t wasm_read_i32_leb128(const uint8_t* ptr, + const uint8_t* end, + uint32_t* out_value); WASM_EXTERN_C_END #endif /* WASM_BINARY_READER_H_ */ |