]> git.saurik.com Git - cycript.git/commitdiff
Clean up dependencies now that they are tracked.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 10 Sep 2013 06:58:34 +0000 (23:58 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 10 Sep 2013 06:58:34 +0000 (23:58 -0700)
12 files changed:
Console.cpp
Cycript.yy.in
Driver.cpp [new file with mode: 0644]
Driver.hpp [new file with mode: 0644]
Execute.cpp
Handler.mm
Highlight.cpp
Library.cpp
Makefile.am
Makefile.in
Parser.cpp
Parser.hpp

index e955311e9ed622059e29e4ca6e52b770e2d9ed49..3dede2fb1702a7640f98b1e8b097f202a5f6dde2 100644 (file)
@@ -51,8 +51,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "Cycript.tab.hh"
-
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
 #include <dlfcn.h>
 
-#include "Replace.hpp"
 #include "Display.hpp"
+#include "Replace.hpp"
+
+#include "Cycript.tab.hh"
+#include "Driver.hpp"
 
 static volatile enum {
     Working,
index 047983b940fffb71335c46bfa8a1e9f252d0d5a3..14f6aadcc5e61c1a3399077c533c2821cf8e57b3 100644 (file)
@@ -28,6 +28,7 @@
 @if Bison24 }
 
 @if Bison24 %code requires {
+#include "Driver.hpp"
 #include "Parser.hpp"
 #define CYNew new($pool)
 
diff --git a/Driver.cpp b/Driver.cpp
new file mode 100644 (file)
index 0000000..4b1286c
--- /dev/null
@@ -0,0 +1,62 @@
+/* Cycript - Optimizing JavaScript Compiler/Runtime
+ * Copyright (C) 2009-2013  Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cycript is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cycript is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cycript.  If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#include "Cycript.tab.hh"
+#include "Driver.hpp"
+
+CYDriver::CYDriver(std::istream &data, const std::string &filename) :
+    state_(CYClear),
+    data_(data),
+    strict_(false),
+    commented_(false),
+    filename_(filename),
+    program_(NULL),
+    auto_(false),
+    context_(NULL),
+    mode_(AutoNone)
+{
+    memset(&no_, 0, sizeof(no_));
+    in_.push(false);
+    ScannerInit();
+}
+
+CYDriver::~CYDriver() {
+    ScannerDestroy();
+}
+
+void CYDriver::Warning(const cy::location &location, const char *message) {
+    if (!strict_)
+        return;
+
+    CYDriver::Error error;
+    error.warning_ = true;
+    error.location_ = location;
+    error.message_ = message;
+    errors_.push_back(error);
+}
+
+void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
+    CYDriver::Error error;
+    error.warning_ = false;
+    error.location_ = location;
+    error.message_ = message;
+    driver.errors_.push_back(error);
+}
diff --git a/Driver.hpp b/Driver.hpp
new file mode 100644 (file)
index 0000000..3948274
--- /dev/null
@@ -0,0 +1,122 @@
+/* Cycript - Optimizing JavaScript Compiler/Runtime
+ * Copyright (C) 2009-2013  Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cycript is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cycript is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cycript.  If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#ifndef CYCRIPT_DRIVER_HPP
+#define CYCRIPT_DRIVER_HPP
+
+#include <iostream>
+
+#include <stack>
+#include <string>
+#include <vector>
+
+#include "location.hh"
+
+#include "Parser.hpp"
+
+enum CYState {
+    CYClear,
+    CYRestricted,
+    CYNewLine
+};
+
+class CYDriver {
+  public:
+    void *scanner_;
+
+    CYState state_;
+    std::stack<bool> in_;
+
+    struct {
+        bool AtImplementation;
+        bool Function;
+        bool OpenBrace;
+    } no_;
+
+    std::istream &data_;
+
+    bool strict_;
+    bool commented_;
+
+    enum Condition {
+        RegExpCondition,
+        XMLContentCondition,
+        XMLTagCondition,
+    };
+
+    std::string filename_;
+
+    struct Error {
+        bool warning_;
+        cy::location location_;
+        std::string message_;
+    };
+
+    typedef std::vector<Error> Errors;
+
+    CYProgram *program_;
+    Errors errors_;
+
+    bool auto_;
+
+    struct Context {
+        CYExpression *context_;
+
+        Context(CYExpression *context) :
+            context_(context)
+        {
+        }
+
+        typedef std::vector<CYWord *> Words;
+        Words words_;
+    };
+
+    typedef std::vector<Context> Contexts;
+    Contexts contexts_;
+
+    CYExpression *context_;
+
+    enum Mode {
+        AutoNone,
+        AutoPrimary,
+        AutoDirect,
+        AutoIndirect,
+        AutoMessage
+    } mode_;
+
+  private:
+    void ScannerInit();
+    void ScannerDestroy();
+
+  public:
+    CYDriver(std::istream &data, const std::string &filename = "");
+    ~CYDriver();
+
+    Condition GetCondition();
+    void SetCondition(Condition condition);
+
+    void PushCondition(Condition condition);
+    void PopCondition();
+
+    void Warning(const cy::location &location, const char *message);
+};
+
+#endif/*CYCRIPT_DRIVER_HPP*/
index 51e76ab360dc2db95119293f974464cf431cd5ab..4c9e19891feef5db21d2de887626613d776338dc 100644 (file)
@@ -41,7 +41,6 @@
 #include <cmath>
 
 #include "Parser.hpp"
-#include "Cycript.tab.hh"
 
 #include "Error.hpp"
 #include "JavaScript.hpp"
index 39624e3a08204609003955916cfe93c3db45375d..d49274a23b74364192f56fd567bcc422829766f0 100644 (file)
 **/
 /* }}} */
 
-#include "cycript.hpp"
-#include "JavaScript.hpp"
-
-#include "Pooling.hpp"
-#include "Parser.hpp"
-
-#include "Cycript.tab.hh"
-
 #include <Foundation/Foundation.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <netinet/in.h>
 #include <sys/un.h>
 
+#include "cycript.hpp"
+
+#include "JavaScript.hpp"
+#include "Parser.hpp"
+#include "Pooling.hpp"
+
+#include "Cycript.tab.hh"
+#include "Driver.hpp"
+
 struct CYExecute_ {
     CYPool &pool_;
     const char * volatile data_;
index e5a476d2e31b27a89784fa395f6bd4bb294549a7..4b7d669393d64d49edd44ea4369a9eb77117e128 100644 (file)
 /* }}} */
 
 #include "Highlight.hpp"
+#include "Parser.hpp"
 
 #include "Cycript.tab.hh"
-#include "Parser.hpp"
+#include "Driver.hpp"
 
 static void Skip(const char *data, size_t size, std::ostream &output, size_t &offset, cy::position &current, cy::position target) {
     while (current.line != target.line || current.column != target.column) {
index 30f611735a0495d074b355efdb7af4f175d60876..1f61c0ebe538491a78abe048406c12c1982463ea 100644 (file)
 #include <sstream>
 #include <cmath>
 
-#include "Parser.hpp"
-#include "Cycript.tab.hh"
-
 #include "Error.hpp"
-#include "String.hpp"
 #include "Execute.hpp"
 #include "JavaScript.hpp"
+#include "Parser.hpp"
+#include "String.hpp"
+
+#include "Cycript.tab.hh"
+#include "Driver.hpp"
 
 #include "ConvertUTF.h"
 
index 40f1d4a3463996fadf1d598552fd6a3508ef7b4a..137cc44b6b32aa81a2cef6209ff47b3fe3912504 100644 (file)
@@ -43,7 +43,7 @@ lib_LTLIBRARIES += libcycript.la
 libcycript_la_LDFLAGS = $(CY_LDFLAGS)
 libcycript_la_LIBADD = $(LTLIBFFI) -ldl
 
-libcycript_la_SOURCES = ConvertUTF.c Highlight.cpp Network.cpp Output.cpp Parser.cpp Replace.cpp
+libcycript_la_SOURCES = ConvertUTF.c Driver.cpp Highlight.cpp Network.cpp Output.cpp Parser.cpp Replace.cpp
 libcycript_la_SOURCES += Cycript.tab.cc lex.cy.cpp
 
 filters = $(CY_FILTERS)
@@ -119,7 +119,7 @@ CLEANFILES += lex.cy.cpp
 lex.cy.cpp: Cycript.l
        $(FLEX) -t $< | $(SED) -e 's/int yyl;/yy_size_t yyl;/;s/int yyleng_r;/yy_size_t yyleng_r;/' >$@
 
-Console.$(OBJEXT) Execute.lo Handler.lo Highlight.lo Library.lo Output.lo Parser.lo lex.cy.lo: Cycript.tab.hh
+Console.$(OBJEXT) Cycript.tab.lo Driver.lo Handler.lo Highlight.lo Library.lo lex.cy.lo: Cycript.tab.hh
 
 CLEANFILES += Cycript.tab.cc Cycript.tab.hh location.hh position.hh stack.hh Cycript.output
 Cycript.tab.cc Cycript.tab.hh location.hh position.hh stack.hh Cycript.output: Cycript.yy
index 2ffd5d5b150e1a0ccf1ddbc51fdf8314bf7b2d33..af9bfd6717e20d5d3917fbcb80221c4a88506348 100644 (file)
@@ -183,7 +183,7 @@ am__DEPENDENCIES_1 =
 @CY_OBJECTIVEC_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
 libcycript_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3)
-am__libcycript_la_SOURCES_DIST = ConvertUTF.c Highlight.cpp \
+am__libcycript_la_SOURCES_DIST = ConvertUTF.c Driver.cpp Highlight.cpp \
        Network.cpp Output.cpp Parser.cpp Replace.cpp Cycript.tab.cc \
        lex.cy.cpp sig/ffi_type.cpp sig/parse.cpp sig/copy.cpp \
        Bridge.cpp Execute.cpp JavaScriptCore.cpp Library.cpp \
@@ -197,9 +197,9 @@ am__dirstamp = $(am__leading_dot)dirstamp
 @CY_OBJECTIVEC_TRUE@   ObjectiveC/Replace.lo \
 @CY_OBJECTIVEC_TRUE@   ObjectiveC/Library.lo
 @CY_MACH_TRUE@am__objects_3 = Handler.lo
-am_libcycript_la_OBJECTS = ConvertUTF.lo Highlight.lo Network.lo \
-       Output.lo Parser.lo Replace.lo Cycript.tab.lo lex.cy.lo \
-       $(am__objects_1) $(am__objects_2) $(am__objects_3)
+am_libcycript_la_OBJECTS = ConvertUTF.lo Driver.lo Highlight.lo \
+       Network.lo Output.lo Parser.lo Replace.lo Cycript.tab.lo \
+       lex.cy.lo $(am__objects_1) $(am__objects_2) $(am__objects_3)
 libcycript_la_OBJECTS = $(am_libcycript_la_OBJECTS)
 libcycript_la_LINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(OBJCXXLD) $(AM_OBJCXXFLAGS) \
@@ -546,9 +546,9 @@ lib_LTLIBRARIES = $(am__append_1) libcycript.la
 libcycript_la_LDFLAGS = $(CY_LDFLAGS)
 libcycript_la_LIBADD = $(LTLIBFFI) -ldl $(am__append_3) \
        $(am__append_9)
-libcycript_la_SOURCES = ConvertUTF.c Highlight.cpp Network.cpp \
-       Output.cpp Parser.cpp Replace.cpp Cycript.tab.cc lex.cy.cpp \
-       $(am__append_2) $(am__append_8) $(am__append_10)
+libcycript_la_SOURCES = ConvertUTF.c Driver.cpp Highlight.cpp \
+       Network.cpp Output.cpp Parser.cpp Replace.cpp Cycript.tab.cc \
+       lex.cy.cpp $(am__append_2) $(am__append_8) $(am__append_10)
 filters = $(CY_FILTERS) $(am__append_5) $(am__append_7)
 @CY_CONSOLE_TRUE@cycript_SOURCES = Console.cpp Display.cpp \
 @CY_CONSOLE_TRUE@      $(am__append_11)
@@ -749,6 +749,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConvertUTF.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cycript.tab.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Display.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Driver.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Execute.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Handler.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Highlight.Plo@am__quote@
@@ -1334,7 +1335,7 @@ Cycript.l: Cycript.l.in
 lex.cy.cpp: Cycript.l
        $(FLEX) -t $< | $(SED) -e 's/int yyl;/yy_size_t yyl;/;s/int yyleng_r;/yy_size_t yyleng_r;/' >$@
 
-Console.$(OBJEXT) Execute.lo Handler.lo Highlight.lo Library.lo Output.lo Parser.lo lex.cy.lo: Cycript.tab.hh
+Console.$(OBJEXT) Cycript.tab.lo Driver.lo Handler.lo Highlight.lo Library.lo lex.cy.lo: Cycript.tab.hh
 Cycript.tab.cc Cycript.tab.hh location.hh position.hh stack.hh Cycript.output: Cycript.yy
        $(BISON) -v --report=state $<
        ! grep -n '^ *$$default  reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Cycript.output -B 2 | grep 'shift, and go to state [0-9]*$$'
index 032997d98fce7862df6d3d8afa3a8d15de4b2f46..14e78b2b6ac2e26b017cb62d07812819148c27fc 100644 (file)
 **/
 /* }}} */
 
-#include "Cycript.tab.hh"
 #include "Parser.hpp"
 
 CYRange DigitRange_    (0x3ff000000000000LLU, 0x000000000000000LLU); // 0-9
 CYRange WordStartRange_(0x000001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$
 CYRange WordEndRange_  (0x3ff001000000000LLU, 0x7fffffe87fffffeLLU); // A-Za-z_$0-9
-
-CYDriver::CYDriver(std::istream &data, const std::string &filename) :
-    state_(CYClear),
-    data_(data),
-    strict_(false),
-    commented_(false),
-    filename_(filename),
-    program_(NULL),
-    auto_(false),
-    context_(NULL),
-    mode_(AutoNone)
-{
-    memset(&no_, 0, sizeof(no_));
-    in_.push(false);
-    ScannerInit();
-}
-
-CYDriver::~CYDriver() {
-    ScannerDestroy();
-}
-
-void CYDriver::Warning(const cy::location &location, const char *message) {
-    if (!strict_)
-        return;
-
-    CYDriver::Error error;
-    error.warning_ = true;
-    error.location_ = location;
-    error.message_ = message;
-    errors_.push_back(error);
-}
-
-void cy::parser::error(const cy::parser::location_type &location, const std::string &message) {
-    CYDriver::Error error;
-    error.warning_ = false;
-    error.location_ = location;
-    error.message_ = message;
-    driver.errors_.push_back(error);
-}
index 9dbb9b980e130b7c9fb52ddabdd6237852069d10..2102091d7c5db32afa42f85400e66f245ec6e3dd 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <iostream>
 
-#include <stack>
 #include <string>
 #include <vector>
 #include <map>
@@ -33,8 +32,6 @@
 #include <cstdio>
 #include <cstdlib>
 
-#include "location.hh"
-
 #include "List.hpp"
 #include "Pooling.hpp"
 #include "Options.hpp"
@@ -463,12 +460,6 @@ struct CYBlock :
     virtual void Output(CYOutput &out, CYFlags flags) const;
 };
 
-enum CYState {
-    CYClear,
-    CYRestricted,
-    CYNewLine
-};
-
 class CYStream :
     public std::istream
 {
@@ -490,87 +481,6 @@ class CYStream :
     }
 };
 
-class CYDriver {
-  public:
-    void *scanner_;
-
-    CYState state_;
-    std::stack<bool> in_;
-
-    struct {
-        bool AtImplementation;
-        bool Function;
-        bool OpenBrace;
-    } no_;
-
-    std::istream &data_;
-
-    bool strict_;
-    bool commented_;
-
-    enum Condition {
-        RegExpCondition,
-        XMLContentCondition,
-        XMLTagCondition,
-    };
-
-    std::string filename_;
-
-    struct Error {
-        bool warning_;
-        cy::location location_;
-        std::string message_;
-    };
-
-    typedef std::vector<Error> Errors;
-
-    CYProgram *program_;
-    Errors errors_;
-
-    bool auto_;
-
-    struct Context {
-        CYExpression *context_;
-
-        Context(CYExpression *context) :
-            context_(context)
-        {
-        }
-
-        typedef std::vector<CYWord *> Words;
-        Words words_;
-    };
-
-    typedef std::vector<Context> Contexts;
-    Contexts contexts_;
-
-    CYExpression *context_;
-
-    enum Mode {
-        AutoNone,
-        AutoPrimary,
-        AutoDirect,
-        AutoIndirect,
-        AutoMessage
-    } mode_;
-
-  private:
-    void ScannerInit();
-    void ScannerDestroy();
-
-  public:
-    CYDriver(std::istream &data, const std::string &filename = "");
-    ~CYDriver();
-
-    Condition GetCondition();
-    void SetCondition(Condition condition);
-
-    void PushCondition(Condition condition);
-    void PopCondition();
-
-    void Warning(const cy::location &location, const char *message);
-};
-
 struct CYForInitialiser {
     virtual ~CYForInitialiser() {
     }