|
|
@ -49,13 +49,6 @@ def _generate_functions(acid): |
|
|
|
# Sub |
|
|
|
tmpl_sub = ' use {name} type="{type}";' |
|
|
|
|
|
|
|
kind_sub = "CursorKind.PARM_DECL" |
|
|
|
|
|
|
|
def format_func_sub(tmpl, item): |
|
|
|
return tmpl.format( |
|
|
|
type=item["type"], |
|
|
|
name=item["name"]) |
|
|
|
|
|
|
|
def filt(item): |
|
|
|
if item["kind"] == "CursorKind.FUNCTION_DECL": |
|
|
|
return True |
|
|
@ -64,8 +57,18 @@ def _generate_functions(acid): |
|
|
|
|
|
|
|
ret = "" |
|
|
|
for item in main_items: |
|
|
|
subitems_str = _format_subitems(item, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
ret += format_func_main(tmpl_main, item, subitems_str) |
|
|
|
subitems_str = "" |
|
|
|
|
|
|
|
def filt(data): |
|
|
|
if data["kind"] == "CursorKind.PARM_DECL": |
|
|
|
return True |
|
|
|
|
|
|
|
subitems = utils.recursive_query(item, filt) |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
@ -83,10 +86,6 @@ def _generate_structs(acid): |
|
|
|
|
|
|
|
# Sub |
|
|
|
tmpl_sub = ' field {name} type="{type}";' |
|
|
|
kind_sub = "CursorKind.FIELD_DECL" |
|
|
|
|
|
|
|
def format_func_sub(tmpl, item): |
|
|
|
return tmpl.format(type=item["type"], name=item["name"]) |
|
|
|
|
|
|
|
def filt(item): |
|
|
|
if item["kind"] == "CursorKind.STRUCT_DECL": |
|
|
@ -96,7 +95,17 @@ def _generate_structs(acid): |
|
|
|
|
|
|
|
ret = "" |
|
|
|
for item in main_items: |
|
|
|
subitems_str = _format_subitems(item, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
subitems_str = "" |
|
|
|
|
|
|
|
def filt(data): |
|
|
|
if data["kind"] == "CursorKind.FIELD_DECL": |
|
|
|
return True |
|
|
|
|
|
|
|
subitems = utils.recursive_query(item, filt) |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
return ret |
|
|
@ -125,10 +134,6 @@ def _generate_enums(acid): |
|
|
|
|
|
|
|
# Sub |
|
|
|
tmpl_sub = ' item {name} value={value};' |
|
|
|
kind_sub = "CursorKind.ENUM_CONSTANT_DECL" |
|
|
|
|
|
|
|
def format_func_sub(tmpl, item): |
|
|
|
return tmpl.format(name=item["name"], value=item["value"]) |
|
|
|
|
|
|
|
def filt(item): |
|
|
|
if item["kind"] == "CursorKind.ENUM_DECL": |
|
|
@ -138,17 +143,18 @@ def _generate_enums(acid): |
|
|
|
|
|
|
|
ret = "" |
|
|
|
for item in main_items: |
|
|
|
subitems_str = _format_subitems(item, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
ret += format_func_main(tmpl_main, item, subitems_str) |
|
|
|
subitems_str = "" |
|
|
|
|
|
|
|
return ret |
|
|
|
def filt(data): |
|
|
|
if data["kind"] == "CursorKind.ENUM_CONSTANT_DECL": |
|
|
|
return True |
|
|
|
|
|
|
|
subitems = utils.recursive_query(item, filt) |
|
|
|
|
|
|
|
def _formatnew(item, tmpl_main, func_main, tmpl_sub, kind_sub, func_sub): |
|
|
|
ret = "" |
|
|
|
for subitem in subitems: |
|
|
|
subitems_str += tmpl_sub.format(name=subitem["name"], value=subitem["value"]) + "\n" |
|
|
|
|
|
|
|
subitems_str = _format_subitems(item, tmpl_sub, kind_sub, func_sub) |
|
|
|
ret += func_main(tmpl_main, item, subitems_str) |
|
|
|
ret += format_func_main(tmpl_main, item, subitems_str) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|