]> git.saurik.com Git - cycript.git/blobdiff - Console.cpp
Optimized the variable renamer to rename more variables to 'a'.
[cycript.git] / Console.cpp
index 719e6f0fb24c8bc01ebeddec85cde0c848bdaf4c..65eeb4f08a472db52db8c1d62601b2dcc35c2957 100644 (file)
 
 #include "cycript.hpp"
 
+#ifdef CY_EXECUTE
+#include "JavaScript.hpp"
+#endif
+
 #include <cstdio>
 #include <sstream>
 
@@ -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);
     }
@@ -598,11 +603,13 @@ int Main(int argc, char const * const argv[], char const * const envp[]) {
             for (CYDriver::Errors::const_iterator i(driver.errors_.begin()); i != driver.errors_.end(); ++i)
                 std::cerr << i->location_.begin << ": " << i->message_ << std::endl;
         } else if (driver.program_ != NULL)
-            if (client != -1)
-                Run(client, start, end - start, stdout);
-            else {
+            if (client != -1) {
+                std::string code(start, end-start);
+                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());