X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/f61f9da6a07a3d2ebdc5f46600856eca0fe83897..51b6165e0dd24e4d40ff80e504922f705ddd7b62:/sig/parse.cpp diff --git a/sig/parse.cpp b/sig/parse.cpp index 436e3cd..da590a8 100644 --- a/sig/parse.cpp +++ b/sig/parse.cpp @@ -25,6 +25,7 @@ #include #include #include +#include namespace sig { @@ -247,6 +248,19 @@ const char *Unparse(CYPool &pool, struct Signature *signature) { const char *Unparse_(CYPool &pool, struct Type *type) { switch (type->primitive) { + case function_P: { + if (type->data.signature.count == 0) + return "?"; + std::ostringstream out; + for (size_t i(0); i != type->data.signature.count; ++i) { + Element &element(type->data.signature.elements[i]); + out << Unparse(pool, element.type); + if (element.offset != _not(size_t)) + out << pool.itoa(element.offset); + } + return pool.strdup(out.str().c_str()); + } break; + case typename_P: return "#"; case union_P: return pool.strcat("(", Unparse(pool, &type->data.signature), ")", NULL); case string_P: return "*"; @@ -265,7 +279,15 @@ const char *Unparse_(CYPool &pool, struct Type *type) { return pool.strcat("[", pool.itoa(type->data.data.size), value, "]", NULL); } break; - case pointer_P: return pool.strcat("^", type->data.data.type == NULL ? "v" : Unparse(pool, type->data.data.type), NULL); + case pointer_P: { + if (type->data.data.type == NULL) + return "^v"; + else if (type->data.data.type->primitive == function_P) + return "^?"; + else + return pool.strcat("^", Unparse(pool, type->data.data.type), NULL); + } break; + case bit_P: return pool.strcat("b", pool.itoa(type->data.data.size), NULL); case char_P: return "c"; case double_P: return "d";