vrclient: Generate function types with ABI attributes.
CW-Bug-Id: #22729
This commit is contained in:
parent
5ec5ec2923
commit
f8cb502eea
1 changed files with 7 additions and 8 deletions
|
@ -341,9 +341,10 @@ def callconv(cursor, prefix):
|
||||||
|
|
||||||
tokens = cursor.get_tokens()
|
tokens = cursor.get_tokens()
|
||||||
while next(tokens).spelling != '(': pass
|
while next(tokens).spelling != '(': pass
|
||||||
token = f'{next(tokens).spelling} '
|
token = next(tokens).spelling.strip('_')
|
||||||
return token.replace('*', '__stdcall') \
|
token = token.replace('*', 'stdcall')
|
||||||
.replace('S_CALLTYPE', '__cdecl')
|
token = token.replace('S_CALLTYPE', 'cdecl')
|
||||||
|
return f'{prefix[0].upper()}_{token.upper()} '
|
||||||
|
|
||||||
|
|
||||||
def declspec_func(decl, name, prefix):
|
def declspec_func(decl, name, prefix):
|
||||||
|
@ -447,14 +448,14 @@ def handle_method_cpp(method, classname, cppname, out):
|
||||||
type_name = strip_ns(underlying_typename(param))
|
type_name = strip_ns(underlying_typename(param))
|
||||||
|
|
||||||
if param.type.kind != TypeKind.POINTER:
|
if param.type.kind != TypeKind.POINTER:
|
||||||
out(f' {declspec(param, f"lin_{name}", None).removeprefix("const ")};\n')
|
out(f' {declspec(param, f"lin_{name}", "u_").removeprefix("const ")};\n')
|
||||||
out(f' win_to_lin_struct_{param.type.spelling}_{display_sdkver(sdkver)}( ¶ms->{name}, &lin_{name} );\n')
|
out(f' win_to_lin_struct_{param.type.spelling}_{display_sdkver(sdkver)}( ¶ms->{name}, &lin_{name} );\n')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
pointee = param.type.get_pointee()
|
pointee = param.type.get_pointee()
|
||||||
if pointee.kind == TypeKind.POINTER:
|
if pointee.kind == TypeKind.POINTER:
|
||||||
need_output[name] = param
|
need_output[name] = param
|
||||||
out(f' {declspec(pointee, f"lin_{name}", None).removeprefix("const ")};\n')
|
out(f' {declspec(pointee, f"lin_{name}", "u_").removeprefix("const ")};\n')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if type_name in SDK_STRUCTS:
|
if type_name in SDK_STRUCTS:
|
||||||
|
@ -464,7 +465,7 @@ def handle_method_cpp(method, classname, cppname, out):
|
||||||
if not pointee.is_const_qualified():
|
if not pointee.is_const_qualified():
|
||||||
need_output[name] = param
|
need_output[name] = param
|
||||||
|
|
||||||
out(f' {declspec(pointee, f"lin_{name}", None).removeprefix("const ")};\n')
|
out(f' {declspec(pointee, f"lin_{name}", "u_").removeprefix("const ")};\n')
|
||||||
out(f' if (params->{name})\n')
|
out(f' if (params->{name})\n')
|
||||||
out(f' struct_{type_name}_{display_sdkver(sdkver)}_win_to_lin( params->{name}, &lin_{name} );\n')
|
out(f' struct_{type_name}_{display_sdkver(sdkver)}_win_to_lin( params->{name}, &lin_{name} );\n')
|
||||||
|
|
||||||
|
@ -504,8 +505,6 @@ def handle_method_cpp(method, classname, cppname, out):
|
||||||
if name in size_fixup: return f"lin_{name}"
|
if name in size_fixup: return f"lin_{name}"
|
||||||
if name in need_unwrap: return f'struct_{type_name}_{display_sdkver(sdkver)}_unwrap( params->{name} )'
|
if name in need_unwrap: return f'struct_{type_name}_{display_sdkver(sdkver)}_unwrap( params->{name} )'
|
||||||
if name in need_convert: return f"params->{name} ? {pfx}lin_{name} : nullptr"
|
if name in need_convert: return f"params->{name} ? {pfx}lin_{name} : nullptr"
|
||||||
if underlying_type(param.type.get_canonical()).kind is TypeKind.FUNCTIONPROTO:
|
|
||||||
return f'({declspec(param, "", None)})params->{name}'
|
|
||||||
return f'params->{name}'
|
return f'params->{name}'
|
||||||
|
|
||||||
params = [param_call(n, p) for n, p in zip(names[1:], method.get_arguments())]
|
params = [param_call(n, p) for n, p in zip(names[1:], method.get_arguments())]
|
||||||
|
|
Loading…
Reference in a new issue