blob: 65726081ada141af3eb27d29ea211e5d52bbb853 [file] [log] [blame]
Kai Ninomiya7b6246a2020-01-28 23:54:38 +00001//* Copyright 2020 The Dawn Authors
2//*
3//* Licensed under the Apache License, Version 2.0 (the "License");
4//* you may not use this file except in compliance with the License.
5//* You may obtain a copy of the License at
6//*
7//* http://www.apache.org/licenses/LICENSE-2.0
8//*
9//* Unless required by applicable law or agreed to in writing, software
10//* distributed under the License is distributed on an "AS IS" BASIS,
11//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//* See the License for the specific language governing permissions and
13//* limitations under the License.
14//*
15//*
16//* This generator is used to produce part of Emscripten's struct_info.json,
17//* which is a list of struct fields that it uses to generate field offset
18//* information for its own code generators.
dan sinclairfb5a4922022-04-19 22:25:45 +000019//* https://github.com/emscripten-core/emscripten/blob/main/src/struct_info.json
Kai Ninomiya7b6246a2020-01-28 23:54:38 +000020//*
21 {
fujunwei16ae3b82021-12-15 04:35:26 +000022 {% set api = metadata.api.lower() %}
23 "file": "{api}/{api}.h",
Kai Ninomiya7b6246a2020-01-28 23:54:38 +000024 "defines": [],
25 "structs": {
Austin Eng736dd072021-12-15 18:06:36 +000026 "{{metadata.c_prefix}}ChainedStruct": [
Kai Ninomiya9da11c92020-07-15 08:57:49 +000027 "next",
Kai Ninomiya7b6246a2020-01-28 23:54:38 +000028 "sType"
29 ],
Kai Ninomiya930e9182021-09-17 19:44:43 +000030 {% for type in by_category["structure"] %}
Kai Ninomiya7b6246a2020-01-28 23:54:38 +000031 "{{as_cType(type.name)}}": [
32 {% if type.chained %}
Kai Ninomiya9da11c92020-07-15 08:57:49 +000033 "chain"
Kai Ninomiya7b6246a2020-01-28 23:54:38 +000034 {%- elif type.extensible %}
35 "nextInChain"
36 {%- endif %}
37 {% for member in type.members -%}
38 {%- if (type.chained or type.extensible) or not loop.first -%}
39 ,
40 {% endif %}
41 "{{as_varName(member.name)}}"
42 {%- endfor %}
43
44 ]
45 {%- if not loop.last -%}
46 ,
47 {% endif %}
48 {% endfor %}
49
50 }
51 }