|
|
@ -40,12 +40,6 @@ def _generate_functions(acid): |
|
|
|
tmpl_main += '{subitems}' |
|
|
|
tmpl_main += '}};\n\n' |
|
|
|
|
|
|
|
def format_func_main(tmpl, item, subitems_str): |
|
|
|
return tmpl.format( |
|
|
|
name=item["name"], |
|
|
|
return_type=item["result_type"], |
|
|
|
subitems=subitems_str) |
|
|
|
|
|
|
|
# Sub |
|
|
|
tmpl_sub = ' use {name} type="{type}";' |
|
|
|
|
|
|
@ -67,8 +61,7 @@ def _generate_functions(acid): |
|
|
|
|
|
|
|
for subitem in subitems: |
|
|
|
subitems_str += tmpl_sub.format(type=subitem["type"], name=subitem["name"]) + "\n" |
|
|
|
|
|
|
|
ret += format_func_main(tmpl_main, item, subitems_str) |
|
|
|
ret += tmpl_main.format(name=item["name"], return_type=item["result_type"], subitems=subitems_str) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
@ -106,7 +99,7 @@ def _generate_structs(acid): |
|
|
|
for subitem in subitems: |
|
|
|
subitems_str += tmpl_sub.format(type=subitem["type"], name=subitem["name"]) + "\n" |
|
|
|
|
|
|
|
ret += format_func_main(tmpl_main, item, subitems_str) |
|
|
|
ret += tmpl_main.format(name=item["name"], subitems=subitems_str) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
@ -154,7 +147,16 @@ def _generate_enums(acid): |
|
|
|
for subitem in subitems: |
|
|
|
subitems_str += tmpl_sub.format(name=subitem["name"], value=subitem["value"]) + "\n" |
|
|
|
|
|
|
|
ret += format_func_main(tmpl_main, item, subitems_str) |
|
|
|
name = "" |
|
|
|
if item["name"]: |
|
|
|
name = item["name"] |
|
|
|
else: |
|
|
|
name = item["type"] |
|
|
|
|
|
|
|
if name == "": |
|
|
|
print(__file__, " - warning: enum without a name or type extracted") |
|
|
|
|
|
|
|
ret += tmpl_main.format(name=name, subitems=subitems_str) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|