-/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2015 Jay Freeman (saurik)
+/* Cycript - The Truly Universal Scripting Language
+ * Copyright (C) 2009-2016 Jay Freeman (saurik)
*/
/* GNU Affero General Public License, Version 3 {{{ */
parse:
switch (next) {
case '?': type = new(pool) Unknown(); break;
+
+#ifdef CY_OBJECTIVEC
case '#': type = new(pool) Meta(); break;
+#endif
case '(':
type = new(pool) Aggregate(true);
goto aggregate;
case '*': type = new(pool) String(); break;
+
+#ifdef CY_OBJECTIVEC
case ':': type = new(pool) Selector(); break;
case '@': {
}
} break;
+#endif
case 'B': type = new(pool) Primitive<bool>(); break;
case 'C': type = new(pool) Primitive<unsigned char>(); break;
_assert(false); // XXX: why is this here?!?
else {
type = Parse_(pool, encoding, eos, named, callback);
+#ifdef CY_OBJECTIVEC
Aggregate *aggregate(dynamic_cast<Aggregate *>(type));
if (aggregate != NULL && strcmp(aggregate->name, "_objc_class") == 0)
type = new(pool) Meta();
else
+#endif
type = new(pool) Pointer(*type);
}
break;
case 's': type = new(pool) Primitive<short>(); break;
case 'v': type = new(pool) Void(); break;
+#ifdef __SIZEOF_INT128__
+ case 't': type = new(pool) Primitive<signed __int128>(); break;
+ case 'T': type = new(pool) Primitive<unsigned __int128>(); break;
+#endif
+
case '{':
type = new(pool) Aggregate(false);
next = '}';
type = (*callback)(pool, aggregate);
} break;
- case 'N': flags |= JOC_TYPE_INOUT; goto next;
+ case 'r': flags |= JOC_TYPE_CONST; goto next;
+
case 'n': flags |= JOC_TYPE_IN; goto next;
- case 'O': flags |= JOC_TYPE_BYCOPY; goto next;
+ case 'N': flags |= JOC_TYPE_INOUT; goto next;
case 'o': flags |= JOC_TYPE_OUT; goto next;
+ case 'O': flags |= JOC_TYPE_BYCOPY; goto next;
case 'R': flags |= JOC_TYPE_BYREF; goto next;
- case 'r': flags |= JOC_TYPE_CONST; goto next;
case 'V': flags |= JOC_TYPE_ONEWAY; goto next;
next:
return "i";
}
+#ifdef __SIZEOF_INT128__
+template <>
+const char *Primitive<signed __int128>::Encode(CYPool &pool) const {
+ return "t";
+}
+#endif
+
template <>
const char *Primitive<signed long int>::Encode(CYPool &pool) const {
return "l";
return "I";
}
+#ifdef __SIZEOF_INT128__
+template <>
+const char *Primitive<unsigned __int128>::Encode(CYPool &pool) const {
+ return "T";
+}
+#endif
+
template <>
const char *Primitive<unsigned long int>::Encode(CYPool &pool) const {
return "L";
return "*";
}
+#ifdef CY_OBJECTIVEC
const char *Meta::Encode(CYPool &pool) const {
return "#";
}
const char *Selector::Encode(CYPool &pool) const {
return ":";
}
+#endif
const char *Bits::Encode(CYPool &pool) const {
return pool.strcat("b", pool.itoa(size), NULL);
return pool.strcat("[", pool.itoa(size), type.Encode(pool), "]", NULL);
}
+#ifdef CY_OBJECTIVEC
const char *Object::Encode(CYPool &pool) const {
return name == NULL ? "@" : pool.strcat("@\"", name, "\"", NULL);
}
+#endif
const char *Aggregate::Encode(CYPool &pool) const {
return pool.strcat(overlap ? "(" : "{", name == NULL ? "?" : name, "=", Unparse(pool, &signature), overlap ? ")" : "}", NULL);
return "?";
}
+#ifdef CY_OBJECTIVEC
const char *Block::Encode(CYPool &pool) const {
return "@?";
}
+#endif
const char *Unparse(CYPool &pool, const struct Type *type) {
const char *base(type->Encode(pool));