driver.strict_ = true;
}
-void Setup(CYOutput &out, CYDriver &driver, CYOptions &options) {
+void Setup(CYOutput &out, CYDriver &driver, CYOptions &options, bool lower) {
out.pretty_ = pretty_;
CYContext context(options);
- driver.program_->Replace(context);
+ if (lower)
+ driver.program_->Replace(context);
}
static CYUTF8String Run(CYPool &pool, int client, CYUTF8String code) {
bool bypass(false);
bool debug(false);
bool expand(false);
+ bool lower(true);
bool syntax(true);
out_ = &std::cout;
} else if (data == "debug") {
debug = !debug;
*out_ << "debug == " << (debug ? "true" : "false") << std::endl;
+ } else if (data == "destroy") {
+ CYDestroyContext();
+ } else if (data == "gc") {
+ CYGarbageCollect(CYGetJSContext());
} else if (data == "expand") {
expand = !expand;
*out_ << "expand == " << (expand ? "true" : "false") << std::endl;
+ } else if (data == "lower") {
+ lower = !lower;
+ *out_ << "lower == " << (lower ? "true" : "false") << std::endl;
} else if (data == "syntax") {
syntax = !syntax;
*out_ << "syntax == " << (syntax ? "true" : "false") << std::endl;
std::ostringstream str;
CYOutput out(str, options);
- Setup(out, driver, options);
+ Setup(out, driver, options, lower);
out << *driver.program_;
code = str.str();
}
history += command_;
if (debug) {
+ std::cout << "cy= ";
Write(syntax, code.c_str(), code.size(), std::cout);
std::cout << std::endl;
}
break;
else {
size += read;
- if (size == sizeof(value)) {
- pid = _not(pid_t);
+ if (size == sizeof(value))
goto fail;
- }
}
}
}
if (pid == _not(pid_t)) {
- fprintf(stderr, "invalid pid for -p\n");
+ fprintf(stderr, "unable to find process `%s' using ps\n", arg);
return 1;
}
}
} else if (driver.program_ != NULL) {
std::ostringstream str;
CYOutput out(str, options);
- Setup(out, driver, options);
+ Setup(out, driver, options, true);
out << *driver.program_;
std::string code(str.str());
if (compile)