diff --git a/Makefile b/Makefile index deff006f..cb1446e8 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ LIBCS_CXXFLAGS = \ -std=c++1z -Wall -Wextra -Wshadow -Wold-style-cast -Iinclude -Isrc -g \ -fvisibility=hidden -I$(OSTD_PATH) -LIBCS_LDFLAGS = -shared +LIBCS_LDFLAGS = $(OSTD_PATH)/libostd.a LIBCS_OBJ = \ src/cubescript.o \ @@ -29,8 +29,9 @@ $(LIBCS_LIB): $(LIBCS_OBJ) ar rcs $(LIBCS_LIB) $(LIBCS_OBJ) repl: $(LIBCS_LIB) tools/repl.cc tools/linenoise.cc tools/linenoise.hh - $(CXX) $(CXXFLAGS) $(LIBCS_CXXFLAGS) $(LDFLAGS) \ - -DCS_REPL_USE_LINENOISE tools/linenoise.cc tools/repl.cc -o repl $(LIBCS_LIB) + $(CXX) $(CXXFLAGS) $(LIBCS_CXXFLAGS) \ + -DCS_REPL_USE_LINENOISE tools/linenoise.cc tools/repl.cc \ + $(LDFLAGS) $(LIBCS_LDFLAGS) -o repl $(LIBCS_LIB) clean: rm -f $(LIBCS_LIB) $(LIBCS_OBJ) repl diff --git a/tools/repl.cc b/tools/repl.cc index 38bfaf0c..a1cf1f02 100644 --- a/tools/repl.cc +++ b/tools/repl.cc @@ -159,7 +159,7 @@ static inline cs_command *get_hint_cmd(cs_state &cs, ostd::string_range buf) { /* usage */ void print_usage(ostd::string_range progname, bool err) { - auto &s = err ? ostd::err : ostd::out; + auto &s = err ? ostd::cerr : ostd::cout; s.writeln( "Usage: ", progname, " [options] [file]\n" "Options:\n" @@ -194,7 +194,7 @@ static bool do_call(cs_state &cs, ostd::string_range line, bool file = false) { try { if (file) { if (!cs.run_file(line, ret)) { - ostd::err.writeln("cannot read file: ", line); + ostd::cerr.writeln("cannot read file: ", line); } } else { cs.run(line, ret); @@ -216,7 +216,7 @@ static bool do_call(cs_state &cs, ostd::string_range line, bool file = false) { } ostd::writeln(!is_lnum ? "stdin: " : "stdin:", e.what()); if (e.get_stack().get()) { - cscript::util::print_stack(ostd::out.iter(), e.get_stack()); + cscript::util::print_stack(ostd::cout.iter(), e.get_stack()); ostd::write('\n'); } return false; @@ -370,7 +370,7 @@ endargs: return 0; } else { std::string str; - for (char c = '\0'; (c = ostd::in.getchar()) != EOF;) { + for (char c = '\0'; (c = ostd::cin.get_char()) != EOF;) { str += c; } do_call(gcs, str);