Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 1 | //* Copyright 2020 The Dawn & Tint Authors |
Shrek Shao | d7304d1 | 2021-12-14 01:06:15 +0000 | [diff] [blame] | 2 | //* |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 3 | //* Redistribution and use in source and binary forms, with or without |
| 4 | //* modification, are permitted provided that the following conditions are met: |
Shrek Shao | d7304d1 | 2021-12-14 01:06:15 +0000 | [diff] [blame] | 5 | //* |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 6 | //* 1. Redistributions of source code must retain the above copyright notice, this |
| 7 | //* list of conditions and the following disclaimer. |
Shrek Shao | d7304d1 | 2021-12-14 01:06:15 +0000 | [diff] [blame] | 8 | //* |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 9 | //* 2. Redistributions in binary form must reproduce the above copyright notice, |
| 10 | //* this list of conditions and the following disclaimer in the documentation |
| 11 | //* and/or other materials provided with the distribution. |
Corentin Wallez | 1bf3167 | 2020-01-15 15:39:12 +0000 | [diff] [blame] | 12 | //* |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 13 | //* 3. Neither the name of the copyright holder nor the names of its |
| 14 | //* contributors may be used to endorse or promote products derived from |
| 15 | //* this software without specific prior written permission. |
Corentin Wallez | 1bf3167 | 2020-01-15 15:39:12 +0000 | [diff] [blame] | 16 | //* |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 17 | //* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | //* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | //* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | //* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 21 | //* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | //* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 23 | //* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 24 | //* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | //* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | //* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Corentin Wallez | 1bf3167 | 2020-01-15 15:39:12 +0000 | [diff] [blame] | 27 | //* |
| 28 | //* |
Shrek Shao | d7304d1 | 2021-12-14 01:06:15 +0000 | [diff] [blame] | 29 | {% include 'BSD_LICENSE' %} |
Shrek Shao | 71a363b | 2022-02-09 19:42:51 +0000 | [diff] [blame] | 30 | {% if 'dawn' in enabled_tags %} |
| 31 | #ifdef __EMSCRIPTEN__ |
| 32 | #error "Do not include this header. Emscripten already provides headers needed for {{metadata.api}}." |
| 33 | #endif |
| 34 | {% endif %} |
fujunwei | 76bda37 | 2021-11-23 08:47:35 +0000 | [diff] [blame] | 35 | #ifndef {{metadata.api.upper()}}_H_ |
| 36 | #define {{metadata.api.upper()}}_H_ |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 37 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 38 | {% set API = metadata.c_prefix %} |
| 39 | #if defined({{API}}_SHARED_LIBRARY) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 40 | # if defined(_WIN32) |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 41 | # if defined({{API}}_IMPLEMENTATION) |
| 42 | # define {{API}}_EXPORT __declspec(dllexport) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 43 | # else |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 44 | # define {{API}}_EXPORT __declspec(dllimport) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 45 | # endif |
| 46 | # else // defined(_WIN32) |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 47 | # if defined({{API}}_IMPLEMENTATION) |
| 48 | # define {{API}}_EXPORT __attribute__((visibility("default"))) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 49 | # else |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 50 | # define {{API}}_EXPORT |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 51 | # endif |
| 52 | # endif // defined(_WIN32) |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 53 | #else // defined({{API}}_SHARED_LIBRARY) |
| 54 | # define {{API}}_EXPORT |
| 55 | #endif // defined({{API}}_SHARED_LIBRARY) |
| 56 | |
| 57 | #if !defined({{API}}_OBJECT_ATTRIBUTE) |
| 58 | #define {{API}}_OBJECT_ATTRIBUTE |
| 59 | #endif |
| 60 | #if !defined({{API}}_ENUM_ATTRIBUTE) |
| 61 | #define {{API}}_ENUM_ATTRIBUTE |
| 62 | #endif |
| 63 | #if !defined({{API}}_STRUCTURE_ATTRIBUTE) |
| 64 | #define {{API}}_STRUCTURE_ATTRIBUTE |
| 65 | #endif |
| 66 | #if !defined({{API}}_FUNCTION_ATTRIBUTE) |
| 67 | #define {{API}}_FUNCTION_ATTRIBUTE |
| 68 | #endif |
| 69 | #if !defined({{API}}_NULLABLE) |
| 70 | #define {{API}}_NULLABLE |
| 71 | #endif |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 72 | |
| 73 | #include <stdint.h> |
| 74 | #include <stddef.h> |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 75 | |
Corentin Wallez | 4910ae7 | 2024-04-18 16:55:19 +0000 | [diff] [blame] | 76 | #define WGPU_BREAKING_REFERENCE_ADDREF |
| 77 | |
Austin Eng | 58213ae | 2024-04-30 06:15:26 +0000 | [diff] [blame^] | 78 | #if defined(__cplusplus) |
| 79 | # if __cplusplus >= 201103L |
| 80 | # define {{API}}_MAKE_INIT_STRUCT(type, value) (type value) |
| 81 | # else |
| 82 | # define {{API}}_MAKE_INIT_STRUCT(type, value) value |
| 83 | # endif |
| 84 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 85 | # define {{API}}_MAKE_INIT_STRUCT(type, value) ((type) value) |
| 86 | #else |
| 87 | # define {{API}}_MAKE_INIT_STRUCT(type, value) value |
| 88 | #endif |
| 89 | |
fujunwei | 4e87690 | 2021-11-25 08:44:01 +0000 | [diff] [blame] | 90 | {% for constant in by_category["constant"] %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 91 | #define {{API}}_{{constant.name.SNAKE_CASE()}} {{constant.value}} |
fujunwei | 4e87690 | 2021-11-25 08:44:01 +0000 | [diff] [blame] | 92 | {% endfor %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 93 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 94 | typedef uint32_t {{API}}Flags; |
Loko Kung | 440a30c | 2023-08-04 23:41:21 +0000 | [diff] [blame] | 95 | typedef uint32_t {{API}}Bool; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 96 | |
| 97 | {% for type in by_category["object"] %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 98 | typedef struct {{as_cType(type.name)}}Impl* {{as_cType(type.name)}} {{API}}_OBJECT_ATTRIBUTE; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 99 | {% endfor %} |
| 100 | |
Brandon Jones | 112b7fd | 2023-05-17 01:52:30 +0000 | [diff] [blame] | 101 | // Structure forward declarations |
| 102 | {% for type in by_category["structure"] %} |
| 103 | struct {{as_cType(type.name)}}; |
| 104 | {% endfor %} |
| 105 | |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 106 | {% for type in by_category["enum"] + by_category["bitmask"] %} |
| 107 | typedef enum {{as_cType(type.name)}} { |
| 108 | {% for value in type.values %} |
| 109 | {{as_cEnum(type.name, value.name)}} = 0x{{format(value.value, "08X")}}, |
| 110 | {% endfor %} |
| 111 | {{as_cEnum(type.name, Name("force32"))}} = 0x7FFFFFFF |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 112 | } {{as_cType(type.name)}} {{API}}_ENUM_ATTRIBUTE; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 113 | {% if type.category == "bitmask" %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 114 | typedef {{API}}Flags {{as_cType(type.name)}}Flags {{API}}_ENUM_ATTRIBUTE; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 115 | {% endif %} |
| 116 | |
Kai Ninomiya | 930e918 | 2021-09-17 19:44:43 +0000 | [diff] [blame] | 117 | {% endfor -%} |
Brandon Jones | 112b7fd | 2023-05-17 01:52:30 +0000 | [diff] [blame] | 118 | {% for type in by_category["function pointer"] %} |
| 119 | typedef {{as_cType(type.return_type.name)}} (*{{as_cType(type.name)}})( |
| 120 | {%- if type.arguments == [] -%} |
| 121 | void |
| 122 | {%- else -%} |
| 123 | {%- for arg in type.arguments -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 124 | {% if not loop.first %}, {% endif %} |
| 125 | {% if arg.type.category == "structure" %}struct {% endif %}{{as_annotated_cType(arg)}} |
Brandon Jones | 112b7fd | 2023-05-17 01:52:30 +0000 | [diff] [blame] | 126 | {%- endfor -%} |
| 127 | {%- endif -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 128 | ) {{API}}_FUNCTION_ATTRIBUTE; |
Brandon Jones | 112b7fd | 2023-05-17 01:52:30 +0000 | [diff] [blame] | 129 | {% endfor %} |
| 130 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 131 | typedef struct {{API}}ChainedStruct { |
| 132 | struct {{API}}ChainedStruct const * next; |
| 133 | {{API}}SType sType; |
| 134 | } {{API}}ChainedStruct {{API}}_STRUCTURE_ATTRIBUTE; |
Corentin Wallez | 2b24c3d | 2020-01-15 09:54:42 +0000 | [diff] [blame] | 135 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 136 | typedef struct {{API}}ChainedStructOut { |
| 137 | struct {{API}}ChainedStructOut * next; |
| 138 | {{API}}SType sType; |
| 139 | } {{API}}ChainedStructOut {{API}}_STRUCTURE_ATTRIBUTE; |
Austin Eng | bffc966 | 2021-09-17 15:36:00 +0000 | [diff] [blame] | 140 | |
Austin Eng | 58213ae | 2024-04-30 06:15:26 +0000 | [diff] [blame^] | 141 | {% macro render_c_default_value(member) -%} |
| 142 | {%- if member.annotation in ["*", "const*"] and member.optional or member.default_value == "nullptr" -%} |
| 143 | nullptr |
| 144 | {%- elif member.type.category == "object" and member.optional -%} |
| 145 | nullptr |
| 146 | {%- elif member.type.category in ["enum", "bitmask"] and member.default_value != None -%} |
| 147 | {{as_cEnum(member.type.name, Name(member.default_value))}} |
| 148 | {%- elif member.default_value != None -%} |
| 149 | {{member.default_value}} |
| 150 | {%- elif member.type.category == "structure" and member.annotation == "value" -%} |
| 151 | {{API}}_{{member.type.name.SNAKE_CASE()}}_INIT |
| 152 | {%- else -%} |
| 153 | {{- assert(member.json_data.get("no_default", false) == false) -}} |
| 154 | {{- assert(member.default_value == None) -}} |
| 155 | {} |
| 156 | {%- endif -%} |
| 157 | {% endmacro %} |
| 158 | |
| 159 | #define {{API}}_COMMA , |
| 160 | |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 161 | {% for type in by_category["structure"] %} |
Corentin Wallez | a45561b | 2022-07-14 12:58:25 +0000 | [diff] [blame] | 162 | {% for root in type.chain_roots %} |
| 163 | // Can be chained in {{as_cType(root.name)}} |
| 164 | {% endfor %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 165 | typedef struct {{as_cType(type.name)}} { |
Austin Eng | bffc966 | 2021-09-17 15:36:00 +0000 | [diff] [blame] | 166 | {% set Out = "Out" if type.output else "" %} |
Kai Ninomiya | 7d174a1 | 2021-09-21 17:36:27 +0000 | [diff] [blame] | 167 | {% set const = "const " if not type.output else "" %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 168 | {% if type.extensible %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 169 | {{API}}ChainedStruct{{Out}} {{const}}* nextInChain; |
Corentin Wallez | 2b24c3d | 2020-01-15 09:54:42 +0000 | [diff] [blame] | 170 | {% endif %} |
| 171 | {% if type.chained %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 172 | {{API}}ChainedStruct{{Out}} chain; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 173 | {% endif %} |
| 174 | {% for member in type.members %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 175 | {% if member.optional %} |
| 176 | {{API}}_NULLABLE {{as_annotated_cType(member)}}; |
| 177 | {% else %} |
| 178 | {{as_annotated_cType(member)}}; |
| 179 | {% endif-%} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 180 | {% endfor %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 181 | } {{as_cType(type.name)}} {{API}}_STRUCTURE_ATTRIBUTE; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 182 | |
Austin Eng | 58213ae | 2024-04-30 06:15:26 +0000 | [diff] [blame^] | 183 | #define {{API}}_{{type.name.SNAKE_CASE()}}_INIT {{API}}_MAKE_INIT_STRUCT({{as_cType(type.name)}}, { \ |
| 184 | {% if type.extensible %} |
| 185 | /*.nextInChain=*/nullptr {{API}}_COMMA \ |
| 186 | {% endif %} |
| 187 | {% if type.chained %} |
| 188 | /*.chain=*/{} {{API}}_COMMA \ |
| 189 | {% endif %} |
| 190 | {% for member in type.members %} |
| 191 | /*.{{as_varName(member.name)}}=*/{{render_c_default_value(member)}} {{API}}_COMMA \ |
| 192 | {% endfor %} |
| 193 | }) |
| 194 | |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 195 | {% endfor %} |
Brandon Jones | 58a471a | 2021-02-08 19:48:06 +0000 | [diff] [blame] | 196 | {% for typeDef in by_category["typedef"] %} |
| 197 | // {{as_cType(typeDef.name)}} is deprecated. |
| 198 | // Use {{as_cType(typeDef.type.name)}} instead. |
| 199 | typedef {{as_cType(typeDef.type.name)}} {{as_cType(typeDef.name)}}; |
| 200 | |
| 201 | {% endfor %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 202 | #ifdef __cplusplus |
| 203 | extern "C" { |
| 204 | #endif |
| 205 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 206 | #if !defined({{API}}_SKIP_PROCS) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 207 | |
fujunwei | 23f7162 | 2021-12-02 07:41:21 +0000 | [diff] [blame] | 208 | {% for function in by_category["function"] %} |
| 209 | typedef {{as_cType(function.return_type.name)}} (*{{as_cProc(None, function.name)}})( |
| 210 | {%- for arg in function.arguments -%} |
| 211 | {% if not loop.first %}, {% endif %}{{as_annotated_cType(arg)}} |
| 212 | {%- endfor -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 213 | ) {{API}}_FUNCTION_ATTRIBUTE; |
fujunwei | 23f7162 | 2021-12-02 07:41:21 +0000 | [diff] [blame] | 214 | {% endfor %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 215 | |
Corentin Wallez | aca8c4a | 2019-11-22 14:02:52 +0000 | [diff] [blame] | 216 | {% for type in by_category["object"] if len(c_methods(type)) > 0 %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 217 | // Procs of {{type.name.CamelCase()}} |
Corentin Wallez | aca8c4a | 2019-11-22 14:02:52 +0000 | [diff] [blame] | 218 | {% for method in c_methods(type) %} |
Loko Kung | cd16294 | 2023-06-01 19:03:05 +0000 | [diff] [blame] | 219 | typedef {{as_cReturnType(method.return_type)}} (*{{as_cProc(type.name, method.name)}})( |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 220 | {{-as_cType(type.name)}} {{as_varName(type.name)}} |
| 221 | {%- for arg in method.arguments -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 222 | ,{{" "}} |
| 223 | {%- if arg.optional %}{{API}}_NULLABLE {% endif -%} |
| 224 | {{as_annotated_cType(arg)}} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 225 | {%- endfor -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 226 | ) {{API}}_FUNCTION_ATTRIBUTE; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 227 | {% endfor %} |
| 228 | |
| 229 | {% endfor %} |
Austin Eng | 643625a | 2023-08-09 00:59:33 +0000 | [diff] [blame] | 230 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 231 | #endif // !defined({{API}}_SKIP_PROCS) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 232 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 233 | #if !defined({{API}}_SKIP_DECLARATIONS) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 234 | |
fujunwei | 23f7162 | 2021-12-02 07:41:21 +0000 | [diff] [blame] | 235 | {% for function in by_category["function"] %} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 236 | {{API}}_EXPORT {{as_cType(function.return_type.name)}} {{as_cMethod(None, function.name)}}( |
fujunwei | 23f7162 | 2021-12-02 07:41:21 +0000 | [diff] [blame] | 237 | {%- for arg in function.arguments -%} |
Kai Ninomiya | be98f27 | 2023-09-11 20:47:26 +0000 | [diff] [blame] | 238 | {% if not loop.first %}, {% endif -%} |
| 239 | {%- if arg.optional %}{{API}}_NULLABLE {% endif -%} |
| 240 | {{as_annotated_cType(arg)}} |
fujunwei | 23f7162 | 2021-12-02 07:41:21 +0000 | [diff] [blame] | 241 | {%- endfor -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 242 | ) {{API}}_FUNCTION_ATTRIBUTE; |
fujunwei | 23f7162 | 2021-12-02 07:41:21 +0000 | [diff] [blame] | 243 | {% endfor %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 244 | |
Corentin Wallez | aca8c4a | 2019-11-22 14:02:52 +0000 | [diff] [blame] | 245 | {% for type in by_category["object"] if len(c_methods(type)) > 0 %} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 246 | // Methods of {{type.name.CamelCase()}} |
Corentin Wallez | aca8c4a | 2019-11-22 14:02:52 +0000 | [diff] [blame] | 247 | {% for method in c_methods(type) %} |
Loko Kung | cd16294 | 2023-06-01 19:03:05 +0000 | [diff] [blame] | 248 | {{API}}_EXPORT {{as_cReturnType(method.return_type)}} {{as_cMethod(type.name, method.name)}}( |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 249 | {{-as_cType(type.name)}} {{as_varName(type.name)}} |
| 250 | {%- for arg in method.arguments -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 251 | ,{{" "}} |
| 252 | {%- if arg.optional %}{{API}}_NULLABLE {% endif -%} |
| 253 | {{as_annotated_cType(arg)}} |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 254 | {%- endfor -%} |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 255 | ) {{API}}_FUNCTION_ATTRIBUTE; |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 256 | {% endfor %} |
| 257 | |
| 258 | {% endfor %} |
Austin Eng | 643625a | 2023-08-09 00:59:33 +0000 | [diff] [blame] | 259 | |
Corentin Wallez | 8d45d44 | 2023-05-23 08:16:55 +0000 | [diff] [blame] | 260 | #endif // !defined({{API}}_SKIP_DECLARATIONS) |
Corentin Wallez | 2c8b5c6 | 2019-10-21 20:04:10 +0000 | [diff] [blame] | 261 | |
| 262 | #ifdef __cplusplus |
| 263 | } // extern "C" |
| 264 | #endif |
| 265 | |
fujunwei | 76bda37 | 2021-11-23 08:47:35 +0000 | [diff] [blame] | 266 | #endif // {{metadata.api.upper()}}_H_ |