]> git.saurik.com Git - cycript.git/blobdiff - sig/parse.cpp
Repair build when JavaScriptCore is not available.
[cycript.git] / sig / parse.cpp
index 7c7c9c9333b340dbbb9e05c90593857713e81730..7e025f8a1a3f363a0c98aa8c9bca52f641feb1ce 100644 (file)
@@ -118,10 +118,9 @@ Type *Parse_(CYPool &pool, const char **encoding, char eos, bool named, Callback
                     name = NULL;
                 else {
                     const char *quote = strchr(*encoding + 1, '"');
-                    if (quote == NULL) {
-                        printf("unterminated specific id type {%s}\n", *encoding - 10);
-                        _assert(false);
-                    } else if (!named || quote[1] == eos || quote[1] == '"') {
+                    if (quote == NULL)
+                        CYThrow("unterminated specific id type {%s}", *encoding - 10);
+                    else if (!named || quote[1] == eos || quote[1] == '"') {
                         name = pool.strmemdup(*encoding + 1, quote - *encoding - 1);
                         *encoding = quote + 1;
                     } else {
@@ -145,10 +144,8 @@ Type *Parse_(CYPool &pool, const char **encoding, char eos, bool named, Callback
         case '[': {
             size_t size(strtoul(*encoding, (char **) encoding, 10));
             type = new(pool) Array(*Parse_(pool, encoding, eos, false, callback), size);
-            if (**encoding != ']') {
-                printf("']' != \"%s\"\n", *encoding);
-                _assert(false);
-            }
+            if (**encoding != ']')
+                CYThrow("']' != \"%s\"", *encoding);
             ++*encoding;
         } break;
 
@@ -172,6 +169,7 @@ Type *Parse_(CYPool &pool, const char **encoding, char eos, bool named, Callback
         break;
 
         case 'c': type = new(pool) Primitive<signed char>(); break;
+        case 'D': type = new(pool) Primitive<long double>(); break;
         case 'd': type = new(pool) Primitive<double>(); break;
         case 'f': type = new(pool) Primitive<float>(); break;
         case 'i': type = new(pool) Primitive<signed int>(); break;
@@ -236,8 +234,7 @@ Type *Parse_(CYPool &pool, const char **encoding, char eos, bool named, Callback
         break;
 
         default:
-            printf("invalid type character: '%c' {%s}\n", next, *encoding - 10);
-            _assert(false);
+            CYThrow("invalid type character: '%c' {%s}", next, *encoding - 10);
     }
 
     type->flags = flags;
@@ -283,6 +280,11 @@ const char *Primitive<float>::Encode(CYPool &pool) const {
     return "f";
 }
 
+template <>
+const char *Primitive<long double>::Encode(CYPool &pool) const {
+    return "D";
+}
+
 template <>
 const char *Primitive<signed char>::Encode(CYPool &pool) const {
     return "c";