forked from OctaForge/libcubescript
ostd fixes
parent
7294580ccf
commit
69b9042fdc
7
Makefile
7
Makefile
|
@ -4,7 +4,7 @@ LIBCS_CXXFLAGS = \
|
||||||
-std=c++1z -Wall -Wextra -Wshadow -Wold-style-cast -Iinclude -Isrc -g \
|
-std=c++1z -Wall -Wextra -Wshadow -Wold-style-cast -Iinclude -Isrc -g \
|
||||||
-fvisibility=hidden -I$(OSTD_PATH)
|
-fvisibility=hidden -I$(OSTD_PATH)
|
||||||
|
|
||||||
LIBCS_LDFLAGS = -shared
|
LIBCS_LDFLAGS = $(OSTD_PATH)/libostd.a
|
||||||
|
|
||||||
LIBCS_OBJ = \
|
LIBCS_OBJ = \
|
||||||
src/cubescript.o \
|
src/cubescript.o \
|
||||||
|
@ -29,8 +29,9 @@ $(LIBCS_LIB): $(LIBCS_OBJ)
|
||||||
ar rcs $(LIBCS_LIB) $(LIBCS_OBJ)
|
ar rcs $(LIBCS_LIB) $(LIBCS_OBJ)
|
||||||
|
|
||||||
repl: $(LIBCS_LIB) tools/repl.cc tools/linenoise.cc tools/linenoise.hh
|
repl: $(LIBCS_LIB) tools/repl.cc tools/linenoise.cc tools/linenoise.hh
|
||||||
$(CXX) $(CXXFLAGS) $(LIBCS_CXXFLAGS) $(LDFLAGS) \
|
$(CXX) $(CXXFLAGS) $(LIBCS_CXXFLAGS) \
|
||||||
-DCS_REPL_USE_LINENOISE tools/linenoise.cc tools/repl.cc -o repl $(LIBCS_LIB)
|
-DCS_REPL_USE_LINENOISE tools/linenoise.cc tools/repl.cc \
|
||||||
|
$(LDFLAGS) $(LIBCS_LDFLAGS) -o repl $(LIBCS_LIB)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(LIBCS_LIB) $(LIBCS_OBJ) repl
|
rm -f $(LIBCS_LIB) $(LIBCS_OBJ) repl
|
||||||
|
|
|
@ -159,7 +159,7 @@ static inline cs_command *get_hint_cmd(cs_state &cs, ostd::string_range buf) {
|
||||||
/* usage */
|
/* usage */
|
||||||
|
|
||||||
void print_usage(ostd::string_range progname, bool err) {
|
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(
|
s.writeln(
|
||||||
"Usage: ", progname, " [options] [file]\n"
|
"Usage: ", progname, " [options] [file]\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
|
@ -194,7 +194,7 @@ static bool do_call(cs_state &cs, ostd::string_range line, bool file = false) {
|
||||||
try {
|
try {
|
||||||
if (file) {
|
if (file) {
|
||||||
if (!cs.run_file(line, ret)) {
|
if (!cs.run_file(line, ret)) {
|
||||||
ostd::err.writeln("cannot read file: ", line);
|
ostd::cerr.writeln("cannot read file: ", line);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cs.run(line, ret);
|
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());
|
ostd::writeln(!is_lnum ? "stdin: " : "stdin:", e.what());
|
||||||
if (e.get_stack().get()) {
|
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');
|
ostd::write('\n');
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -370,7 +370,7 @@ endargs:
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
std::string str;
|
std::string str;
|
||||||
for (char c = '\0'; (c = ostd::in.getchar()) != EOF;) {
|
for (char c = '\0'; (c = ostd::cin.get_char()) != EOF;) {
|
||||||
str += c;
|
str += c;
|
||||||
}
|
}
|
||||||
do_call(gcs, str);
|
do_call(gcs, str);
|
||||||
|
|
Loading…
Reference in New Issue