mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
qapi-types.py: Split off generate_struct_fields()
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
09da4a7292
commit
015370301f
@ -57,12 +57,8 @@ typedef struct %(name)sList
|
||||
''',
|
||||
name=name)
|
||||
|
||||
def generate_struct(structname, fieldname, members):
|
||||
ret = mcgen('''
|
||||
struct %(name)s
|
||||
{
|
||||
''',
|
||||
name=structname)
|
||||
def generate_struct_fields(members):
|
||||
ret = ''
|
||||
|
||||
for argname, argentry, optional, structured in parse_args(members):
|
||||
if optional:
|
||||
@ -80,6 +76,17 @@ struct %(name)s
|
||||
''',
|
||||
c_type=c_type(argentry), c_name=c_var(argname))
|
||||
|
||||
return ret
|
||||
|
||||
def generate_struct(structname, fieldname, members):
|
||||
ret = mcgen('''
|
||||
struct %(name)s
|
||||
{
|
||||
''',
|
||||
name=structname)
|
||||
|
||||
ret += generate_struct_fields(members)
|
||||
|
||||
if len(fieldname):
|
||||
fieldname = " " + fieldname
|
||||
ret += mcgen('''
|
||||
|
Loading…
Reference in New Issue
Block a user