From ab4290e57d39ef079e82377d91bd27dcde4d73ae Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Tue, 25 Apr 2017 22:09:56 -0700 Subject: Fix emscripten demo and libwabt.js (#407) This removes the more complicated emscripten wrapper we used before, in favor of something that is much simpler. * Remove the memory init file * Remove the onInputKey handling in the demo so it doesn't auto-indent (it was broken now that we have the flat syntax) * Simplify emscripten-helpers to provide very simple C-function wrappers around the wast2wasm API: * wabt_parse_ast * wabt_resolve_names_script * wabt_validate_script * wabt_write_binary_module The tricky part is that some functions return multiple values, so those are returned as structs as well: * WabtParseAstResult * WabtWriteBinaryModuleResult --- src/source-error-handler.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/source-error-handler.h') diff --git a/src/source-error-handler.h b/src/source-error-handler.h index eaa50300..7cac7fca 100644 --- a/src/source-error-handler.h +++ b/src/source-error-handler.h @@ -86,6 +86,26 @@ class SourceErrorHandlerFile : public SourceErrorHandler { size_t source_line_max_length_; }; +class SourceErrorHandlerBuffer : public SourceErrorHandler { + public: + explicit SourceErrorHandlerBuffer(size_t source_line_max_length = 80); + + bool OnError(const Location*, + const std::string& error, + const std::string& source_line, + size_t source_line_column_offset) override; + + size_t source_line_max_length() const override { + return source_line_max_length_; + } + + const std::string& buffer() const { return buffer_; } + + private: + size_t source_line_max_length_; + std::string buffer_; +}; + } // namespace wabt #endif // WABT_SOURCE_ERROR_HANDLER_H_ -- cgit v1.2.3