Store GDNative API in array instead of dictionary
This commit is contained in:
parent
bd10a00240
commit
39584f3312
@ -35,9 +35,9 @@ def _build_gdnative_api_struct_header(api):
|
|||||||
'\tconst char *version;',
|
'\tconst char *version;',
|
||||||
]
|
]
|
||||||
|
|
||||||
for funcname, funcdef in api['api'].items():
|
for funcdef in api['api']:
|
||||||
args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
|
args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
|
||||||
out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcname, args))
|
out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args))
|
||||||
|
|
||||||
out += [
|
out += [
|
||||||
'} godot_gdnative_api_struct;',
|
'} godot_gdnative_api_struct;',
|
||||||
@ -63,8 +63,8 @@ def _build_gdnative_api_struct_source(api):
|
|||||||
'\t_gdnative_api_version,',
|
'\t_gdnative_api_version,',
|
||||||
]
|
]
|
||||||
|
|
||||||
for funcname in api['api'].keys():
|
for funcdef in api['api']:
|
||||||
out.append('\t%s,' % funcname)
|
out.append('\t%s,' % funcdef['name'])
|
||||||
out.append('};\n')
|
out.append('};\n')
|
||||||
|
|
||||||
return '\n'.join(out)
|
return '\n'.join(out)
|
||||||
@ -75,7 +75,7 @@ def build_gdnative_api_struct(target, source, env):
|
|||||||
|
|
||||||
with open(source[0].path, 'r') as fd:
|
with open(source[0].path, 'r') as fd:
|
||||||
# Keep the json ordered
|
# Keep the json ordered
|
||||||
api = json.load(fd, object_pairs_hook=OrderedDict)
|
api = json.load(fd)
|
||||||
|
|
||||||
header, source = target
|
header, source = target
|
||||||
with open(header.path, 'w') as fd:
|
with open(header.path, 'w') as fd:
|
||||||
@ -107,14 +107,14 @@ def _build_gdnative_wrapper_code(api):
|
|||||||
''
|
''
|
||||||
]
|
]
|
||||||
|
|
||||||
for funcname, funcdef in api['api'].items():
|
for funcdef in api['api']:
|
||||||
args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
|
args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
|
||||||
out.append('%s %s(%s) {' % (_spaced(funcdef['return_type']), funcname, args))
|
out.append('%s %s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args))
|
||||||
|
|
||||||
args = ', '.join(['%s' % n for t, n in funcdef['arguments']])
|
args = ', '.join(['%s' % n for t, n in funcdef['arguments']])
|
||||||
|
|
||||||
return_line = '\treturn ' if funcdef['return_type'] != 'void' else '\t'
|
return_line = '\treturn ' if funcdef['return_type'] != 'void' else '\t'
|
||||||
return_line += '_gdnative_wrapper_api_struct->' + funcname + '(' + args + ');'
|
return_line += '_gdnative_wrapper_api_struct->' + funcdef['name'] + '(' + args + ');'
|
||||||
|
|
||||||
out.append(return_line)
|
out.append(return_line)
|
||||||
out.append('}')
|
out.append('}')
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user