aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi.py
diff options
context:
space:
mode:
authorMichael Roth <mdroth@linux.vnet.ibm.com>2013-05-10 17:46:00 -0500
committerLuiz Capitulino <lcapitulino@redhat.com>2013-05-23 09:44:20 -0400
commitc0afa9c5f717d0ebf10c70c305974ebbffe4c71f (patch)
tree8d4650d7017fe28fe5bd71689d565b6bdee927a3 /scripts/qapi.py
parent95de21a430f7bc4166a153b1f69b1425c8a99c7b (diff)
downloadqemu-c0afa9c5f717d0ebf10c70c305974ebbffe4c71f.zip
qemu-c0afa9c5f717d0ebf10c70c305974ebbffe4c71f.tar.gz
qemu-c0afa9c5f717d0ebf10c70c305974ebbffe4c71f.tar.bz2
qapi: qapi-types.py, native list support
Teach type generators about native types so they can generate the appropriate linked list types. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index afc5f32..02ad668 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -11,6 +11,12 @@
from ordereddict import OrderedDict
+builtin_types = [
+ 'str', 'int', 'number', 'bool',
+ 'int8', 'int16', 'int32', 'int64',
+ 'uint8', 'uint16', 'uint32', 'uint64'
+]
+
def tokenize(data):
while len(data):
ch = data[0]
@@ -242,3 +248,20 @@ def guardname(filename):
for substr in [".", " ", "-"]:
guard = guard.replace(substr, "_")
return guard.upper() + '_H'
+
+def guardstart(name):
+ return mcgen('''
+
+#ifndef %(name)s
+#define %(name)s
+
+''',
+ name=guardname(name))
+
+def guardend(name):
+ return mcgen('''
+
+#endif /* %(name)s */
+
+''',
+ name=guardname(name))