|
|
@ -41,8 +41,6 @@ def _generate_functions(acid): |
|
|
|
tmpl_main += '{subitems}' |
|
|
|
tmpl_main += '}};\n\n' |
|
|
|
|
|
|
|
kind_main = "CursorKind.FUNCTION_DECL" |
|
|
|
|
|
|
|
def format_func_main(tmpl, item, subitems_str): |
|
|
|
return tmpl.format( |
|
|
|
name=item["name"], |
|
|
@ -60,7 +58,15 @@ def _generate_functions(acid): |
|
|
|
type=item["type"], |
|
|
|
name=item["name"]) |
|
|
|
|
|
|
|
ret = _format(data_root, tmpl_main, kind_main, format_func_main, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
def filt(item): |
|
|
|
if item["kind"] == "CursorKind.FUNCTION_DECL": |
|
|
|
return True |
|
|
|
|
|
|
|
main_items = utils.recursive_query(data_root, filt) |
|
|
|
|
|
|
|
ret = "" |
|
|
|
for item in main_items: |
|
|
|
ret += _formatnew(item, tmpl_main, format_func_main, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
@ -74,8 +80,6 @@ def _generate_structs(acid): |
|
|
|
tmpl_main += '{subitems}' |
|
|
|
tmpl_main += '}};\n\n' |
|
|
|
|
|
|
|
kind_main = "CursorKind.STRUCT_DECL" |
|
|
|
|
|
|
|
def format_func_main(tmpl, item, subitems_str): |
|
|
|
return tmpl.format(name=item["name"], subitems=subitems_str) |
|
|
|
|
|
|
@ -87,7 +91,15 @@ def _generate_structs(acid): |
|
|
|
def format_func_sub(tmpl, item): |
|
|
|
return tmpl.format(type=item["type"], name=item["name"]) |
|
|
|
|
|
|
|
ret = _format(data_root, tmpl_main, kind_main, format_func_main, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
def filt(item): |
|
|
|
if item["kind"] == "CursorKind.STRUCT_DECL": |
|
|
|
return True |
|
|
|
|
|
|
|
main_items = utils.recursive_query(data_root, filt) |
|
|
|
|
|
|
|
ret = "" |
|
|
|
for item in main_items: |
|
|
|
ret += _formatnew(item, tmpl_main, format_func_main, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
@ -101,8 +113,6 @@ def _generate_enums(acid): |
|
|
|
tmpl_main += '{subitems}' |
|
|
|
tmpl_main += '}};\n\n' |
|
|
|
|
|
|
|
kind_main = "CursorKind.ENUM_DECL" |
|
|
|
|
|
|
|
def format_func_main(tmpl, item, subitems_str): |
|
|
|
name = "" |
|
|
|
if item["name"]: |
|
|
@ -111,7 +121,7 @@ def _generate_enums(acid): |
|
|
|
name = item["type"] |
|
|
|
|
|
|
|
if name == "": |
|
|
|
print(__file__," - warning: enum without a name or type extracted") |
|
|
|
print(__file__, " - warning: enum without a name or type extracted") |
|
|
|
|
|
|
|
ret = tmpl.format(name=name, subitems=subitems_str) |
|
|
|
return ret |
|
|
@ -124,27 +134,27 @@ def _generate_enums(acid): |
|
|
|
def format_func_sub(tmpl, item): |
|
|
|
return tmpl.format(name=item["name"], value=item["value"]) |
|
|
|
|
|
|
|
ret = _format(data_root, tmpl_main, kind_main, format_func_main, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
def _format(data, tmpl_main, kind_main, func_main, tmpl_sub, kind_sub, func_sub): |
|
|
|
ret = "" |
|
|
|
|
|
|
|
def filt(item): |
|
|
|
if item["kind"] == kind_main: |
|
|
|
if item["kind"] == "CursorKind.ENUM_DECL": |
|
|
|
return True |
|
|
|
|
|
|
|
main_items = utils.recursive_query(data, filt) |
|
|
|
main_items = utils.recursive_query(data_root, filt) |
|
|
|
|
|
|
|
ret = "" |
|
|
|
for item in main_items: |
|
|
|
subitems_str = _format_subitems(item, tmpl_sub, kind_sub, func_sub) |
|
|
|
ret += func_main(tmpl_main, item, subitems_str) |
|
|
|
ret += _formatnew(item, tmpl_main, format_func_main, tmpl_sub, kind_sub, format_func_sub) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|
|
|
|
|
def _formatnew(item, tmpl_main, func_main, tmpl_sub, kind_sub, func_sub): |
|
|
|
ret = "" |
|
|
|
|
|
|
|
subitems_str = _format_subitems(item, tmpl_sub, kind_sub, func_sub) |
|
|
|
ret += func_main(tmpl_main, item, subitems_str) |
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|
def _format_subitems(data, tmpl, kind, func): |
|
|
|
ret = "" |
|
|
|
|
|
|
|