mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-22 19:45:35 +00:00
qapi: Move qapi-schema.json to qapi/, rename generated files
Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules. Consistently name the generated files qapi-MODULE.EXT: qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py, scripts/qapi/events.py, and scripts/qapi/common.py. Backports commit eb815e248f50cde9ab86eddd57eca5019b71ca78 from qemu
This commit is contained in:
parent
311d659acf
commit
3277400723
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -28,13 +28,13 @@ qemu/sparc-softmmu/
|
|||
qemu/i386-softmmu/
|
||||
qemu/x86_64-softmmu/
|
||||
|
||||
qemu/qapi-builtin-types.[ch]
|
||||
qemu/qapi-builtin-visit.[ch]
|
||||
qemu/qapi/qapi-builtin-types.[ch]
|
||||
qemu/qapi/qapi-builtin-visit.[ch]
|
||||
qemu/qapi/qapi-types-common.[ch]
|
||||
qemu/qapi/qapi-types-misc.[ch]
|
||||
qemu/qapi/qapi-visit-common.[ch]
|
||||
qemu/qapi-types.[ch]
|
||||
qemu/qapi-visit.[ch]
|
||||
qemu/qapi/qapi-types.[ch]
|
||||
qemu/qapi/qapi-visit.[ch]
|
||||
qemu/qapi/qapi-visit-misc.[ch]
|
||||
qemu/qapi-gen-timestamp
|
||||
tags
|
||||
|
|
|
@ -236,14 +236,14 @@ 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\qapi-builtin-types.c" />
|
||||
<ClCompile Include="..\qapi\qapi-builtin-visit.c" />
|
||||
<ClCompile Include="..\qapi\qapi-types-misc.c" />
|
||||
<ClCompile Include="..\qapi\qapi-visit-misc.c" />
|
||||
<ClCompile Include="..\qapi\qapi-types-common.c" />
|
||||
<ClCompile Include="..\qapi\qapi-visit-common.c" />
|
||||
<ClCompile Include="..\qapi-types.c" />
|
||||
<ClCompile Include="..\qapi-visit.c" />
|
||||
<ClCompile Include="..\qapi\qapi-types.c" />
|
||||
<ClCompile Include="..\qapi\qapi-visit.c" />
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
||||
|
@ -368,14 +368,14 @@ 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\qapi-builtin-types.h" />
|
||||
<ClInclude Include="..\qapi\qapi-builtin-visit.h" />
|
||||
<ClInclude Include="..\qapi\qapi-types-common.h" />
|
||||
<ClInclude Include="..\qapi\qapi-visit-common.h" />
|
||||
<ClInclude Include="..\qapi\qapi-types-misc.h" />
|
||||
<ClInclude Include="..\qapi\qapi-visit-misc.h" />
|
||||
<ClInclude Include="..\qapi-types.h" />
|
||||
<ClInclude Include="..\qapi-visit.h" />
|
||||
<ClInclude Include="..\qapi\qapi-types.h" />
|
||||
<ClInclude Include="..\qapi\qapi-visit.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -129,13 +129,13 @@
|
|||
<Filter>qemu\qom</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\uc.c" />
|
||||
<ClCompile Include="..\qapi-types.c">
|
||||
<ClCompile Include="..\qapi\qapi-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-types.c">
|
||||
<ClCompile Include="..\qapi\qapi-builtin-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-visit.c">
|
||||
<ClCompile Include="..\qapi\qapi-builtin-visit.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi\qapi-types-common.c">
|
||||
|
@ -150,7 +150,7 @@
|
|||
<ClCompile Include="..\qapi\qapi-visit-misc.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-visit.c">
|
||||
<ClCompile Include="..\qapi\qapi-visit.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -241,13 +241,13 @@
|
|||
<ClInclude Include="..\config-host.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-types.h">
|
||||
<ClInclude Include="..\qapi\qapi-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-types.h">
|
||||
<ClInclude Include="..\qapi\qapi-builtin-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-visit.h">
|
||||
<ClInclude Include="..\qapi\qapi-builtin-visit.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi\qapi-types-common.h">
|
||||
|
@ -262,7 +262,7 @@
|
|||
<ClInclude Include="..\qapi\qapi-visit-misc.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-visit.h">
|
||||
<ClInclude Include="..\qapi\qapi-visit.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\qemu\include\config.h">
|
||||
|
|
|
@ -64,12 +64,12 @@
|
|||
<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\qapi-builtin-types.c" />
|
||||
<ClCompile Include="..\qapi\qapi-builtin-visit.c" />
|
||||
<ClCompile Include="..\qapi\qapi-types-misc.c" />
|
||||
<ClCompile Include="..\qapi\qapi-visit-misc.c" />
|
||||
<ClCompile Include="..\qapi-types.c" />
|
||||
<ClCompile Include="..\qapi-visit.c" />
|
||||
<ClCompile Include="..\qapi\qapi-types.c" />
|
||||
<ClCompile Include="..\qapi\qapi-visit.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\include\list.h" />
|
||||
|
@ -181,14 +181,14 @@
|
|||
<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\qapi-builtin-types.h" />
|
||||
<ClInclude Include="..\qapi\qapi-builtin-visit.h" />
|
||||
<ClInclude Include="..\qapi\qapi-types-common.h" />
|
||||
<ClInclude Include="..\qapi\qapi-visit-common.h" />
|
||||
<ClInclude Include="..\qapi\qapi-types-misc.h" />
|
||||
<ClInclude Include="..\qapi\qapi-visit-misc.h" />
|
||||
<ClInclude Include="..\qapi-types.h" />
|
||||
<ClInclude Include="..\qapi-visit.h" />
|
||||
<ClInclude Include="..\qapi\qapi-types.h" />
|
||||
<ClInclude Include="..\qapi\qapi-visit.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B6EFD6D7-C2D4-4FBB-B363-2E08CE09CC96}</ProjectGuid>
|
||||
|
|
|
@ -199,16 +199,16 @@
|
|||
<Filter>qemu\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\uc.c" />
|
||||
<ClCompile Include="..\qapi-visit.c">
|
||||
<ClCompile Include="..\qapi\qapi-visit.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-types.c">
|
||||
<ClCompile Include="..\qapi\qapi-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-types.c">
|
||||
<ClCompile Include="..\qapi\qapi-builtin-types.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi-builtin-visit.c">
|
||||
<ClCompile Include="..\qapi\qapi-builtin-visit.c">
|
||||
<Filter>qemu</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\qapi\qapi-types-common.c">
|
||||
|
@ -530,16 +530,16 @@
|
|||
<ClInclude Include="..\config-host.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-visit.h">
|
||||
<ClInclude Include="..\qapi\qapi-visit.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-types.h">
|
||||
<ClInclude Include="..\qapi\qapi-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-types.h">
|
||||
<ClInclude Include="..\qapi\qapi-builtin-types.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi-builtin-visit.h">
|
||||
<ClInclude Include="..\qapi\qapi-builtin-visit.h">
|
||||
<Filter>qemu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\qapi\qapi-types-common.h">
|
||||
|
|
|
@ -47,12 +47,12 @@ endif
|
|||
include $(SRC_PATH)/rules.mak
|
||||
|
||||
GENERATED_FILES = config-host.h
|
||||
GENERATED_FILES += qapi-builtin-types.h qapi-builtin-types.c
|
||||
GENERATED_FILES += qapi-types.h qapi-types.c
|
||||
GENERATED_FILES += qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c
|
||||
GENERATED_FILES += qapi/qapi-types.h qapi/qapi-types.c
|
||||
GENERATED_FILES += qapi/qapi-types-common.h qapi/qapi-types-common.c
|
||||
GENERATED_FILES += qapi/qapi-types-misc.h qapi/qapi-types-misc.c
|
||||
GENERATED_FILES += qapi-builtin-visit.h qapi-builtin-visit.c
|
||||
GENERATED_FILES += qapi-visit.h qapi-visit.c
|
||||
GENERATED_FILES += qapi/qapi-builtin-visit.h qapi/qapi-builtin-visit.c
|
||||
GENERATED_FILES += qapi/qapi-visit.h qapi/qapi-visit.c
|
||||
GENERATED_FILES += qapi/qapi-visit-misc.h qapi/qapi-visit-misc.c
|
||||
GENERATED_FILES += qapi/qapi-visit-common.h qapi/qapi-visit-common.c
|
||||
|
||||
|
@ -135,7 +135,7 @@ $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
|
|||
subdir-%:
|
||||
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
|
||||
|
||||
$(SUBDIR_RULES): qapi-types.c qapi-types.h qapi-visit.c qapi-visit.h $(common-obj-y) $(util-obj-y)
|
||||
$(SUBDIR_RULES): qapi/qapi-types.c qapi/qapi-types.h qapi/qapi-visit.c qapi/qapi-visit.h $(common-obj-y) $(util-obj-y)
|
||||
|
||||
ALL_SUBDIRS=$(TARGET_DIRS)
|
||||
|
||||
|
@ -156,24 +156,24 @@ $(SRC_PATH)/scripts/ordereddict.py \
|
|||
$(SRC_PATH)/scripts/qapi-gen.py
|
||||
|
||||
qapi-modules = \
|
||||
$(SRC_PATH)/qapi-schema.json \
|
||||
$(SRC_PATH)/qapi/qapi-schema.json \
|
||||
$(SRC_PATH)/qapi/common.json \
|
||||
$(SRC_PATH)/qapi/misc.json
|
||||
|
||||
|
||||
qapi-builtin-types.c qapi-builtin-types.h \
|
||||
qapi-types.c qapi-types.h \
|
||||
qapi/qapi-builtin-types.c qapi/qapi-builtin-types.h \
|
||||
qapi/qapi-types.c qapi/qapi-types.h \
|
||||
qapi/qapi-types-common.c qapi/qapi-types-common.h \
|
||||
qapi/qapi-types-misc.c qapi/qapi-types-misc.h \
|
||||
qapi-builtin-visit.c qapi-builtin-visit.h \
|
||||
qapi-visit.c qapi-visit.h \
|
||||
qapi/qapi-builtin-visit.c qapi/qapi-builtin-visit.h \
|
||||
qapi/qapi-visit.c qapi/qapi-visit.h \
|
||||
qapi/qapi-visit-common.c qapi/qapi-visit-common.h \
|
||||
qapi/qapi-visit-misc.c qapi/qapi-visit-misc.h \
|
||||
qapi-doc.texi: \
|
||||
qapi-gen-timestamp ;
|
||||
qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
|
||||
$(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \
|
||||
-o "." -b $<, \
|
||||
-o "qapi" -b $<, \
|
||||
"GEN","$(@:%-timestamp=%)")
|
||||
@>$@
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#######################################################################
|
||||
# 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
|
||||
util-obj-y = util/ qobject/ qapi/
|
||||
util-obj-y += qapi/qapi-types.o
|
||||
util-obj-y += qapi/qapi-builtin-types.o
|
||||
util-obj-y += qapi/qapi-builtin-visit.o
|
||||
util-obj-y += qapi/qapi-types-misc.o
|
||||
util-obj-y += qapi/qapi-visit.o
|
||||
util-obj-y += qapi/qapi-visit-misc.o
|
||||
|
||||
#######################################################################
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
#define ERROR_H
|
||||
|
||||
#include "qemu/compiler.h"
|
||||
#include "qapi-types.h"
|
||||
#include "qapi/qapi-types.h"
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef QLIT_H
|
||||
#define QLIT_H
|
||||
|
||||
#include "qapi-types.h"
|
||||
#include "qobject.h"
|
||||
|
||||
typedef struct QLitDictEntry QLitDictEntry;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#ifndef QOBJECT_H
|
||||
#define QOBJECT_H
|
||||
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi/qapi-builtin-types.h"
|
||||
|
||||
struct QObject {
|
||||
QType type;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#ifndef QAPI_VISITOR_H
|
||||
#define QAPI_VISITOR_H
|
||||
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi/qapi-builtin-types.h"
|
||||
|
||||
/*
|
||||
* The QAPI schema defines both a set of C data types, and a QMP wire
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "glib_compat.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi/qapi-builtin-types.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/typedefs.h"
|
||||
#include "qapi/error.h"
|
||||
|
|
|
@ -73,5 +73,5 @@
|
|||
] } }
|
||||
|
||||
# QAPI common definitions
|
||||
{ 'include': 'qapi/common.json' }
|
||||
{ 'include': 'qapi/misc.json' }
|
||||
{ 'include': 'common.json' }
|
||||
{ 'include': 'misc.json' }
|
|
@ -16,7 +16,7 @@
|
|||
#include "qemu/cutils.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi/string-input-visitor.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
#include "qapi/qapi-builtin-visit.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
/* TODO: replace QObject with a simpler visitor to avoid a dependency
|
||||
|
|
|
@ -1784,11 +1784,10 @@ def c_enum_const(type_name, const_name, prefix=None):
|
|||
type_name = prefix
|
||||
return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper()
|
||||
|
||||
# Temporary HACK for '/':
|
||||
if hasattr(str, 'maketrans'):
|
||||
c_name_trans = str.maketrans('.-/', '___')
|
||||
c_name_trans = str.maketrans('.-', '__')
|
||||
else:
|
||||
c_name_trans = string.maketrans('.-/', '___')
|
||||
c_name_trans = string.maketrans('.-', '__')
|
||||
|
||||
|
||||
# Map @name to a valid C identifier.
|
||||
|
|
|
@ -157,19 +157,12 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
|
|||
self._enum_name = c_name(prefix + 'QAPIEvent', protect=False)
|
||||
self._event_names = []
|
||||
|
||||
# Temporary HACK:
|
||||
def _module_basename(self, what, name):
|
||||
basename = QAPISchemaModularCVisitor._module_basename(self, what, name)
|
||||
if name == self._main_module:
|
||||
return re.sub(r'qapi-events', 'qapi-event', basename)
|
||||
return basename
|
||||
|
||||
def _begin_module(self, name):
|
||||
types = self._module_basename('qapi-types', name)
|
||||
visit = self._module_basename('qapi-visit', name)
|
||||
self._genc.add(mcgen('''
|
||||
#include "qemu-common.h"
|
||||
#include "%(prefix)sqapi-event.h"
|
||||
#include "%(prefix)sqapi-events.h"
|
||||
#include "%(visit)s.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
|
|
|
@ -177,8 +177,8 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
|
|||
self._genc.preamble_add(mcgen('''
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/dealloc-visitor.h"
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
#include "qapi/qapi-builtin-types.h"
|
||||
#include "qapi/qapi-builtin-visit.h"
|
||||
'''))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
/* #include "qapi/util.h" */
|
||||
|
@ -195,7 +195,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
|
|||
''',
|
||||
types=types, visit=visit))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi/qapi-builtin-types.h"
|
||||
'''))
|
||||
|
||||
def visit_begin(self, schema):
|
||||
|
|
|
@ -274,11 +274,11 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
|
|||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi-builtin-visit.h"
|
||||
#include "qapi/qapi-builtin-visit.h"
|
||||
'''))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
#include "qapi/visitor.h"
|
||||
#include "qapi-builtin-types.h"
|
||||
#include "qapi/qapi-builtin-types.h"
|
||||
|
||||
''',
|
||||
prefix=prefix))
|
||||
|
@ -295,7 +295,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
|
|||
''',
|
||||
visit=visit, prefix=self._prefix))
|
||||
self._genh.preamble_add(mcgen('''
|
||||
#include "qapi-builtin-visit.h"
|
||||
#include "qapi/qapi-builtin-visit.h"
|
||||
#include "%(types)s.h"
|
||||
|
||||
''',
|
||||
|
|
Loading…
Reference in a new issue