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

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

Issue 2072903002: C bindings pt3: Type table definitions and barebones files to get generated code to compile. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: elem_table -> elem_descriptor 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 c20d7e8edebda9a20ab5753eae67d93244eb3ff2..5d62866e2923a200c2483f0d963c0d78ffd26f10 100644
--- a/mojom/generators/c/templates/type_table.tmpl.go
+++ b/mojom/generators/c/templates/type_table.tmpl.go
@@ -9,12 +9,14 @@ package templates
// refer to them.
const GenerateTypeTableDeclarations = `
{{define "GenerateTypeTableDeclarations"}}
+// Union type table declarations.
{{range $union := .PublicUnionNames -}}
-extern struct MojomPointerTableUnionEntry {{$union}}[];
-{{end}}
+extern struct MojomTypeDescriptorUnion {{$union}};
+{{end -}}
+// Struct type table declarations.
{{range $struct := .PublicStructNames -}}
-extern struct MojomPointerTableStructEntry {{$struct}}[];
+extern struct MojomTypeDescriptorStruct {{$struct}};
{{end -}}
{{end}}
`
@@ -23,49 +25,56 @@ const GenerateTypeTableDefinitions = `
{{define "GenerateTypeTableDefinitions"}}
// Declarations for array type entries.
{{range $array := .Arrays -}}
-static struct MojomPointerTableArrayEntry {{$array.Name}};
+static struct MojomTypeDescriptorArray {{$array.Name}};
{{end -}}
// Declarations for struct type tables.
{{range $struct := .Structs -}}
-struct MojomPointerTableStructEntry {{$struct.Name}}[];
+struct MojomTypeDescriptorStruct {{$struct.Name}};
{{end -}}
// Declarations for union type tables.
{{range $union := .Unions -}}
-struct MojomPointerTableUnionEntry {{$union.Name}}[];
+struct MojomTypeDescriptorUnion {{$union.Name}};
{{end -}}
// Array type entry definitions.
{{range $array := .Arrays -}}
-static struct MojomPointerTableArrayEntry {{$array.Name}} = {
- {{$array.ElemTable}}, {{$array.NumElements}},
- {{$array.ElemType}}, {{$array.Nullable}},
+static struct MojomTypeDescriptorArray {{$array.Name}} = {
+ {{$array.ElemType}}, {{$array.ElemTable}},
+ {{$array.NumElements}}, {{$array.Nullable}},
};
{{end -}}
// Struct type table definitions.
{{range $struct := .Structs -}}
-struct MojomPointerTableStructEntry {{$struct.Name}}[] = {
+struct MojomTypeDescriptorStructEntry {{$struct.Name}}_Entries[] = {
{{- range $entry := $struct.Entries}}
{
- {{$entry.ElemTable}}, {{$entry.Offset}}, {{$entry.MinVersion}},
- {{$entry.ElemType}}, {{$entry.Nullable}}, {{$entry.KeepGoing}},
+ {{$entry.ElemType}}, {{$entry.ElemTable}},
+ {{$entry.Offset}}, {{$entry.MinVersion}},
+ {{$entry.Nullable}},
},
{{end -}}
};
+struct MojomTypeDescriptorStruct {{$struct.Name}} = {
+ {{len $struct.Entries}}ul, {{$struct.Name}}_Entries,
+};
{{end -}}
// Union type table definitions.
{{range $union := .Unions -}}
-struct MojomPointerTableUnionEntry {{$union.Name}}[] = {
+struct MojomTypeDescriptorUnionEntry {{$union.Name}}_Entries[] = {
{{- range $entry := $union.Entries}}
{
- {{$entry.ElemTable}}, {{$entry.Tag}}, {{$entry.ElemType}},
- {{$entry.Nullable}}, {{$entry.KeepGoing}},
+ {{$entry.ElemType}}, {{$entry.ElemTable}},
+ {{$entry.Tag}}, {{$entry.Nullable}},
},
{{end -}}
};
+struct MojomTypeDescriptorUnion {{$union.Name}} = {
+ {{len $union.Entries}}ul, {{$union.Name}}_Entries,
+};
{{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