Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: mojom/generators/c/templates/type_table.tmpl.go

Issue 2074923002: Mojom C Generator: Small fixes to get generated C bindings to compile. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojom/generators/c/templates/source.tmpl.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/generators/c/templates/type_table.tmpl.go
diff --git a/mojom/generators/c/templates/type_table.tmpl.go b/mojom/generators/c/templates/type_table.tmpl.go
index c8cbe538d906e6d94c1a329309305c07678e82a9..c20d7e8edebda9a20ab5753eae67d93244eb3ff2 100644
--- a/mojom/generators/c/templates/type_table.tmpl.go
+++ b/mojom/generators/c/templates/type_table.tmpl.go
@@ -4,6 +4,9 @@
package templates
+// These declarations go in the header file so that we can avoid some
+// circular-dependencies. We call these "public" to say that other types can
+// refer to them.
const GenerateTypeTableDeclarations = `
{{define "GenerateTypeTableDeclarations"}}
{{range $union := .PublicUnionNames -}}
@@ -18,34 +21,52 @@ extern struct MojomPointerTableStructEntry {{$struct}}[];
const GenerateTypeTableDefinitions = `
{{define "GenerateTypeTableDefinitions"}}
+// Declarations for array type entries.
{{range $array := .Arrays -}}
-static struct MojomPointerTableArrayEntry {{$array.Name}} = {
- {{$array.ElemTable}}, {{$array.NumElements}}, {{$array.Nullable}},
- {{$array.ElemType}},
-};
+static struct MojomPointerTableArrayEntry {{$array.Name}};
+{{end -}}
+
+// Declarations for struct type tables.
+{{range $struct := .Structs -}}
+struct MojomPointerTableStructEntry {{$struct.Name}}[];
{{end -}}
+// Declarations for union type tables.
{{range $union := .Unions -}}
-struct MojomPointerTableUnionEntry {{$union.Name}}[] = {
-{{- range $entry := $union.Entries}}
- {
- {{$entry.ElemTable}}, {{$entry.Tag}},
- {{$entry.Nullable}}, {{$entry.ElemType}}, {{$entry.KeepGoing}},
- },
+struct MojomPointerTableUnionEntry {{$union.Name}}[];
{{end -}}
+
+// Array type entry definitions.
+{{range $array := .Arrays -}}
+static struct MojomPointerTableArrayEntry {{$array.Name}} = {
+ {{$array.ElemTable}}, {{$array.NumElements}},
+ {{$array.ElemType}}, {{$array.Nullable}},
};
-{{end}}
+{{end -}}
+// Struct type table definitions.
{{range $struct := .Structs -}}
struct MojomPointerTableStructEntry {{$struct.Name}}[] = {
{{- range $entry := $struct.Entries}}
{
- {{$entry.ElemTable}}, {{$entry.Offset}},
- {{$entry.Nullable}}, {{$entry.ElemType}}, {{$entry.KeepGoing}},
+ {{$entry.ElemTable}}, {{$entry.Offset}}, {{$entry.MinVersion}},
+ {{$entry.ElemType}}, {{$entry.Nullable}}, {{$entry.KeepGoing}},
},
{{end -}}
};
{{end -}}
+// Union type table definitions.
+{{range $union := .Unions -}}
+struct MojomPointerTableUnionEntry {{$union.Name}}[] = {
+{{- range $entry := $union.Entries}}
+ {
+ {{$entry.ElemTable}}, {{$entry.Tag}}, {{$entry.ElemType}},
+ {{$entry.Nullable}}, {{$entry.KeepGoing}},
+ },
+{{end -}}
+};
+{{end}}
+
{{end}}
`
« no previous file with comments | « mojom/generators/c/templates/source.tmpl.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698