From c317058f02352bc0d1390a30cdac1d00e77ff29f Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Sun, 23 Feb 2020 20:09:53 -0800 Subject: [PATCH] Move function pointer type defs down next to their related members --- generate_protos.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/generate_protos.py b/generate_protos.py index 45b5dc2..2a486af 100755 --- a/generate_protos.py +++ b/generate_protos.py @@ -25,18 +25,9 @@ namespace uefi { namespace protos { struct {{ name }}; -namespace {{ name }}_impl { -{%- for method in methods %} - using {{ method.name }} = uefi::status (*)( - {%- if not method.get("skip_this", false) -%}uefi::protos::{{ name }} *{%- endif -%} - {%- if not method.get("skip_this", false) and method.args %}, {% endif -%} - {{ method.args|join(', ', attribute='type') }}); -{%- endfor %} -} // namespace {{ name }}_impl - struct {{ name }} { - static constexpr uefi::guid guid{ {{ guid }} }; + {% if guid %}static constexpr uefi::guid guid{ {{ guid }} };{% endif %} {% for method in methods %} inline uefi::status {{ method.name }}( {%- for arg in method.args -%} @@ -55,9 +46,12 @@ struct {{ name }} protected: {%- for method in methods %} - {{ name }}_impl::{{ method.name }} _{{ method.name }}; -{%- endfor %} - + using _{{ method.name }}_def = uefi::status (*)( + {%- if not method.get("skip_this", false) -%}uefi::protos::{{ name }} *{%- endif -%} + {%- if not method.get("skip_this", false) and method.args %}, {% endif -%} + {{ method.args|join(', ', attribute='type') }}); + _{{ method.name }}_def _{{ method.name }}; +{% endfor %} public: {%- for datum in post_data %} {{ datum.type }} {{ datum.name }};