1# *-*- Mode: Python -*-* 2 3# for testing enums 4{ 'enum': 'EnumOne', 5 'data': [ 'value1', 'value2', 'value3' ] } 6{ 'struct': 'NestedEnumsOne', 7 'data': { 'enum1': 'EnumOne', '*enum2': 'EnumOne', 'enum3': 'EnumOne', '*enum4': 'EnumOne' } } 8 9# for testing nested structs 10{ 'struct': 'UserDefOne', 11 'base': 'UserDefZero', # intentional forward reference 12 'data': { 'string': 'str', '*enum1': 'EnumOne' } } 13 14{ 'struct': 'UserDefZero', 15 'data': { 'integer': 'int' } } 16 17{ 'struct': 'UserDefTwoDictDict', 18 'data': { 'userdef': 'UserDefOne', 'string': 'str' } } 19 20{ 'struct': 'UserDefTwoDict', 21 'data': { 'string1': 'str', 22 'dict2': 'UserDefTwoDictDict', 23 '*dict3': 'UserDefTwoDictDict' } } 24 25{ 'struct': 'UserDefTwo', 26 'data': { 'string0': 'str', 27 'dict1': 'UserDefTwoDict' } } 28 29# for testing unions 30{ 'struct': 'UserDefA', 31 'data': { 'boolean': 'bool' } } 32 33{ 'struct': 'UserDefB', 34 'data': { 'intb': 'int' } } 35 36{ 'union': 'UserDefFlatUnion', 37 'base': 'UserDefUnionBase', # intentional forward reference 38 'discriminator': 'enum1', 39 'data': { 'value1' : 'UserDefA', 40 'value2' : 'UserDefB', 41 'value3' : 'UserDefB' } } 42# FIXME generated struct UserDefFlatUnion has members for direct base 43# UserDefUnionBase, but lacks members for indirect base UserDefZero 44 45{ 'struct': 'UserDefUnionBase', 46 'base': 'UserDefZero', 47 'data': { 'string': 'str', 'enum1': 'EnumOne' } } 48 49# this variant of UserDefFlatUnion defaults to a union that uses fields with 50# allocated types to test corner cases in the cleanup/dealloc visitor 51{ 'union': 'UserDefFlatUnion2', 52 'base': 'UserDefUnionBase', 53 'discriminator': 'enum1', 54 'data': { 'value1' : 'UserDefC', # intentional forward reference 55 'value2' : 'UserDefB', 56 'value3' : 'UserDefA' } } 57 58{ 'alternate': 'UserDefAlternate', 59 'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } } 60# FIXME only a declaration of visit_type_UserDefAlternateKind() generated 61 62{ 'struct': 'UserDefC', 63 'data': { 'string1': 'str', 'string2': 'str' } } 64 65# for testing native lists 66{ 'union': 'UserDefNativeListUnion', 67 'data': { 'integer': ['int'], 68 's8': ['int8'], 69 's16': ['int16'], 70 's32': ['int32'], 71 's64': ['int64'], 72 'u8': ['uint8'], 73 'u16': ['uint16'], 74 'u32': ['uint32'], 75 'u64': ['uint64'], 76 'number': ['number'], 77 'boolean': ['bool'], 78 'string': ['str'], 79 'sizes': ['size'] } } 80 81# testing commands 82{ 'command': 'user_def_cmd', 'data': {} } 83{ 'command': 'user_def_cmd1', 'data': {'ud1a': 'UserDefOne'} } 84{ 'command': 'user_def_cmd2', 85 'data': {'ud1a': 'UserDefOne', '*ud1b': 'UserDefOne'}, 86 'returns': 'UserDefTwo' } 87{ 'command': 'user_def_cmd3', 'data': {'a': 'int', '*b': 'int' }, 88 'returns': 'int' } 89 90# For testing integer range flattening in opts-visitor. The following schema 91# corresponds to the option format: 92# 93# -userdef i64=3-6,i64=-5--1,u64=2,u16=1,u16=7-12 94# 95# For simplicity, this example doesn't use [type=]discriminator nor optargs 96# specific to discriminator values. 97{ 'struct': 'UserDefOptions', 98 'data': { 99 '*i64' : [ 'int' ], 100 '*u64' : [ 'uint64' ], 101 '*u16' : [ 'uint16' ], 102 '*i64x': 'int' , 103 '*u64x': 'uint64' } } 104 105# testing event 106{ 'struct': 'EventStructOne', 107 'data': { 'struct1': 'UserDefOne', 'string': 'str', '*enum2': 'EnumOne' } } 108 109{ 'event': 'EVENT_A' } 110{ 'event': 'EVENT_B', 111 'data': { } } 112{ 'event': 'EVENT_C', 113 'data': { '*a': 'int', '*b': 'UserDefOne', 'c': 'str' } } 114{ 'event': 'EVENT_D', 115 'data': { 'a' : 'EventStructOne', 'b' : 'str', '*c': 'str', '*enum3': 'EnumOne' } } 116 117# test that we correctly compile downstream extensions 118{ 'enum': '__org.qemu_x-Enum', 'data': [ '__org.qemu_x-value' ] } 119{ 'struct': '__org.qemu_x-Base', 120 'data': { '__org.qemu_x-member1': '__org.qemu_x-Enum' } } 121{ 'struct': '__org.qemu_x-Struct', 'base': '__org.qemu_x-Base', 122 'data': { '__org.qemu_x-member2': 'str' } } 123{ 'union': '__org.qemu_x-Union1', 'data': { '__org.qemu_x-branch': 'str' } } 124{ 'struct': '__org.qemu_x-Struct2', 125 'data': { 'array': ['__org.qemu_x-Union1'] } } 126{ 'union': '__org.qemu_x-Union2', 'base': '__org.qemu_x-Base', 127 'discriminator': '__org.qemu_x-member1', 128 'data': { '__org.qemu_x-value': '__org.qemu_x-Struct2' } } 129{ 'alternate': '__org.qemu_x-Alt', 130 'data': { '__org.qemu_x-branch': 'str', 'b': '__org.qemu_x-Base' } } 131{ 'event': '__ORG.QEMU_X-EVENT', 'data': '__org.qemu_x-Struct' } 132# FIXME generated qapi_event_send___org_qemu_x_event() has only a 133# parameter for data's member __org_qemu_x_member2, none for its base 134# __org.qemu_x-Base's member __org_qemu_x_member1 135{ 'command': '__org.qemu_x-command', 136 'data': { 'a': ['__org.qemu_x-Enum'], 'b': ['__org.qemu_x-Struct'], 137 'c': '__org.qemu_x-Union2', 'd': '__org.qemu_x-Alt' }, 138 'returns': '__org.qemu_x-Union1' } 139