diff options
author | Ben Smith <binji@chromium.org> | 2016-04-17 13:23:15 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2016-04-17 13:25:02 -0700 |
commit | cd5b8f5494073fc0a35d70aa2b1091f3742dc096 (patch) | |
tree | 78c17a81d5b3c681a85b35774e3bdbe0e558e1a6 /src/wasm-common.c | |
parent | 3417080552bf58bd74196308dbf73ebe4ef62102 (diff) | |
download | wabt-cd5b8f5494073fc0a35d70aa2b1091f3742dc096.tar.gz wabt-cd5b8f5494073fc0a35d70aa2b1091f3742dc096.tar.bz2 wabt-cd5b8f5494073fc0a35d70aa2b1091f3742dc096.zip |
add WasmStream; refactor writing
Diffstat (limited to 'src/wasm-common.c')
-rw-r--r-- | src/wasm-common.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/wasm-common.c b/src/wasm-common.c index 834ce59d..9b13ba8c 100644 --- a/src/wasm-common.c +++ b/src/wasm-common.c @@ -17,18 +17,12 @@ #include "wasm-common.h" #include <assert.h> -#include <ctype.h> -#include <stdio.h> -#include <stdarg.h> #include <stdio.h> #include <stdint.h> #include <string.h> #include "wasm-allocator.h" -#define DUMP_OCTETS_PER_LINE 16 -#define DUMP_OCTETS_PER_GROUP 2 - #define V(rtype, type1, type2, mem_size, code, NAME, text) [code] = mem_size, static uint8_t s_opcode_mem_size[] = {WASM_FOREACH_OPCODE(V)}; #undef V @@ -57,44 +51,6 @@ void wasm_destroy_string_slice(WasmAllocator* allocator, WasmStringSlice* str) { wasm_free(allocator, (void*)str->start); } -void wasm_print_memory(const void* start, - size_t size, - size_t offset, - WasmPrintChars print_chars, - const char* desc) { - /* mimic xxd output */ - const uint8_t* p = start; - const uint8_t* end = p + size; - while (p < end) { - const uint8_t* line = p; - const uint8_t* line_end = p + DUMP_OCTETS_PER_LINE; - printf("%07" PRIzx ": ", (size_t)p - (size_t)start + offset); - while (p < line_end) { - int i; - for (i = 0; i < DUMP_OCTETS_PER_GROUP; ++i, ++p) { - if (p < end) { - printf("%02x", *p); - } else { - putchar(' '); - putchar(' '); - } - } - putchar(' '); - } - - putchar(' '); - p = line; - int i; - for (i = 0; i < DUMP_OCTETS_PER_LINE && p < end; ++i, ++p) - if (print_chars) - printf("%c", isprint(*p) ? *p : '.'); - /* if there are multiple lines, only print the desc on the last one */ - if (p >= end && desc) - printf(" ; %s", desc); - putchar('\n'); - } -} - WasmResult wasm_read_file(WasmAllocator* allocator, const char* filename, void** out_data, |