summaryrefslogtreecommitdiff
path: root/src/s2wasm.h
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2015-12-22 11:29:34 -0800
committerJF Bastien <jfb@chromium.org>2015-12-22 11:29:34 -0800
commit05a6eb48c1258a9d8f7cb8356e541d0fad50bc30 (patch)
tree082b8e43445ff3aa38154787bb062cb3b56f6bdd /src/s2wasm.h
parent8794a809838ba609400f7f8c5d41571700cbf289 (diff)
downloadbinaryen-05a6eb48c1258a9d8f7cb8356e541d0fad50bc30.tar.gz
binaryen-05a6eb48c1258a9d8f7cb8356e541d0fad50bc30.tar.bz2
binaryen-05a6eb48c1258a9d8f7cb8356e541d0fad50bc30.zip
s2wasm: add outfile
Use some C++ in a few places. I'll propagate similar changes to the rest of the codebase later. I also need to turn off colors when outputting to a file (isatty on stdout doesn't do that with -o) but I'll do it in a separate PR because it'll touch more files.
Diffstat (limited to 'src/s2wasm.h')
-rw-r--r--src/s2wasm.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index fea5f04a8..5801f2620 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -24,8 +24,6 @@
namespace wasm {
-extern int debug; // wasm::debug is set in main(), typically from an env var
-
cashew::IString EMSCRIPTEN_ASM_CONST("emscripten_asm_const");
//
@@ -35,15 +33,17 @@ cashew::IString EMSCRIPTEN_ASM_CONST("emscripten_asm_const");
class S2WasmBuilder {
AllocatingModule& wasm;
MixedArena& allocator;
- char *s;
+ const char *s;
+ bool debug;
public:
- S2WasmBuilder(AllocatingModule& wasm, char *input) : wasm(wasm), allocator(wasm.allocator) {
- s = input;
- scan();
- s = input;
- process();
- fix();
+ S2WasmBuilder(AllocatingModule& wasm, const char* input, bool debug)
+ : wasm(wasm), allocator(wasm.allocator), debug(debug) {
+ s = input;
+ scan();
+ s = input;
+ process();
+ fix();
}
private:
@@ -217,7 +217,7 @@ private:
skipWhitespace();
if (*s != '$') return Name();
std::string str;
- char *before = s;
+ const char *before = s;
while (*s && *s != '=' && *s != '\n' && *s != ',') {
str += *s;
s++;
@@ -393,7 +393,7 @@ private:
};
auto getNumInputs = [&]() {
int ret = 1;
- char *t = s;
+ const char *t = s;
while (*t != '\n') {
if (*t == ',') ret++;
t++;