mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-04-23 23:03:35 +03:00
vrclient/gen_wrapper: Introduce get_params() helper function.
This commit is contained in:
parent
d687b83fcb
commit
92f395ddd5
@ -125,8 +125,11 @@ print_sizes = []
|
|||||||
|
|
||||||
class_versions = {}
|
class_versions = {}
|
||||||
|
|
||||||
|
def get_params(f):
|
||||||
|
return [p for p in f.get_children() if p.kind == clang.cindex.CursorKind.PARM_DECL]
|
||||||
|
|
||||||
def get_param_count(f):
|
def get_param_count(f):
|
||||||
return len([p for p in f.get_children() if p.kind == clang.cindex.CursorKind.PARM_DECL])
|
return len(get_params(f))
|
||||||
|
|
||||||
def ivrclientcore_init(cppname, method):
|
def ivrclientcore_init(cppname, method):
|
||||||
if "002" in cppname:
|
if "002" in cppname:
|
||||||
@ -211,8 +214,7 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
|||||||
parambytes = 8 #_this + return pointer
|
parambytes = 8 #_this + return pointer
|
||||||
else:
|
else:
|
||||||
parambytes = 4 #_this
|
parambytes = 4 #_this
|
||||||
for param in list(method.get_children()):
|
for param in get_params(method):
|
||||||
if param.kind == clang.cindex.CursorKind.PARM_DECL:
|
|
||||||
parambytes += param.type.get_size()
|
parambytes += param.type.get_size()
|
||||||
cfile.write("DEFINE_THISCALL_WRAPPER(%s_%s, %s)\n" % (winclassname, used_name, parambytes))
|
cfile.write("DEFINE_THISCALL_WRAPPER(%s_%s, %s)\n" % (winclassname, used_name, parambytes))
|
||||||
cpp_h.write("extern ")
|
cpp_h.write("extern ")
|
||||||
@ -237,8 +239,7 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
|||||||
do_lin_to_win = None
|
do_lin_to_win = None
|
||||||
do_wrap = None
|
do_wrap = None
|
||||||
do_unwrap = None
|
do_unwrap = None
|
||||||
for param in list(method.get_children()):
|
for param in get_params(method):
|
||||||
if param.kind == clang.cindex.CursorKind.PARM_DECL:
|
|
||||||
if param.type.kind == clang.cindex.TypeKind.POINTER and \
|
if param.type.kind == clang.cindex.TypeKind.POINTER and \
|
||||||
param.type.get_pointee().kind == clang.cindex.TypeKind.UNEXPOSED:
|
param.type.get_pointee().kind == clang.cindex.TypeKind.UNEXPOSED:
|
||||||
#unspecified function pointer
|
#unspecified function pointer
|
||||||
@ -325,8 +326,7 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
|||||||
unnamed = 'a'
|
unnamed = 'a'
|
||||||
first = True
|
first = True
|
||||||
next_is_size = False
|
next_is_size = False
|
||||||
for param in list(method.get_children()):
|
for param in get_params(method):
|
||||||
if param.kind == clang.cindex.CursorKind.PARM_DECL:
|
|
||||||
if not first:
|
if not first:
|
||||||
cpp.write(", ")
|
cpp.write(", ")
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user