mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-07-10 14:57:25 +00:00
machine: DEFINE_MACHINE() macro
The macro will allow easy registration of a TYPE_MACHINE subclass, using only the machine name and a MachineClass initialization function as parameter. Backports commit ed0b6de343448d1014b53bcf541041373322fa1c from qemu
This commit is contained in:
parent
46e1c5482b
commit
426b961644
|
@ -129,6 +129,29 @@ struct MachineState {
|
||||||
AccelState *accelerator;
|
AccelState *accelerator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define DEFINE_MACHINE(namestr, machine_initfn) \
|
||||||
|
static void machine_initfn##_class_init(struct uc_struct *uc, ObjectClass *oc, void *data) \
|
||||||
|
{ \
|
||||||
|
MachineClass *mc = MACHINE_CLASS(uc, oc); \
|
||||||
|
machine_initfn(mc); \
|
||||||
|
} \
|
||||||
|
static const TypeInfo machine_initfn##_typeinfo = { \
|
||||||
|
MACHINE_TYPE_NAME(namestr), \
|
||||||
|
TYPE_MACHINE, \
|
||||||
|
0, \
|
||||||
|
0, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
machine_initfn##_class_init, \
|
||||||
|
}; \
|
||||||
|
void machine_initfn##_register_types(struct uc_struct *uc) \
|
||||||
|
{ \
|
||||||
|
type_register_static(uc, &machine_initfn##_typeinfo); \
|
||||||
|
}
|
||||||
|
|
||||||
void machine_register_types(struct uc_struct *uc);
|
void machine_register_types(struct uc_struct *uc);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue