mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-03 16:35:46 +00:00
qapi/types qapi/visit: Generate built-in stuff into separate files
Linking code from multiple separate QAPI schemata into the same program is possible, but involves some weirdness around built-in types: * We generate code for built-in types into .c only with option --builtins. The user is responsible for generating code for exactly one QAPI schema per program with --builtins. * We generate code for built-in types into .h regardless of --builtins, but guarded by #ifndef QAPI_VISIT_BUILTIN. Because all copies of this code are exactly the same, including any combination of these headers works. Replace this contraption by something more conventional: generate code for built-in types into their very own files: qapi-builtin-types.c, qapi-builtin-visit.c, qapi-builtin-types.h, qapi-builtin-visit.h, but only with --builtins. Obey --output-dir, but ignore --prefix for them. Make qapi-types.h include qapi-builtin-types.h. With multiple schemata you now have multiple qapi-types.[ch], but only one qapi-builtin-types.[ch]. Same for qapi-visit.[ch] and qapi-builtin-visit.[ch]. Bonus: if all you need is built-in stuff, you can include a much smaller header. To be exploited shortly. Backports commit cdb6610ae4283720037bae2af1f78bd40eb5fe71 from qemu
This commit is contained in:
parent
b882e705dc
commit
1fb1d31a1f
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -28,10 +28,10 @@ qemu/sparc-softmmu/
|
|||
qemu/i386-softmmu/
|
||||
qemu/x86_64-softmmu/
|
||||
|
||||
qemu/qapi-types.h
|
||||
qemu/qapi-visit.h
|
||||
qemu/qapi-types.c
|
||||
qemu/qapi-visit.c
|
||||
qemu/qapi-builtin-types.[ch]
|
||||
qemu/qapi-builtin-visit.[ch]
|
||||
qemu/qapi-types.[ch]
|
||||
qemu/qapi-visit.[ch]
|
||||
qemu/qapi-gen-timestamp
|
||||
tags
|
||||
qemu/config-host.ld
|
||||
|
|
222
msvc/unicorn/qapi-builtin-types.c
Normal file
222
msvc/unicorn/qapi-builtin-types.c
Normal file
|
@ -0,0 +1,222 @@
|
|||
/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
|
||||
|
||||
/*
|
||||
* Built-in QAPI types
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
* Copyright (c) 2013-2018 Red Hat Inc.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/dealloc-visitor.h"
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
|
||||
void qapi_free_strList(strList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_strList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_numberList(numberList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_numberList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_intList(intList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_intList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int8List(int8List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int8List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int16List(int16List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int16List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int32List(int32List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int32List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int64List(int64List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int64List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint8List(uint8List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint8List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint16List(uint16List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint16List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint32List(uint32List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint32List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint64List(uint64List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint64List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_sizeList(sizeList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_sizeList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_boolList(boolList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_boolList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_anyList(anyList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_anyList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_nullList(nullList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_nullList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
const char *const QType_lookup[] = {
|
||||
"none",
|
||||
"qnull",
|
||||
"qnum",
|
||||
"qstring",
|
||||
"qdict",
|
||||
"qlist",
|
||||
"qbool",
|
||||
NULL,
|
||||
};
|
166
msvc/unicorn/qapi-builtin-types.h
Normal file
166
msvc/unicorn/qapi-builtin-types.h
Normal file
|
@ -0,0 +1,166 @@
|
|||
/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
|
||||
|
||||
/*
|
||||
* Built-in QAPI types
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
* Copyright (c) 2013-2018 Red Hat Inc.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef QAPI_BUILTIN_TYPES_H
|
||||
#define QAPI_BUILTIN_TYPES_H
|
||||
|
||||
/* #include "qapi/util.h" */
|
||||
|
||||
typedef struct strList strList;
|
||||
|
||||
typedef struct numberList numberList;
|
||||
|
||||
typedef struct intList intList;
|
||||
|
||||
typedef struct int8List int8List;
|
||||
|
||||
typedef struct int16List int16List;
|
||||
|
||||
typedef struct int32List int32List;
|
||||
|
||||
typedef struct int64List int64List;
|
||||
|
||||
typedef struct uint8List uint8List;
|
||||
|
||||
typedef struct uint16List uint16List;
|
||||
|
||||
typedef struct uint32List uint32List;
|
||||
|
||||
typedef struct uint64List uint64List;
|
||||
|
||||
typedef struct sizeList sizeList;
|
||||
|
||||
typedef struct boolList boolList;
|
||||
|
||||
typedef struct anyList anyList;
|
||||
|
||||
typedef struct nullList nullList;
|
||||
|
||||
typedef enum QType {
|
||||
QTYPE_NONE = 0,
|
||||
QTYPE_QNULL = 1,
|
||||
QTYPE_QNUM = 2,
|
||||
QTYPE_QSTRING = 3,
|
||||
QTYPE_QDICT = 4,
|
||||
QTYPE_QLIST = 5,
|
||||
QTYPE_QBOOL = 6,
|
||||
QTYPE__MAX = 7,
|
||||
} QType;
|
||||
|
||||
extern const char *const QType_lookup[];
|
||||
|
||||
struct strList {
|
||||
strList *next;
|
||||
char *value;
|
||||
};
|
||||
|
||||
void qapi_free_strList(strList *obj);
|
||||
|
||||
struct numberList {
|
||||
numberList *next;
|
||||
double value;
|
||||
};
|
||||
|
||||
void qapi_free_numberList(numberList *obj);
|
||||
|
||||
struct intList {
|
||||
intList *next;
|
||||
int64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_intList(intList *obj);
|
||||
|
||||
struct int8List {
|
||||
int8List *next;
|
||||
int8_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int8List(int8List *obj);
|
||||
|
||||
struct int16List {
|
||||
int16List *next;
|
||||
int16_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int16List(int16List *obj);
|
||||
|
||||
struct int32List {
|
||||
int32List *next;
|
||||
int32_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int32List(int32List *obj);
|
||||
|
||||
struct int64List {
|
||||
int64List *next;
|
||||
int64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int64List(int64List *obj);
|
||||
|
||||
struct uint8List {
|
||||
uint8List *next;
|
||||
uint8_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint8List(uint8List *obj);
|
||||
|
||||
struct uint16List {
|
||||
uint16List *next;
|
||||
uint16_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint16List(uint16List *obj);
|
||||
|
||||
struct uint32List {
|
||||
uint32List *next;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint32List(uint32List *obj);
|
||||
|
||||
struct uint64List {
|
||||
uint64List *next;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint64List(uint64List *obj);
|
||||
|
||||
struct sizeList {
|
||||
sizeList *next;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_sizeList(sizeList *obj);
|
||||
|
||||
struct boolList {
|
||||
boolList *next;
|
||||
bool value;
|
||||
};
|
||||
|
||||
void qapi_free_boolList(boolList *obj);
|
||||
|
||||
struct anyList {
|
||||
anyList *next;
|
||||
QObject *value;
|
||||
};
|
||||
|
||||
void qapi_free_anyList(anyList *obj);
|
||||
|
||||
struct nullList {
|
||||
nullList *next;
|
||||
QNull *value;
|
||||
};
|
||||
|
||||
void qapi_free_nullList(nullList *obj);
|
||||
|
||||
#endif /* QAPI_BUILTIN_TYPES_H */
|
488
msvc/unicorn/qapi-builtin-visit.c
Normal file
488
msvc/unicorn/qapi-builtin-visit.c
Normal file
|
@ -0,0 +1,488 @@
|
|||
/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
|
||||
|
||||
/*
|
||||
* Built-in QAPI visitors
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
* Copyright (C) 2014-2018 Red Hat, Inc.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
|
||||
void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
strList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (strList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_str(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_strList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
numberList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (numberList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_number(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_numberList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
intList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (intList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_intList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int8List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int8List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int8(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int8List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int16List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int16List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int16(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int16List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int32List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int32List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int32(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int32List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int64List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int64List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int64(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int64List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint8List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint8List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint8(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint8List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint16List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint16List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint16(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint16List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint32List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint32List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint32(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint32List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint64List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint64List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint64(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint64List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
sizeList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (sizeList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_size(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_sizeList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
boolList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (boolList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_bool(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_boolList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
anyList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (anyList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_any(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_anyList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
nullList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (nullList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_null(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_nullList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, QType_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
36
msvc/unicorn/qapi-builtin-visit.h
Normal file
36
msvc/unicorn/qapi-builtin-visit.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
|
||||
|
||||
/*
|
||||
* Built-in QAPI visitors
|
||||
*
|
||||
* Copyright IBM, Corp. 2011
|
||||
* Copyright (C) 2014-2018 Red Hat, Inc.
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef QAPI_BUILTIN_VISIT_H
|
||||
#define QAPI_BUILTIN_VISIT_H
|
||||
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi-builtin-types.h"
|
||||
|
||||
void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp);
|
||||
void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp);
|
||||
void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp);
|
||||
void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp);
|
||||
void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp);
|
||||
void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp);
|
||||
void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp);
|
||||
void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp);
|
||||
void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp);
|
||||
void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp);
|
||||
void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp);
|
||||
void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp);
|
||||
void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp);
|
||||
void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp);
|
||||
void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp);
|
||||
void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp);
|
||||
|
||||
#endif /* QAPI_BUILTIN_VISIT_H */
|
|
@ -15,30 +15,6 @@
|
|||
#include "qapi-types.h"
|
||||
#include "qapi-visit.h"
|
||||
|
||||
void qapi_free_DummyForceArrays(DummyForceArrays *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_DummyForceArrays(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
const char *const QType_lookup[] = {
|
||||
"none",
|
||||
"qnull",
|
||||
"qnum",
|
||||
"qstring",
|
||||
"qdict",
|
||||
"qlist",
|
||||
"qbool",
|
||||
NULL,
|
||||
};
|
||||
|
||||
const char *const QapiErrorClass_lookup[] = {
|
||||
"GenericError",
|
||||
"CommandNotFound",
|
||||
|
@ -49,6 +25,18 @@ const char *const QapiErrorClass_lookup[] = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
const char *const X86CPURegister32_lookup[] = {
|
||||
"EAX",
|
||||
"EBX",
|
||||
"ECX",
|
||||
"EDX",
|
||||
"ESP",
|
||||
"EBP",
|
||||
"ESI",
|
||||
"EDI",
|
||||
NULL,
|
||||
};
|
||||
|
||||
void qapi_free_X86CPUFeatureWordInfo(X86CPUFeatureWordInfo *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
@ -75,19 +63,7 @@ void qapi_free_X86CPUFeatureWordInfoList(X86CPUFeatureWordInfoList *obj)
|
|||
visit_free(v);
|
||||
}
|
||||
|
||||
const char *const X86CPURegister32_lookup[] = {
|
||||
"EAX",
|
||||
"EBX",
|
||||
"ECX",
|
||||
"EDX",
|
||||
"ESP",
|
||||
"EBP",
|
||||
"ESI",
|
||||
"EDI",
|
||||
NULL,
|
||||
};
|
||||
|
||||
void qapi_free_anyList(anyList *obj)
|
||||
void qapi_free_DummyForceArrays(DummyForceArrays *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
|
@ -96,188 +72,6 @@ void qapi_free_anyList(anyList *obj)
|
|||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_anyList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_boolList(boolList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_boolList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int16List(int16List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int16List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int32List(int32List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int32List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int64List(int64List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int64List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_int8List(int8List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_int8List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_intList(intList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_intList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_nullList(nullList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_nullList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_numberList(numberList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_numberList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_sizeList(sizeList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_sizeList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_strList(strList *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_strList(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint16List(uint16List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint16List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint32List(uint32List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint32List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint64List(uint64List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint64List(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
void qapi_free_uint8List(uint8List *obj)
|
||||
{
|
||||
Visitor *v;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
|
||||
v = qapi_dealloc_visitor_new();
|
||||
visit_type_uint8List(v, NULL, &obj, NULL);
|
||||
visit_type_DummyForceArrays(v, NULL, &obj, NULL);
|
||||
visit_free(v);
|
||||
}
|
||||
|
|
|
@ -13,163 +13,7 @@
|
|||
#ifndef QAPI_TYPES_H
|
||||
#define QAPI_TYPES_H
|
||||
|
||||
/* #include "qapi/util.h" */
|
||||
|
||||
#ifndef QAPI_TYPES_BUILTIN
|
||||
#define QAPI_TYPES_BUILTIN
|
||||
|
||||
|
||||
typedef enum QType {
|
||||
QTYPE_NONE = 0,
|
||||
QTYPE_QNULL = 1,
|
||||
QTYPE_QNUM = 2,
|
||||
QTYPE_QSTRING = 3,
|
||||
QTYPE_QDICT = 4,
|
||||
QTYPE_QLIST = 5,
|
||||
QTYPE_QBOOL = 6,
|
||||
QTYPE__MAX = 7,
|
||||
} QType;
|
||||
|
||||
extern const char *const QType_lookup[];
|
||||
|
||||
typedef struct anyList anyList;
|
||||
|
||||
struct anyList {
|
||||
anyList *next;
|
||||
QObject *value;
|
||||
};
|
||||
|
||||
void qapi_free_anyList(anyList *obj);
|
||||
|
||||
typedef struct boolList boolList;
|
||||
|
||||
struct boolList {
|
||||
boolList *next;
|
||||
bool value;
|
||||
};
|
||||
|
||||
void qapi_free_boolList(boolList *obj);
|
||||
|
||||
typedef struct int16List int16List;
|
||||
|
||||
struct int16List {
|
||||
int16List *next;
|
||||
int16_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int16List(int16List *obj);
|
||||
|
||||
typedef struct int32List int32List;
|
||||
|
||||
struct int32List {
|
||||
int32List *next;
|
||||
int32_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int32List(int32List *obj);
|
||||
|
||||
typedef struct int64List int64List;
|
||||
|
||||
struct int64List {
|
||||
int64List *next;
|
||||
int64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int64List(int64List *obj);
|
||||
|
||||
typedef struct int8List int8List;
|
||||
|
||||
struct int8List {
|
||||
int8List *next;
|
||||
int8_t value;
|
||||
};
|
||||
|
||||
void qapi_free_int8List(int8List *obj);
|
||||
|
||||
typedef struct intList intList;
|
||||
|
||||
struct intList {
|
||||
intList *next;
|
||||
int64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_intList(intList *obj);
|
||||
|
||||
typedef struct nullList nullList;
|
||||
|
||||
struct nullList {
|
||||
nullList *next;
|
||||
QNull *value;
|
||||
};
|
||||
|
||||
void qapi_free_nullList(nullList *obj);
|
||||
|
||||
typedef struct numberList numberList;
|
||||
|
||||
struct numberList {
|
||||
numberList *next;
|
||||
double value;
|
||||
};
|
||||
|
||||
void qapi_free_numberList(numberList *obj);
|
||||
|
||||
typedef struct sizeList sizeList;
|
||||
|
||||
struct sizeList {
|
||||
sizeList *next;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_sizeList(sizeList *obj);
|
||||
|
||||
typedef struct strList strList;
|
||||
|
||||
struct strList {
|
||||
strList *next;
|
||||
char *value;
|
||||
};
|
||||
|
||||
void qapi_free_strList(strList *obj);
|
||||
|
||||
typedef struct uint16List uint16List;
|
||||
|
||||
struct uint16List {
|
||||
uint16List *next;
|
||||
uint16_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint16List(uint16List *obj);
|
||||
|
||||
typedef struct uint32List uint32List;
|
||||
|
||||
struct uint32List {
|
||||
uint32List *next;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint32List(uint32List *obj);
|
||||
|
||||
typedef struct uint64List uint64List;
|
||||
|
||||
struct uint64List {
|
||||
uint64List *next;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint64List(uint64List *obj);
|
||||
|
||||
typedef struct uint8List uint8List;
|
||||
|
||||
struct uint8List {
|
||||
uint8List *next;
|
||||
uint8_t value;
|
||||
};
|
||||
|
||||
void qapi_free_uint8List(uint8List *obj);
|
||||
|
||||
#endif /* QAPI_TYPES_BUILTIN */
|
||||
|
||||
typedef struct DummyForceArrays DummyForceArrays;
|
||||
#include "qapi-builtin-types.h"
|
||||
|
||||
typedef enum QapiErrorClass {
|
||||
QAPI_ERROR_CLASS_GENERICERROR = 0,
|
||||
|
@ -183,10 +27,6 @@ typedef enum QapiErrorClass {
|
|||
|
||||
extern const char *const QapiErrorClass_lookup[];
|
||||
|
||||
typedef struct X86CPUFeatureWordInfo X86CPUFeatureWordInfo;
|
||||
|
||||
typedef struct X86CPUFeatureWordInfoList X86CPUFeatureWordInfoList;
|
||||
|
||||
typedef enum X86CPURegister32 {
|
||||
X86_CPU_REGISTER32_EAX = 0,
|
||||
X86_CPU_REGISTER32_EBX = 1,
|
||||
|
@ -201,11 +41,11 @@ typedef enum X86CPURegister32 {
|
|||
|
||||
extern const char *const X86CPURegister32_lookup[];
|
||||
|
||||
struct DummyForceArrays {
|
||||
X86CPUFeatureWordInfoList *unused;
|
||||
};
|
||||
typedef struct X86CPUFeatureWordInfo X86CPUFeatureWordInfo;
|
||||
|
||||
void qapi_free_DummyForceArrays(DummyForceArrays *obj);
|
||||
typedef struct X86CPUFeatureWordInfoList X86CPUFeatureWordInfoList;
|
||||
|
||||
typedef struct DummyForceArrays DummyForceArrays;
|
||||
|
||||
struct X86CPUFeatureWordInfo {
|
||||
int64_t cpuid_input_eax;
|
||||
|
@ -224,4 +64,10 @@ struct X86CPUFeatureWordInfoList {
|
|||
|
||||
void qapi_free_X86CPUFeatureWordInfoList(X86CPUFeatureWordInfoList *obj);
|
||||
|
||||
struct DummyForceArrays {
|
||||
X86CPUFeatureWordInfoList *unused;
|
||||
};
|
||||
|
||||
void qapi_free_DummyForceArrays(DummyForceArrays *obj);
|
||||
|
||||
#endif /* QAPI_TYPES_H */
|
||||
|
|
|
@ -13,54 +13,9 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi-visit.h"
|
||||
|
||||
void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_type_X86CPUFeatureWordInfoList(v, "unused", &obj->unused, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, name, (void **)obj, sizeof(DummyForceArrays), &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
if (!*obj) {
|
||||
goto out_obj;
|
||||
}
|
||||
visit_type_DummyForceArrays_members(v, *obj, &err);
|
||||
if (err) {
|
||||
goto out_obj;
|
||||
}
|
||||
visit_check_struct(v, &err);
|
||||
out_obj:
|
||||
visit_end_struct(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_DummyForceArrays(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, QType_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
|
@ -68,6 +23,13 @@ void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj
|
|||
*obj = value;
|
||||
}
|
||||
|
||||
void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, X86CPURegister32_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
void visit_type_X86CPUFeatureWordInfo_members(Visitor *v, X86CPUFeatureWordInfo *obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
@ -152,472 +114,39 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, name, &value, X86CPURegister32_lookup, errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp)
|
||||
void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
anyList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
visit_type_X86CPUFeatureWordInfoList(v, "unused", &obj->unused, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (anyList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_any(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, name, (void **)obj, sizeof(DummyForceArrays), &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (!*obj) {
|
||||
goto out_obj;
|
||||
}
|
||||
visit_type_DummyForceArrays_members(v, *obj, &err);
|
||||
if (err) {
|
||||
goto out_obj;
|
||||
}
|
||||
visit_check_struct(v, &err);
|
||||
out_obj:
|
||||
visit_end_struct(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_anyList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
boolList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (boolList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_bool(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_boolList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int16List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int16List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int16(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int16List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int32List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int32List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int32(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int32List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int64List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int64List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int64(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int64List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int8List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (int8List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int8(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_int8List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
intList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (intList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_int(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_intList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
nullList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (nullList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_null(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_nullList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
numberList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (numberList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_number(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_numberList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
sizeList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (sizeList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_size(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_sizeList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
strList *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (strList *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_str(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_strList(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint16List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint16List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint16(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint16List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint32List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint32List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint32(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint32List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint64List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint64List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint64(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint64List(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
uint8List *tail;
|
||||
size_t size = sizeof(**obj);
|
||||
|
||||
visit_start_list(v, name, (GenericList **)obj, size, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (tail = *obj; tail;
|
||||
tail = (uint8List *)visit_next_list(v, (GenericList *)tail, size)) {
|
||||
visit_type_uint8(v, NULL, &tail->value, &err);
|
||||
if (err) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
visit_check_list(v, &err);
|
||||
}
|
||||
visit_end_list(v, (void **)obj);
|
||||
if (err && visit_is_input(v)) {
|
||||
qapi_free_uint8List(*obj);
|
||||
qapi_free_DummyForceArrays(*obj);
|
||||
*obj = NULL;
|
||||
}
|
||||
out:
|
||||
|
|
|
@ -13,40 +13,17 @@
|
|||
#ifndef QAPI_VISIT_H
|
||||
#define QAPI_VISIT_H
|
||||
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
|
||||
#ifndef QAPI_VISIT_BUILTIN
|
||||
#define QAPI_VISIT_BUILTIN
|
||||
|
||||
void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp);
|
||||
void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp);
|
||||
void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp);
|
||||
void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp);
|
||||
void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp);
|
||||
void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp);
|
||||
void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp);
|
||||
void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp);
|
||||
void visit_type_nullList(Visitor *v, const char *name, nullList **obj, Error **errp);
|
||||
void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp);
|
||||
void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp);
|
||||
void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp);
|
||||
void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp);
|
||||
void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp);
|
||||
void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp);
|
||||
void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp);
|
||||
|
||||
#endif /* QAPI_VISIT_BUILTIN */
|
||||
|
||||
void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp);
|
||||
void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp);
|
||||
void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj, Error **errp);
|
||||
void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp);
|
||||
|
||||
void visit_type_X86CPUFeatureWordInfo_members(Visitor *v, X86CPUFeatureWordInfo *obj, Error **errp);
|
||||
void visit_type_X86CPUFeatureWordInfo(Visitor *v, const char *name, X86CPUFeatureWordInfo **obj, Error **errp);
|
||||
void visit_type_X86CPUFeatureWordInfoList(Visitor *v, const char *name, X86CPUFeatureWordInfoList **obj, Error **errp);
|
||||
void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp);
|
||||
|
||||
void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp);
|
||||
void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp);
|
||||
|
||||
#endif /* QAPI_VISIT_H */
|
||||
|
|
|
@ -236,6 +236,8 @@ copy $(SolutionDir)..\include\unicorn\*.h $(SolutionDir)distro\include\unicorn\
|
|||
<ClCompile Include="..\..\..\qemu\util\range.c" />
|
||||
<ClCompile Include="..\..\..\qemu\vl.c" />
|
||||
<ClCompile Include="..\..\..\uc.c" />
|
||||
<ClCompile Include="..\qapi-builtin-types.c" />
|
||||
<ClCompile Include="..\qapi-builtin-visit.c" />
|
||||
<ClCompile Include="..\qapi-types.c" />
|
||||
<ClCompile Include="..\qapi-visit.c" />
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
|
@ -362,6 +364,8 @@ copy $(SolutionDir)..\include\unicorn\*.h $(SolutionDir)distro\include\unicorn\
|
|||
<ClInclude Include="..\..\..\qemu\include\sysemu\sysemu.h" />
|
||||
<ClInclude Include="..\..\..\qemu\vl.h" />
|
||||
<ClInclude Include="..\config-host.h" />
|
||||
<ClInclude Include="..\qapi-builtin-types.h" />
|
||||
<ClInclude Include="..\qapi-builtin-visit.h" />
|
||||
<ClInclude Include="..\qapi-types.h" />
|
||||
<ClInclude Include="..\qapi-visit.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -132,6 +132,12 @@
|
|||
<ClCompile Include="..\qapi-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-visit.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-visit.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
|
@ -226,6 +232,12 @@
|
|||
<ClInclude Include="..\qapi-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-visit.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-visit.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
<ClCompile Include="..\..\..\qemu\util\range.c" />
|
||||
<ClCompile Include="..\..\..\qemu\vl.c" />
|
||||
<ClCompile Include="..\..\..\uc.c" />
|
||||
<ClCompile Include="..\qapi-builtin-types.c" />
|
||||
<ClCompile Include="..\qapi-builtin-visit.c" />
|
||||
<ClCompile Include="..\qapi-types.c" />
|
||||
<ClCompile Include="..\qapi-visit.c" />
|
||||
</ItemGroup>
|
||||
|
@ -177,6 +179,8 @@
|
|||
<ClInclude Include="..\..\..\qemu\include\sysemu\sysemu.h" />
|
||||
<ClInclude Include="..\..\..\qemu\vl.h" />
|
||||
<ClInclude Include="..\config-host.h" />
|
||||
<ClCompile Include="..\qapi-builtin-types.h" />
|
||||
<ClCompile Include="..\qapi-builtin-visit.h" />
|
||||
<ClInclude Include="..\qapi-types.h" />
|
||||
<ClInclude Include="..\qapi-visit.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -205,6 +205,12 @@
|
|||
<ClCompile Include="..\qapi-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-visit.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\include\list.h">
|
||||
|
@ -518,5 +524,11 @@
|
|||
<ClInclude Include="..\qapi-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-visit.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -47,8 +47,10 @@ endif
|
|||
include $(SRC_PATH)/rules.mak
|
||||
|
||||
GENERATED_FILES = config-host.h
|
||||
GENERATED_FILES += qapi-types.h qapi-visit.h
|
||||
GENERATED_FILES += qapi-types.c qapi-visit.c
|
||||
GENERATED_FILES += qapi-builtin-types.h qapi-builtin-types.c
|
||||
GENERATED_FILES += qapi-types.h qapi-types.c
|
||||
GENERATED_FILES += qapi-builtin-visit.h qapi-builtin-visit.c
|
||||
GENERATED_FILES += qapi-visit.h qapi-visit.c
|
||||
|
||||
# Don't try to regenerate Makefile or configure
|
||||
# We don't generate any of them
|
||||
|
@ -151,7 +153,9 @@ $(SRC_PATH)/scripts/qapi-gen.py
|
|||
|
||||
qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json
|
||||
|
||||
qapi-builtin-types.c qapi-builtin-types.h \
|
||||
qapi-types.c qapi-types.h \
|
||||
qapi-builtin-visit.c qapi-builtin-visit.h \
|
||||
qapi-visit.c qapi-visit.h \
|
||||
qapi-doc.texi: \
|
||||
qapi-gen-timestamp ;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#######################################################################
|
||||
# Common libraries for tools and emulators
|
||||
util-obj-y = util/ qobject/ qapi/ qapi-types.o qapi-visit.o
|
||||
util-obj-y += qapi-builtin-types.o
|
||||
util-obj-y += qapi-builtin-visit.o
|
||||
|
||||
#######################################################################
|
||||
# block-obj-y is code used by both qemu system emulation and qemu-img
|
||||
|
|
|
@ -1540,11 +1540,10 @@ class QAPISchema(object):
|
|||
|
||||
def _def_builtin_type(self, name, json_type, c_type):
|
||||
self._def_entity(QAPISchemaBuiltinType(name, json_type, c_type))
|
||||
# TODO As long as we have QAPI_TYPES_BUILTIN to share multiple
|
||||
# qapi-types.h from a single .c, all arrays of builtins must be
|
||||
# declared in the first file whether or not they are used. Nicer
|
||||
# would be to use lazy instantiation, while figuring out how to
|
||||
# avoid compilation issues with multiple qapi-types.h.
|
||||
# Instantiating only the arrays that are actually used would
|
||||
# be nice, but we can't as long as their generated code
|
||||
# (qapi-builtin-types.[ch]) may be shared by some other
|
||||
# schema.
|
||||
self._make_array_type(name, None)
|
||||
|
||||
def _def_predefineds(self):
|
||||
|
@ -1997,14 +1996,15 @@ class QAPIGen(object):
|
|||
return ''
|
||||
|
||||
def write(self, output_dir, fname):
|
||||
if output_dir:
|
||||
pathname = os.path.join(output_dir, fname)
|
||||
dir = os.path.dirname(pathname)
|
||||
if dir:
|
||||
try:
|
||||
os.makedirs(output_dir)
|
||||
os.makedirs(dir)
|
||||
except os.error as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
fd = os.open(os.path.join(output_dir, fname),
|
||||
os.O_RDWR | os.O_CREAT, 0o666)
|
||||
fd = os.open(pathname, os.O_RDWR | os.O_CREAT, 0o666)
|
||||
f = os.fdopen(fd, 'r+')
|
||||
text = (self._top(fname) + self._preamble + self._body
|
||||
+ self._bottom(fname))
|
||||
|
@ -2054,6 +2054,7 @@ class QAPIGenDoc(QAPIGen):
|
|||
return (QAPIGen._top(self, fname)
|
||||
+ '@c AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n')
|
||||
|
||||
|
||||
class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor):
|
||||
|
||||
def __init__(self, prefix, what, blurb, pydoc):
|
||||
|
@ -2065,3 +2066,45 @@ class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor):
|
|||
def write(self, output_dir):
|
||||
self._genc.write(output_dir, self._prefix + self._what + '.c')
|
||||
self._genh.write(output_dir, self._prefix + self._what + '.h')
|
||||
|
||||
|
||||
class QAPISchemaModularCVisitor(QAPISchemaVisitor):
|
||||
|
||||
def __init__(self, prefix, what, blurb, pydoc):
|
||||
self._prefix = prefix
|
||||
self._what = what
|
||||
self._blurb = blurb
|
||||
self._pydoc = pydoc
|
||||
self._module = {}
|
||||
|
||||
def _module_basename(self, what, name):
|
||||
if name is None:
|
||||
return re.sub(r'-', '-builtin-', what)
|
||||
return self._prefix + what
|
||||
|
||||
def _add_module(self, name, blurb):
|
||||
genc = QAPIGenC(blurb, self._pydoc)
|
||||
genh = QAPIGenH(blurb, self._pydoc)
|
||||
self._module[name] = (genc, genh)
|
||||
self._set_module(name)
|
||||
|
||||
def _set_module(self, name):
|
||||
self._genc, self._genh = self._module[name]
|
||||
|
||||
def write(self, output_dir, opt_builtins):
|
||||
for name in self._module:
|
||||
if name is None and not opt_builtins:
|
||||
continue
|
||||
basename = self._module_basename(self._what, name)
|
||||
(genc, genh) = self._module[name]
|
||||
genc.write(output_dir, basename + '.c')
|
||||
genh.write(output_dir, basename + '.h')
|
||||
|
||||
def _begin_module(self, name):
|
||||
pass
|
||||
|
||||
def visit_module(self, name):
|
||||
if len(self._module) != 1:
|
||||
return
|
||||
self._add_module(name, self._blurb)
|
||||
self._begin_module(name)
|
||||
|
|
|
@ -167,61 +167,48 @@ void qapi_free_%(c_name)s(%(c_name)s *obj)
|
|||
return ret
|
||||
|
||||
|
||||
class QAPISchemaGenTypeVisitor(QAPISchemaMonolithicCVisitor):
|
||||
class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
|
||||
|
||||
def __init__(self, prefix, opt_builtins):
|
||||
QAPISchemaMonolithicCVisitor.__init__(
|
||||
def __init__(self, prefix):
|
||||
QAPISchemaModularCVisitor.__init__(
|
||||
self, prefix, 'qapi-types', ' * Schema-defined QAPI types',
|
||||
__doc__)
|
||||
self._opt_builtins = opt_builtins
|
||||
self._add_module(None, ' * Built-in QAPI types')
|
||||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/dealloc-visitor.h"
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
'''))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
/* #include "qapi/util.h" */
|
||||
'''))
|
||||
|
||||
def _begin_module(self, name):
|
||||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/dealloc-visitor.h"
|
||||
#include "%(prefix)sqapi-types.h"
|
||||
#include "%(prefix)sqapi-visit.h"
|
||||
''',
|
||||
prefix=prefix))
|
||||
prefix=self._prefix))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
/* #include "qapi/util.h" */
|
||||
#include "qapi-builtin-types.h"
|
||||
'''))
|
||||
self._btin = '\n' + guardstart('QAPI_TYPES_BUILTIN')
|
||||
|
||||
def visit_begin(self, schema):
|
||||
# gen_object() is recursive, ensure it doesn't visit the empty type
|
||||
objects_seen.add(schema.the_empty_object_type.name)
|
||||
|
||||
def visit_end(self):
|
||||
# To avoid header dependency hell, we always generate
|
||||
# declarations for built-in types in our header files and
|
||||
# simply guard them. See also opt_builtins (command line
|
||||
# option -b).
|
||||
self._btin += guardend('QAPI_TYPES_BUILTIN')
|
||||
self._genh.preamble_add(self._btin)
|
||||
self._btin = None
|
||||
|
||||
def _gen_type_cleanup(self, name):
|
||||
self._genh.add(gen_type_cleanup_decl(name))
|
||||
self._genc.add(gen_type_cleanup(name))
|
||||
|
||||
def visit_enum_type(self, name, info, values, prefix):
|
||||
# Special case for our lone builtin enum type
|
||||
# TODO use something cleaner than existence of info
|
||||
if not info:
|
||||
self._btin += gen_enum(name, values, prefix)
|
||||
if self._opt_builtins:
|
||||
self._genc.add(gen_enum_lookup(name, values, prefix))
|
||||
else:
|
||||
self._genh.preamble_add(gen_enum(name, values, prefix))
|
||||
self._genc.add(gen_enum_lookup(name, values, prefix))
|
||||
|
||||
def visit_array_type(self, name, info, element_type):
|
||||
if isinstance(element_type, QAPISchemaBuiltinType):
|
||||
self._btin += gen_fwd_object_or_array(name)
|
||||
self._btin += gen_array(name, element_type)
|
||||
self._btin += gen_type_cleanup_decl(name)
|
||||
if self._opt_builtins:
|
||||
self._genc.add(gen_type_cleanup(name))
|
||||
else:
|
||||
self._genh.preamble_add(gen_fwd_object_or_array(name))
|
||||
self._genh.add(gen_array(name, element_type))
|
||||
self._gen_type_cleanup(name)
|
||||
|
@ -247,6 +234,6 @@ class QAPISchemaGenTypeVisitor(QAPISchemaMonolithicCVisitor):
|
|||
self._gen_type_cleanup(name)
|
||||
|
||||
def gen_types(schema, output_dir, prefix, opt_builtins):
|
||||
vis = QAPISchemaGenTypeVisitor(prefix, opt_builtins)
|
||||
vis = QAPISchemaGenTypeVisitor(prefix)
|
||||
schema.visit(vis)
|
||||
vis.write(output_dir)
|
||||
vis.write(output_dir, opt_builtins)
|
||||
|
|
|
@ -263,13 +263,27 @@ out:
|
|||
c_name=c_name(name))
|
||||
|
||||
|
||||
class QAPISchemaGenVisitVisitor(QAPISchemaMonolithicCVisitor):
|
||||
class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
|
||||
|
||||
def __init__(self, prefix, opt_builtins):
|
||||
QAPISchemaMonolithicCVisitor.__init__(
|
||||
def __init__(self, prefix):
|
||||
QAPISchemaModularCVisitor.__init__(
|
||||
self, prefix, 'qapi-visit', ' * Schema-defined QAPI visitors',
|
||||
__doc__)
|
||||
self._opt_builtins = opt_builtins
|
||||
self._add_module(None, ' * Built-in QAPI visitors')
|
||||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
'''))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi-builtin-types.h"
|
||||
|
||||
''',
|
||||
prefix=prefix))
|
||||
|
||||
def _begin_module(self, name):
|
||||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
|
@ -277,51 +291,21 @@ class QAPISchemaGenVisitVisitor(QAPISchemaMonolithicCVisitor):
|
|||
#include "qapi/qmp/qerror.h"
|
||||
#include "%(prefix)sqapi-visit.h"
|
||||
''',
|
||||
prefix=prefix))
|
||||
prefix=self._prefix))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
#include "%(prefix)sqapi-types.h"
|
||||
|
||||
''',
|
||||
prefix=prefix))
|
||||
self._btin = guardstart('QAPI_VISIT_BUILTIN')
|
||||
|
||||
|
||||
def visit_begin(self, schema):
|
||||
self.decl = ''
|
||||
self.defn = ''
|
||||
self._btin = '\n' + guardstart('QAPI_VISIT_BUILTIN')
|
||||
|
||||
def visit_end(self):
|
||||
# To avoid header dependency hell, we always generate
|
||||
# declarations for built-in types in our header files and
|
||||
# simply guard them. See also opt_builtins (command line
|
||||
# option -b).
|
||||
self._btin += guardend('QAPI_VISIT_BUILTIN')
|
||||
self._genh.preamble_add(self._btin)
|
||||
self._btin = None
|
||||
prefix=self._prefix))
|
||||
|
||||
def visit_enum_type(self, name, info, values, prefix):
|
||||
# Special case for our lone builtin enum type
|
||||
# TODO use something cleaner than existence of info
|
||||
if not info:
|
||||
self._btin += gen_visit_decl(name, scalar=True)
|
||||
if self._opt_builtins:
|
||||
self._genc.add(gen_visit_enum(name))
|
||||
else:
|
||||
self._genh.add(gen_visit_decl(name, scalar=True))
|
||||
self._genc.add(gen_visit_enum(name))
|
||||
|
||||
def visit_array_type(self, name, info, element_type):
|
||||
decl = gen_visit_decl(name)
|
||||
defn = gen_visit_list(name, element_type)
|
||||
if isinstance(element_type, QAPISchemaBuiltinType):
|
||||
self._btin += decl
|
||||
if self._opt_builtins:
|
||||
self._genc.add(defn)
|
||||
else:
|
||||
self._genh.add(decl)
|
||||
self._genc.add(defn)
|
||||
self._genh.add(gen_visit_decl(name))
|
||||
self._genc.add(gen_visit_list(name, element_type))
|
||||
|
||||
def visit_object_type(self, name, info, base, members, variants):
|
||||
# Nothing to do for the special empty builtin
|
||||
|
@ -341,6 +325,6 @@ class QAPISchemaGenVisitVisitor(QAPISchemaMonolithicCVisitor):
|
|||
self._genc.add(gen_visit_alternate(name, variants))
|
||||
|
||||
def gen_visit(schema, output_dir, prefix, opt_builtins):
|
||||
vis = QAPISchemaGenVisitVisitor(prefix, opt_builtins)
|
||||
vis = QAPISchemaGenVisitVisitor(prefix)
|
||||
schema.visit(vis)
|
||||
vis.write(output_dir)
|
||||
vis.write(output_dir, opt_builtins)
|
||||
|
|
Loading…
Reference in a new issue