X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/e934f8279564261e234d56b3bf5f0396d5fef447..6a9812501258df26b7c487e50744b91abe8ebe39:/Console.cpp diff --git a/Console.cpp b/Console.cpp index 1ba72ea..65eeb4f 100644 --- a/Console.cpp +++ b/Console.cpp @@ -39,6 +39,10 @@ #include "cycript.hpp" +#ifdef CY_EXECUTE +#include "JavaScript.hpp" +#endif + #include #include @@ -111,7 +115,8 @@ void Setup(CYDriver &driver, cy::parser &parser) { void Setup(CYOutput &out, CYDriver &driver) { out.pretty_ = pretty_; - CYContext context(driver.pool_); + CYOptions options; + CYContext context(driver.pool_, options); driver.program_->Replace(context); } @@ -320,7 +325,8 @@ static void Console(apr_pool_t *pool, int client) { code = command; else { std::ostringstream str; - CYOutput out(str); + CYOptions options; + CYOutput out(str, options); Setup(out, driver); out << *driver.program_; code = str.str(); @@ -332,7 +338,6 @@ static void Console(apr_pool_t *pool, int client) { if (debug) std::cout << code << std::endl; - code = "with(Cycript.all){" + code + "}"; Run(client, code, fout, expand); } @@ -600,20 +605,18 @@ int Main(int argc, char const * const argv[], char const * const envp[]) { } else if (driver.program_ != NULL) if (client != -1) { std::string code(start, end-start); - code = "with(Cycript.all){" + code + "}"; - Run(client, start, end - start, stdout); + Run(client, code, stdout); } else { std::ostringstream str; - CYOutput out(str); + CYOptions options; + CYOutput out(str, options); Setup(out, driver); out << *driver.program_; std::string code(str.str()); if (compile) std::cout << code; - else { - code = "with(Cycript.all){" + code + "}"; + else Run(client, code, stdout); - } } }