]> git.saurik.com Git - cycript.git/blobdiff - sig/parse.cpp
I forgot to setup $cym during @class categories.
[cycript.git] / sig / parse.cpp
index 57e5a10669b166aae90e027b51167c516a30b35a..24de0bc045a28af5971d7ce067b75db1892d3c4c 100644 (file)
@@ -1,4 +1,4 @@
-/* Cycript - Remove Execution Server and Disassembler
+/* Cycript - Inlining/Optimizing JavaScript Compiler
  * Copyright (C) 2009  Jay Freeman (saurik)
 */
 
 */
 /* }}} */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include "minimal/stdlib.h"
-
 #include <apr_strings.h>
-
-#include <string.h>
-
 #include "sig/parse.hpp"
+#include "Error.hpp"
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 namespace sig {
 
@@ -205,17 +201,8 @@ struct Type *Parse_(apr_pool_t *pool, const char **name, char eos, bool named, C
 
             // XXX: this types thing is a throwback to JocStrap
 
-            char *types;
-            if (next != '=') {
-                types = NULL;
-            } else {
-                const char *temp(*name);
+            if (next == '=')
                 Parse_(pool, &type->data.signature, name, end, callback);
-                types = (char *) apr_pstrmemdup(pool, temp, *name - temp - 1);
-            }
-
-            if (callback != NULL)
-                (*callback)(pool, type->name, types, type);
         } break;
 
         case 'N': type->flags |= JOC_TYPE_INOUT; goto next;
@@ -236,6 +223,9 @@ struct Type *Parse_(apr_pool_t *pool, const char **name, char eos, bool named, C
             _assert(false);
     }
 
+    if (callback != NULL)
+        (*callback)(pool, type);
+
     return type;
 }
 
@@ -275,11 +265,11 @@ const char *Unparse(apr_pool_t *pool, struct Type *type) {
 
         case array_P: {
             const char *value = Unparse(pool, type->data.data.type);
-            return apr_psprintf(pool, "[%lu%s]", type->data.data.size, value);
+            return apr_psprintf(pool, "[%"APR_SIZE_T_FMT"%s]", type->data.data.size, value);
         } break;
 
         case pointer_P: return apr_psprintf(pool, "^%s", type->data.data.type == NULL ? "v" : Unparse(pool, type->data.data.type));
-        case bit_P: return apr_psprintf(pool, "b%zu", type->data.data.size);
+        case bit_P: return apr_psprintf(pool, "b%"APR_SIZE_T_FMT"", type->data.data.size);
         case char_P: return "c";
         case double_P: return "d";
         case float_P: return "f";