summaryrefslogtreecommitdiff
path: root/modules/gdnative/gdnative_builders.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative/gdnative_builders.py')
-rw-r--r--modules/gdnative/gdnative_builders.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py
index f9d1ed9dc5..ff18a3ae69 100644
--- a/modules/gdnative/gdnative_builders.py
+++ b/modules/gdnative/gdnative_builders.py
@@ -87,20 +87,20 @@ def _build_gdnative_api_struct_header(api):
ret_val = []
if core['next']:
ret_val += generate_core_extension_struct(core['next'])
-
+
ret_val += [
'typedef struct godot_gdnative_core_' + ('{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + '_api_struct {',
'\tunsigned int type;',
'\tgodot_gdnative_api_version version;',
'\tconst godot_gdnative_api_struct *next;',
]
-
+
for funcdef in core['api']:
args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
ret_val.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args))
-
+
ret_val += ['} godot_gdnative_core_' + '{0}_{1}'.format(core['version']['major'], core['version']['minor']) + '_api_struct;', '']
-
+
return ret_val
@@ -171,26 +171,26 @@ def _build_gdnative_api_struct_source(api):
ret_val += ['};\n']
return ret_val
-
-
+
+
def get_core_struct_definition(core):
ret_val = []
-
+
if core['next']:
ret_val += get_core_struct_definition(core['next'])
-
+
ret_val += [
'extern const godot_gdnative_core_' + ('{0}_{1}_api_struct api_{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + ' = {',
'\tGDNATIVE_' + core['type'] + ',',
'\t{' + str(core['version']['major']) + ', ' + str(core['version']['minor']) + '},',
'\t' + ('NULL' if not core['next'] else ('(const godot_gdnative_api_struct *)& api_{0}_{1}'.format(core['version']['major'], core['version']['minor']))) + ','
]
-
+
for funcdef in core['api']:
ret_val.append('\t%s,' % funcdef['name'])
-
+
ret_val += ['};\n']
-
+
return ret_val
for ext in api['extensions']:
@@ -204,7 +204,7 @@ def _build_gdnative_api_struct_source(api):
out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,']
out += ['};\n']
-
+
if api['core']['next']:
out += get_core_struct_definition(api['core']['next'])