Skip to content

Commit 7e29e7a

Browse files
authored
Move mainpage documentation to yml file (#458)
1 parent c2b2d77 commit 7e29e7a

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

gen/cheader.tmpl

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
{{- MCommentN .Copyright 0}}
22

33
/** @file */
4-
5-
/**
6-
* \mainpage
7-
*
8-
* **Important:** *This documentation is a Work In Progress.*
9-
*
10-
* This is the home of WebGPU C API specification. We define here the standard
11-
* `webgpu.h` header that all implementations should provide.
12-
*
13-
* For all details where behavior is not otherwise specified, `webgpu.h` has
14-
* the same behavior as the WebGPU specification for JavaScript on the Web.
15-
* The WebIDL-based Web specification is mapped into C as faithfully (and
16-
* bidirectionally) as practical/possible.
17-
* The working draft of WebGPU can be found at <https://www.w3.org/TR/webgpu/>.
18-
*/
4+
{{MCommentMainPage .Doc 0}}
195

206
#ifndef {{.HeaderName | ConstantCase}}_H_
217
#define {{.HeaderName | ConstantCase}}_H_

gen/gen.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ func (g *Generator) Gen(dst io.Writer) error {
2424
"MComment": func(v string, indent int) string { return Comment(v, CommentTypeMultiLine, indent, true) },
2525
"SCommentN": func(v string, indent int) string { return Comment(v, CommentTypeSingleLine, indent, false) },
2626
"MCommentN": func(v string, indent int) string { return Comment(v, CommentTypeMultiLine, indent, false) },
27+
"MCommentMainPage": func(v string, indent int) string {
28+
if v == "" || strings.TrimSpace(v) == "TODO" {
29+
return ""
30+
}
31+
return Comment("\\mainpage\n\n"+strings.TrimSpace(v), CommentTypeMultiLine, indent, true)
32+
},
2733
"MCommentEnum": func(v string, indent int, prefix string, e Enum, entryIndex int) string {
2834
if v == "" || strings.TrimSpace(v) == "TODO" {
2935
return ""

gen/yml.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
type Yml struct {
1111
Copyright string `yaml:"copyright"`
1212
Name string `yaml:"name"`
13+
Doc string `yaml:"doc"`
1314
EnumPrefix string `yaml:"enum_prefix"`
1415

1516
Constants []Constant `yaml:"constants"`

schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@
258258
"pattern": "^0x[0-9]{4}$",
259259
"description": "The dedicated enum prefix for the implementation specific header to avoid collisions"
260260
},
261+
"doc": {
262+
"type": "string"
263+
},
261264
"typedefs": {
262265
"type": "array",
263266
"items": {
@@ -514,6 +517,7 @@
514517
"copyright",
515518
"name",
516519
"enum_prefix",
520+
"doc",
517521
"constants",
518522
"typedefs",
519523
"enums",

webgpu.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ copyright: |
44
SPDX-License-Identifier: BSD-3-Clause
55
name: webgpu
66
enum_prefix: '0x0000'
7+
doc: |
8+
**Important:** *This documentation is a Work In Progress.*
9+
10+
This is the home of WebGPU C API specification. We define here the standard
11+
`webgpu.h` header that all implementations should provide.
12+
13+
For all details where behavior is not otherwise specified, `webgpu.h` has
14+
the same behavior as the WebGPU specification for JavaScript on the Web.
15+
The WebIDL-based Web specification is mapped into C as faithfully (and
16+
bidirectionally) as practical/possible.
17+
The working draft of WebGPU can be found at <https://www.w3.org/TR/webgpu/>.
718
constants:
819
- name: array_layer_count_undefined
920
value: uint32_max

0 commit comments

Comments
 (0)