]> git.saurik.com Git - cycript.git/blobdiff - Output.cpp
Allow extern "C" {} and limit semicolon insertion.
[cycript.git] / Output.cpp
index cbd853f836f00b6a1521c638010c3c0310e65242..d3da0e46fa0564f386acbd333b64451f23bd76ba 100644 (file)
@@ -364,7 +364,8 @@ void CYExpression::Output(CYOutput &out, int precedence, CYFlags flags) const {
 }
 
 void CYExternal::Output(CYOutput &out, CYFlags flags) const {
-    out << "extern" << abi_ << typed_ << ';';
+    out << "extern" << abi_ << typed_;
+    out.Terminate();
 }
 
 void CYFatArrow::Output(CYOutput &out, CYFlags flags) const {
@@ -638,6 +639,7 @@ void CYLambda::Output(CYOutput &out, CYFlags flags) const {
 
 void CYTypeDefinition::Output(CYOutput &out, CYFlags flags) const {
     out << "typedef" << ' ' << *typed_;
+    out.Terminate();
 }
 
 void CYTypeExpression::Output(CYOutput &out, CYFlags flags) const {
@@ -920,6 +922,21 @@ void CYTypeSigned::Output(CYOutput &out) const {
     out << "signed" << specifier_;
 }
 
+void CYTypeStruct::Output(CYOutput &out) const {
+    out << "struct" << ' ';
+    if (name_ != NULL)
+        out << *name_ << ' ';
+    out << '{' << '\n';
+    ++out.indent_;
+    CYForEach (field, fields_) {
+        out << '\t' << *field->typed_;
+        out.Terminate();
+        out << '\n';
+    }
+    --out.indent_;
+    out << '}';
+}
+
 void CYTypeUnsigned::Output(CYOutput &out) const {
     out << "unsigned" << specifier_;
 }