mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-01 23:11:02 +00:00
qlit: add qobject_from_qlit()
Instantiate a QObject* from a literal QLitObject. LitObject only supports int64_t for now. uint64_t and double aren't implemented. Backports commit 3cf42b8b3af1bd61e736a9ca0f94806c7931ae56 from qemu
This commit is contained in:
parent
6b2143ad64
commit
910d50be6b
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_aarch64
|
||||
#define qlist_type qlist_type_aarch64
|
||||
#define qlit_equal_qobject qlit_equal_qobject_aarch64
|
||||
#define qobject_from_qlit qobject_from_qlit_aarch64
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_aarch64
|
||||
#define qobject_input_end_list qobject_input_end_list_aarch64
|
||||
#define qobject_input_end_struct qobject_input_end_struct_aarch64
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_aarch64eb
|
||||
#define qlist_type qlist_type_aarch64eb
|
||||
#define qlit_equal_qobject qlit_equal_qobject_aarch64eb
|
||||
#define qobject_from_qlit qobject_from_qlit_aarch64eb
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_aarch64eb
|
||||
#define qobject_input_end_list qobject_input_end_list_aarch64eb
|
||||
#define qobject_input_end_struct qobject_input_end_struct_aarch64eb
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_arm
|
||||
#define qlist_type qlist_type_arm
|
||||
#define qlit_equal_qobject qlit_equal_qobject_arm
|
||||
#define qobject_from_qlit qobject_from_qlit_arm
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_arm
|
||||
#define qobject_input_end_list qobject_input_end_list_arm
|
||||
#define qobject_input_end_struct qobject_input_end_struct_arm
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_armeb
|
||||
#define qlist_type qlist_type_armeb
|
||||
#define qlit_equal_qobject qlit_equal_qobject_armeb
|
||||
#define qobject_from_qlit qobject_from_qlit_armeb
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_armeb
|
||||
#define qobject_input_end_list qobject_input_end_list_armeb
|
||||
#define qobject_input_end_struct qobject_input_end_struct_armeb
|
||||
|
|
|
@ -2209,6 +2209,7 @@ symbols = (
|
|||
'qlist_size_iter',
|
||||
'qlist_type',
|
||||
'qlit_equal_qobject',
|
||||
'qobject_from_qlit',
|
||||
'qobject_input_end_implicit_struct',
|
||||
'qobject_input_end_list',
|
||||
'qobject_input_end_struct',
|
||||
|
|
|
@ -50,4 +50,6 @@ struct QLitDictEntry {
|
|||
|
||||
bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);
|
||||
|
||||
QObject *qobject_from_qlit(const QLitObject *qlit);
|
||||
|
||||
#endif /* QLIT_H */
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_m68k
|
||||
#define qlist_type qlist_type_m68k
|
||||
#define qlit_equal_qobject qlit_equal_qobject_m68k
|
||||
#define qobject_from_qlit qobject_from_qlit_m68k
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_m68k
|
||||
#define qobject_input_end_list qobject_input_end_list_m68k
|
||||
#define qobject_input_end_struct qobject_input_end_struct_m68k
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_mips
|
||||
#define qlist_type qlist_type_mips
|
||||
#define qlit_equal_qobject qlit_equal_qobject_mips
|
||||
#define qobject_from_qlit qobject_from_qlit_mips
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_mips
|
||||
#define qobject_input_end_list qobject_input_end_list_mips
|
||||
#define qobject_input_end_struct qobject_input_end_struct_mips
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_mips64
|
||||
#define qlist_type qlist_type_mips64
|
||||
#define qlit_equal_qobject qlit_equal_qobject_mips64
|
||||
#define qobject_from_qlit qobject_from_qlit_mips64
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_mips64
|
||||
#define qobject_input_end_list qobject_input_end_list_mips64
|
||||
#define qobject_input_end_struct qobject_input_end_struct_mips64
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_mips64el
|
||||
#define qlist_type qlist_type_mips64el
|
||||
#define qlit_equal_qobject qlit_equal_qobject_mips64el
|
||||
#define qobject_from_qlit qobject_from_qlit_mips64el
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_mips64el
|
||||
#define qobject_input_end_list qobject_input_end_list_mips64el
|
||||
#define qobject_input_end_struct qobject_input_end_struct_mips64el
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_mipsel
|
||||
#define qlist_type qlist_type_mipsel
|
||||
#define qlit_equal_qobject qlit_equal_qobject_mipsel
|
||||
#define qobject_from_qlit qobject_from_qlit_mipsel
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_mipsel
|
||||
#define qobject_input_end_list qobject_input_end_list_mipsel
|
||||
#define qobject_input_end_struct qobject_input_end_struct_mipsel
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_powerpc
|
||||
#define qlist_type qlist_type_powerpc
|
||||
#define qlit_equal_qobject qlit_equal_qobject_powerpc
|
||||
#define qobject_from_qlit qobject_from_qlit_powerpc
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_powerpc
|
||||
#define qobject_input_end_list qobject_input_end_list_powerpc
|
||||
#define qobject_input_end_struct qobject_input_end_struct_powerpc
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "qapi/qmp/qnum.h"
|
||||
#include "qapi/qmp/qobject.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qmp/qnull.h"
|
||||
|
||||
static bool qlit_equal_qdict(const QLitObject *lhs, const QDict *qdict)
|
||||
{
|
||||
|
@ -87,3 +88,39 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
QObject *qobject_from_qlit(const QLitObject *qlit)
|
||||
{
|
||||
switch (qlit->type) {
|
||||
case QTYPE_QNULL:
|
||||
return QOBJECT(qnull());
|
||||
case QTYPE_QNUM:
|
||||
return QOBJECT(qnum_from_int(qlit->value.qnum));
|
||||
case QTYPE_QSTRING:
|
||||
return QOBJECT(qstring_from_str(qlit->value.qstr));
|
||||
case QTYPE_QDICT: {
|
||||
QDict *qdict = qdict_new();
|
||||
QLitDictEntry *e;
|
||||
|
||||
for (e = qlit->value.qdict; e->key; e++) {
|
||||
qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));
|
||||
}
|
||||
return QOBJECT(qdict);
|
||||
}
|
||||
case QTYPE_QLIST: {
|
||||
QList *qlist = qlist_new();
|
||||
QLitObject *e;
|
||||
|
||||
for (e = qlit->value.qlist; e->type != QTYPE_NONE; e++) {
|
||||
qlist_append_obj(qlist, qobject_from_qlit(e));
|
||||
}
|
||||
return QOBJECT(qlist);
|
||||
}
|
||||
case QTYPE_QBOOL:
|
||||
return QOBJECT(qbool_from_bool(qlit->value.qbool));
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_sparc
|
||||
#define qlist_type qlist_type_sparc
|
||||
#define qlit_equal_qobject qlit_equal_qobject_sparc
|
||||
#define qobject_from_qlit qobject_from_qlit_sparc
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_sparc
|
||||
#define qobject_input_end_list qobject_input_end_list_sparc
|
||||
#define qobject_input_end_struct qobject_input_end_struct_sparc
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_sparc64
|
||||
#define qlist_type qlist_type_sparc64
|
||||
#define qlit_equal_qobject qlit_equal_qobject_sparc64
|
||||
#define qobject_from_qlit qobject_from_qlit_sparc64
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_sparc64
|
||||
#define qobject_input_end_list qobject_input_end_list_sparc64
|
||||
#define qobject_input_end_struct qobject_input_end_struct_sparc64
|
||||
|
|
|
@ -2203,6 +2203,7 @@
|
|||
#define qlist_size_iter qlist_size_iter_x86_64
|
||||
#define qlist_type qlist_type_x86_64
|
||||
#define qlit_equal_qobject qlit_equal_qobject_x86_64
|
||||
#define qobject_from_qlit qobject_from_qlit_x86_64
|
||||
#define qobject_input_end_implicit_struct qobject_input_end_implicit_struct_x86_64
|
||||
#define qobject_input_end_list qobject_input_end_list_x86_64
|
||||
#define qobject_input_end_struct qobject_input_end_struct_x86_64
|
||||
|
|
Loading…
Reference in a new issue