1
0

refactor: basically finish ExpFctsRender

This commit is contained in:
2026-01-28 16:19:59 +08:00
parent 69ac25a70b
commit 29d98edbdc
5 changed files with 299 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
{%- for fct in payload.fcts %}
/// <summary>{{ fct.fct_name }}</summary>
{%- for param in fct.fct_params %}
/// <param name="{{ param.var_name }}">Direction: {% if param.is_input -%} input {%- else -%} output {%- endif %}. C++ type: {{ param.var_type.to_c_type() }}. {{ param.var_desc }}</param>
{%- endfor %}
/// <returns>True if no error, otherwise False.</returns>
[DllImport(g_DllName, EntryPoint = "{{ fct.fct_name }}", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.U1)]
internal static extern bool {{ fct.fct_name }}(
{%- for param in fct.fct_params -%}
{%- set param_cs_interop_type = utils.get_cs_interop_type(param) -%}
[{% if param.is_input -%} In {%- else -%} Out {%- endif %}, MarshalAs({{ param_cs_interop_type.marshal_as }})] {% if not param.is_input %}out {% endif %} {{- param_cs_interop_type.cs_type }} {{ param.var_name }}
{%- if not loop.last %}, {% endif %}
{%- endfor -%}
);
{%- endfor %}

View File

@@ -0,0 +1,17 @@
{%- for fct in payload.fcts %}
{{ fct.fct_name }} = _create_bmap_func('{{ fct.fct_name }}', [
{%- for param in fct.fct_params %}
{{- utils.get_python_type(param) }}
{%- if not loop.last %}, {% endif %}
{%- endfor -%}
])
"""
{{ fct.fct_name }}
{% for param in fct.fct_params %}
:param {{ param.var_name }}: Direction: {% if param.is_input -%} input {%- else -%} output {%- endif %}. {{ param.var_desc }}
:type {{ param.var_name }}: {{ utils.get_python_type(param) }} ({{ param.var_type.to_c_type() }} in C++). {% if param.is_input -%} Use ctypes.byref() pass it. {%- endif %}
{%- endfor %}
:return: True if no error, otherwise False.
:rtype: bool
"""
{%- endfor %}