From 1b3600b0aca6a8f23b6d9e8ae33dcd75c9493810 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Mon, 11 Jan 2016 17:23:27 -0800 Subject: asm2wasm: use support's command-line --- src/support/file.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/support/file.cpp') diff --git a/src/support/file.cpp b/src/support/file.cpp index 470d07737..8813750d4 100644 --- a/src/support/file.cpp +++ b/src/support/file.cpp @@ -18,7 +18,8 @@ #include -std::string wasm::read_file(const std::string &filename, bool debug) { +template +T wasm::read_file(const std::string &filename, bool debug) { if (debug) std::cerr << "Loading '" << filename << "'..." << std::endl; std::ifstream infile(filename); if (!infile.is_open()) { @@ -27,12 +28,16 @@ std::string wasm::read_file(const std::string &filename, bool debug) { } infile.seekg(0, std::ios::end); size_t insize = infile.tellg(); - std::string input(insize + 1, '\0'); + T input(insize + 1, '\0'); infile.seekg(0); infile.read(&input[0], insize); return input; } +// Explicit instantiations for the explicit specializations. +template std::string wasm::read_file<>(const std::string &, bool); +template std::vector wasm::read_file<>(const std::string &, bool); + wasm::Output::Output(const std::string &filename, bool debug) : outfile(), out([this, filename, debug]() { std::streambuf *buffer; -- cgit v1.2.3