From 9814ec39ae60db89cf3f65487e71a48c55bbfa3c Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 1 Nov 2009 06:09:27 +0000 Subject: [PATCH] Desktop Mac seems to use ^{_objc_class=...} instead of #. --- Internal.hpp | 2 +- Library.cpp | 17 ++++++++++++++--- sig/parse.cpp | 14 ++++---------- sig/parse.hpp | 2 +- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Internal.hpp b/Internal.hpp index 0aaa384..fff510b 100644 --- a/Internal.hpp +++ b/Internal.hpp @@ -49,7 +49,7 @@ #include #include -void Structor_(apr_pool_t *pool, const char *name, const char *types, sig::Type *&type); +void Structor_(apr_pool_t *pool, sig::Type *&type); struct Type_privateData : CYData diff --git a/Library.cpp b/Library.cpp index 7bc867b..0f91128 100644 --- a/Library.cpp +++ b/Library.cpp @@ -340,8 +340,19 @@ struct CStringMapLess : } }; -void Structor_(apr_pool_t *pool, const char *name, const char *types, sig::Type *&type) { - if (name == NULL) +void Structor_(apr_pool_t *pool, sig::Type *&type) { + if ( + type->primitive == sig::pointer_P && + type->data.data.type != NULL && + type->data.data.type->primitive == sig::struct_P && + strcmp(type->data.data.type->name, "_objc_class") == 0 + ) { + type->primitive = sig::typename_P; + type->data.data.type = NULL; + return; + } + + if (type->primitive != sig::struct_P || type->name == NULL) return; sqlite3_stmt *statement; @@ -357,7 +368,7 @@ void Structor_(apr_pool_t *pool, const char *name, const char *types, sig::Type " limit 1" , -1, &statement, NULL)); - _sqlcall(sqlite3_bind_text(statement, 1, name, -1, SQLITE_STATIC)); + _sqlcall(sqlite3_bind_text(statement, 1, type->name, -1, SQLITE_STATIC)); int mode; const char *value; diff --git a/sig/parse.cpp b/sig/parse.cpp index 0a1d26f..9eac602 100644 --- a/sig/parse.cpp +++ b/sig/parse.cpp @@ -201,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; @@ -232,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; } diff --git a/sig/parse.hpp b/sig/parse.hpp index dccbefc..d3493e6 100644 --- a/sig/parse.hpp +++ b/sig/parse.hpp @@ -46,7 +46,7 @@ namespace sig { -typedef void (*Callback)(apr_pool_t *pool, const char *name, const char *types, Type *&type); +typedef void (*Callback)(apr_pool_t *pool, Type *&type); void Parse(apr_pool_t *pool, struct Signature *signature, const char *name, Callback callback); const char *Unparse(apr_pool_t *pool, struct Signature *signature); -- 2.49.0