]> git.saurik.com Git - cycript.git/commitdiff
Change ObjectiveC/Output.mm to straight-up C++.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 7 Sep 2013 07:01:29 +0000 (00:01 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sat, 7 Sep 2013 08:10:19 +0000 (01:10 -0700)
Makefile.am
Makefile.in
ObjectiveC/Output.cpp [new file with mode: 0644]
ObjectiveC/Output.mm [deleted file]

index 7fc7cb2d917c16383e3864e91a5c59b35110b4c2..20e06f6fc553f7d2bf5cecac2c33b41bb87ac5e3 100644 (file)
@@ -81,7 +81,7 @@ endif
 
 if CY_OBJECTIVEC
 filters += ObjectiveC
-libcycript_sys_la_SOURCES += ObjectiveC/Output.mm ObjectiveC/Replace.cpp ObjectiveC/Library.mm
+libcycript_sys_la_SOURCES += ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm
 libcycript_sys_la_LIBADD += $(LTOBJECTIVEC)
 endif
 
index 4fbd73c6ef7ce9c90be8114a3bfd27b0482377a3..22897003b5886870c76ebab385ba7abcd5d45a96 100644 (file)
@@ -79,7 +79,7 @@ bin_PROGRAMS = cycript$(EXEEXT)
 @CY_EXECUTE_TRUE@am__append_4 = C
 @CY_EXECUTE_TRUE@am__append_5 = Bridge.gperf Bridge.hpp
 @CY_OBJECTIVEC_TRUE@am__append_6 = ObjectiveC
-@CY_OBJECTIVEC_TRUE@am__append_7 = ObjectiveC/Output.mm ObjectiveC/Replace.cpp ObjectiveC/Library.mm
+@CY_OBJECTIVEC_TRUE@am__append_7 = ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm
 @CY_OBJECTIVEC_TRUE@am__append_8 = $(LTOBJECTIVEC)
 @CY_MACH_TRUE@am__append_9 = Handler.mm
 @CY_MACH_TRUE@am__append_10 = Mach/Inject.cpp
diff --git a/ObjectiveC/Output.cpp b/ObjectiveC/Output.cpp
new file mode 100644 (file)
index 0000000..658a8f5
--- /dev/null
@@ -0,0 +1,153 @@
+/* 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 "Replace.hpp"
+#include "ObjectiveC/Syntax.hpp"
+
+#include <sstream>
+
+void CYCategory::Output(CYOutput &out, CYFlags flags) const {
+    out << "(function($cys,$cyp,$cyc,$cyn,$cyt){";
+    out << "$cyp=object_getClass($cys);";
+    out << "$cyc=$cys;";
+    if (messages_ != NULL)
+        messages_->Output(out, true);
+    out << "})(";
+    name_->ClassName(out, true);
+    out << ')';
+    out << ';';
+}
+
+void CYClass::Output(CYOutput &out, CYFlags flags) const {
+    // XXX: I don't necc. need the ()s
+    out << "(function($cys,$cyp,$cyc,$cyn,$cyt,$cym){";
+    out << "$cyp=object_getClass($cys);";
+    out << "$cyc=objc_allocateClassPair($cys,";
+    if (name_ != NULL)
+        name_->ClassName(out, false);
+    else
+        out << "$cyq(\"CY$\")";
+    out << ",0);";
+    out << "$cym=object_getClass($cyc);";
+    if (fields_ != NULL)
+        fields_->Output(out);
+    if (messages_ != NULL)
+        messages_->Output(out, false);
+    if (protocols_ != NULL) {
+        out << '<';
+        out << *protocols_;
+        out << '>';
+    }
+    out << "objc_registerClassPair($cyc);";
+    out << "return $cyc;";
+    out << "}(";
+    if (super_ != NULL)
+        super_->Output(out, CYAssign::Precedence_, CYNoFlags);
+    else
+        out << "null";
+    out << "))";
+}
+
+void CYClassExpression::Output(CYOutput &out, CYFlags flags) const {
+    CYClass::Output(out, flags);
+}
+
+void CYClassStatement::Output(CYOutput &out, CYFlags flags) const {
+    CYClass::Output(out, flags);
+}
+
+void CYEncodedType::Output(CYOutput &out, CYFlags flags) const {
+    out << "@encode(";
+    // XXX: this is seriously wrong
+    out << ")";
+}
+
+void CYField::Output(CYOutput &out) const {
+}
+
+void CYImport::Output(CYOutput &out, CYFlags flags) const {
+    out << "@import";
+}
+
+void CYMessage::Output(CYOutput &out, bool replace) const {
+    out << (instance_ ? '-' : '+');
+
+    CYForEach (parameter, parameters_)
+        if (parameter->tag_ != NULL) {
+            out << ' ' << *parameter->tag_;
+            if (parameter->name_ != NULL)
+                out << ':' << *parameter->name_;
+        }
+
+    out << code_;
+}
+
+void CYBox::Output(CYOutput &out, CYFlags flags) const {
+    out << '@';
+    value_->Output(out, Precedence(), CYRight(flags));
+}
+
+void CYObjCBlock::Output(CYOutput &out, CYFlags flags) const {
+    // XXX: this is seriously wrong
+    out << "^(";
+    out << ")";
+    out << "{";
+    out << "}";
+}
+
+void CYProtocol::Output(CYOutput &out) const {
+    name_->Output(out, CYAssign::Precedence_, CYNoFlags);
+    if (next_ != NULL)
+        out << ',' << ' ' << *next_;
+}
+
+void CYSelector::Output(CYOutput &out, CYFlags flags) const {
+    out << "@selector" << '(' << name_ << ')';
+}
+
+void CYSelectorPart::Output(CYOutput &out) const {
+    out << name_;
+    if (value_)
+        out << ':';
+    out << next_;
+}
+
+void CYSend::Output(CYOutput &out, CYFlags flags) const {
+    CYForEach (argument, arguments_)
+        if (argument->name_ != NULL) {
+            out << ' ' << *argument->name_;
+            if (argument->value_ != NULL)
+                out << ':' << *argument->value_;
+        }
+}
+
+void CYSendDirect::Output(CYOutput &out, CYFlags flags) const {
+    out << '[';
+    self_->Output(out, CYAssign::Precedence_, CYNoFlags);
+    CYSend::Output(out, flags);
+    out << ']';
+}
+
+void CYSendSuper::Output(CYOutput &out, CYFlags flags) const {
+    out << '[' << "super";
+    CYSend::Output(out, flags);
+    out << ']';
+}
diff --git a/ObjectiveC/Output.mm b/ObjectiveC/Output.mm
deleted file mode 100644 (file)
index 33f7ee7..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/* 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 "Replace.hpp"
-#include "ObjectiveC/Syntax.hpp"
-
-#include <Foundation/Foundation.h>
-#include <sstream>
-
-void CYCategory::Output(CYOutput &out, CYFlags flags) const {
-    out << "(function($cys,$cyp,$cyc,$cyn,$cyt){";
-    out << "$cyp=object_getClass($cys);";
-    out << "$cyc=$cys;";
-    if (messages_ != NULL)
-        messages_->Output(out, true);
-    out << "})(";
-    name_->ClassName(out, true);
-    out << ')';
-    out << ';';
-}
-
-void CYClass::Output(CYOutput &out, CYFlags flags) const {
-    // XXX: I don't necc. need the ()s
-    out << "(function($cys,$cyp,$cyc,$cyn,$cyt,$cym){";
-    out << "$cyp=object_getClass($cys);";
-    out << "$cyc=objc_allocateClassPair($cys,";
-    if (name_ != NULL)
-        name_->ClassName(out, false);
-    else
-        out << "$cyq(\"CY$\")";
-    out << ",0);";
-    out << "$cym=object_getClass($cyc);";
-    if (fields_ != NULL)
-        fields_->Output(out);
-    if (messages_ != NULL)
-        messages_->Output(out, false);
-    if (protocols_ != NULL) {
-        out << '<';
-        out << *protocols_;
-        out << '>';
-    }
-    out << "objc_registerClassPair($cyc);";
-    out << "return $cyc;";
-    out << "}(";
-    if (super_ != NULL)
-        super_->Output(out, CYAssign::Precedence_, CYNoFlags);
-    else
-        out << "null";
-    out << "))";
-}
-
-void CYClassExpression::Output(CYOutput &out, CYFlags flags) const {
-    CYClass::Output(out, flags);
-}
-
-void CYClassStatement::Output(CYOutput &out, CYFlags flags) const {
-    CYClass::Output(out, flags);
-}
-
-void CYEncodedType::Output(CYOutput &out, CYFlags flags) const {
-    out << "@encode(";
-    // XXX: this is seriously wrong
-    out << ")";
-}
-
-void CYField::Output(CYOutput &out) const {
-}
-
-void CYImport::Output(CYOutput &out, CYFlags flags) const {
-    out << "@import";
-}
-
-void CYMessage::Output(CYOutput &out, bool replace) const {
-    out << (instance_ ? '-' : '+');
-
-    CYForEach (parameter, parameters_)
-        if (parameter->tag_ != NULL) {
-            out << ' ' << *parameter->tag_;
-            if (parameter->name_ != NULL)
-                out << ':' << *parameter->name_;
-        }
-
-    out << code_;
-}
-
-void CYBox::Output(CYOutput &out, CYFlags flags) const {
-    out << '@';
-    value_->Output(out, Precedence(), CYRight(flags));
-}
-
-void CYObjCBlock::Output(CYOutput &out, CYFlags flags) const {
-    // XXX: this is seriously wrong
-    out << "^(";
-    out << ")";
-    out << "{";
-    out << "}";
-}
-
-void CYProtocol::Output(CYOutput &out) const {
-    name_->Output(out, CYAssign::Precedence_, CYNoFlags);
-    if (next_ != NULL)
-        out << ',' << ' ' << *next_;
-}
-
-void CYSelector::Output(CYOutput &out, CYFlags flags) const {
-    out << "@selector" << '(' << name_ << ')';
-}
-
-void CYSelectorPart::Output(CYOutput &out) const {
-    out << name_;
-    if (value_)
-        out << ':';
-    out << next_;
-}
-
-void CYSend::Output(CYOutput &out, CYFlags flags) const {
-    CYForEach (argument, arguments_)
-        if (argument->name_ != NULL) {
-            out << ' ' << *argument->name_;
-            if (argument->value_ != NULL)
-                out << ':' << *argument->value_;
-        }
-}
-
-void CYSendDirect::Output(CYOutput &out, CYFlags flags) const {
-    out << '[';
-    self_->Output(out, CYAssign::Precedence_, CYNoFlags);
-    CYSend::Output(out, flags);
-    out << ']';
-}
-
-void CYSendSuper::Output(CYOutput &out, CYFlags flags) const {
-    out << '[' << "super";
-    CYSend::Output(out, flags);
-    out << ']';
-}