From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Jz8-0001Jk-Dx for qemu-devel@nongnu.org; Tue, 14 Aug 2012 12:28:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Jz5-0006Vo-4E for qemu-devel@nongnu.org; Tue, 14 Aug 2012 12:28:50 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:53584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Jz4-0006Tr-UI for qemu-devel@nongnu.org; Tue, 14 Aug 2012 12:28:47 -0400 Received: by mail-yw0-f45.google.com with SMTP id p34so649797yhp.4 for ; Tue, 14 Aug 2012 09:28:46 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Tue, 14 Aug 2012 11:27:25 -0500 Message-Id: <1344961646-21194-20-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1344961646-21194-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1344961646-21194-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 19/20] qidl: qidl.h, definitions for qidl annotations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com, aliguori@us.ibm.com Signed-off-by: Michael Roth --- qidl.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 qidl.h diff --git a/qidl.h b/qidl.h new file mode 100644 index 0000000..210f4c6 --- /dev/null +++ b/qidl.h @@ -0,0 +1,63 @@ +/* + * QEMU IDL Macros/stubs + * + * See docs/qidl.txt for usage information. + * + * Copyright IBM, Corp. 2012 + * + * Authors: + * Michael Roth + * + * This work is licensed under the terms of the GNU GPLv2 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QIDL_H +#define QIDL_H + +#include +#include "qapi/qapi-visit-core.h" +#include "qemu/object.h" +#include "hw/qdev-properties.h" + +#ifdef QIDL_GEN + +/* we pass the code through the preprocessor with QIDL_GEN defined to parse + * structures as they'd appear after preprocessing, and use the following + * definitions mostly to re-insert the initial macros/annotations so they + * stick around for the parser to process + */ +#define QIDL(...) QIDL(__VA_ARGS__) +#define QIDL_START(name, ...) QIDL_START(name, ##__VA_ARGS__) +#define QIDL_END(name) QIDL_END(name) + +#define QIDL_VISIT_TYPE(name, v, s, f, e) +#define QIDL_SCHEMA_ADD_LINK(name, obj, path, errp) +#define QIDL_PROPERTIES(name) + +#else /* !QIDL_GEN */ + +#define QIDL(...) +#define QIDL_START(name, ...) +#define QIDL_END(name) \ + static struct { \ + void (*visitor)(Visitor *, struct name **, const char *, Error **); \ + const char *schema_json_text; \ + Object *schema_obj; \ + Property *properties; \ + } qidl_data_##name; + +#define QIDL_VISIT_TYPE(name, v, s, f, e) \ + g_assert(qidl_data_##name.visitor); \ + qidl_data_##name.visitor(v, s, f, e) +#define QIDL_SCHEMA_ADD_LINK(name, obj, path, errp) \ + g_assert(qidl_data_##name.schema_obj); \ + object_property_add_link(obj, path, "container", \ + &qidl_data_##name.schema_obj, errp) +#define QIDL_PROPERTIES(name) \ + qidl_data_##name.properties + +#endif /* QIDL_GEN */ + +#endif -- 1.7.9.5