Kai Ninomiya | 7b6246a | 2020-01-28 23:54:38 +0000 | [diff] [blame] | 1 | //* 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 sinclair | fb5a492 | 2022-04-19 22:25:45 +0000 | [diff] [blame] | 19 | //* https://github.com/emscripten-core/emscripten/blob/main/src/struct_info.json |
Kai Ninomiya | 7b6246a | 2020-01-28 23:54:38 +0000 | [diff] [blame] | 20 | //* |
| 21 | { |
fujunwei | 16ae3b8 | 2021-12-15 04:35:26 +0000 | [diff] [blame] | 22 | {% set api = metadata.api.lower() %} |
| 23 | "file": "{api}/{api}.h", |
Kai Ninomiya | 7b6246a | 2020-01-28 23:54:38 +0000 | [diff] [blame] | 24 | "defines": [], |
| 25 | "structs": { |
Austin Eng | 736dd07 | 2021-12-15 18:06:36 +0000 | [diff] [blame] | 26 | "{{metadata.c_prefix}}ChainedStruct": [ |
Kai Ninomiya | 9da11c9 | 2020-07-15 08:57:49 +0000 | [diff] [blame] | 27 | "next", |
Kai Ninomiya | 7b6246a | 2020-01-28 23:54:38 +0000 | [diff] [blame] | 28 | "sType" |
| 29 | ], |
Kai Ninomiya | 930e918 | 2021-09-17 19:44:43 +0000 | [diff] [blame] | 30 | {% for type in by_category["structure"] %} |
Kai Ninomiya | 7b6246a | 2020-01-28 23:54:38 +0000 | [diff] [blame] | 31 | "{{as_cType(type.name)}}": [ |
| 32 | {% if type.chained %} |
Kai Ninomiya | 9da11c9 | 2020-07-15 08:57:49 +0000 | [diff] [blame] | 33 | "chain" |
Kai Ninomiya | 7b6246a | 2020-01-28 23:54:38 +0000 | [diff] [blame] | 34 | {%- 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 | } |