| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package templates | 5 package templates |
| 6 | 6 |
| 7 const GenerateSourceFile = ` | 7 const GenerateSourceFile = ` |
| 8 {{- define "GenerateSourceFile" -}} | 8 {{- define "GenerateSourceFile" -}} |
| 9 // This file was auto-generated by the C bindings generator. | 9 // This file was auto-generated by the C bindings generator. |
| 10 | 10 |
| 11 #include "{{.HeaderFile}}" | 11 #include "{{.HeaderFile}}" |
| 12 | 12 |
| 13 #include <mojo/bindings/internal/type_descriptor.h> |
| 13 #include <mojo/system/handle.h> | 14 #include <mojo/system/handle.h> |
| 14 #include <stdbool.h> | 15 #include <stdbool.h> |
| 15 | 16 |
| 16 #include "mojo/public/c/bindings/lib/type_descriptor.h" | |
| 17 | |
| 18 // Imports. | 17 // Imports. |
| 19 {{range $import := .Imports -}} | 18 {{range $import := .Imports -}} |
| 20 #include "{{$import}}" | 19 #include "{{$import}}" |
| 21 {{end}} | 20 {{end}} |
| 22 | 21 |
| 23 // Type tables definitions for structs, arrays and unions. | 22 // Type tables definitions for structs, arrays and unions. |
| 24 {{template "GenerateTypeTableDefinitions" .TypeTable}} | 23 {{template "GenerateTypeTableDefinitions" .TypeTable}} |
| 25 | 24 |
| 26 // Definitions for constants. | 25 // Definitions for constants. |
| 27 // Top level constants: | 26 // Top level constants: |
| 28 {{range $const := .Constants -}} | 27 {{range $const := .Constants -}} |
| 29 const {{$const.Type}} {{$const.Name}} = {{$const.Value}}; | 28 const {{$const.Type}} {{$const.Name}} = {{$const.Value}}; |
| 30 {{end -}} | 29 {{end -}} |
| 31 | 30 |
| 32 // Struct definitions. | 31 // Struct definitions. |
| 33 {{range $struct := .Structs -}} | 32 {{range $struct := .Structs -}} |
| 34 {{template "GenerateStructDefinitions" $struct}} | 33 {{template "GenerateStructDefinitions" $struct}} |
| 35 {{end -}} | 34 {{end -}} |
| 36 | 35 |
| 37 // Interface definitions. | 36 // Interface definitions. |
| 38 {{range $interface := .Interfaces -}} | 37 {{range $interface := .Interfaces -}} |
| 39 {{template "GenerateInterfaceDefinitions" $interface}} | 38 {{template "GenerateInterfaceDefinitions" $interface}} |
| 40 {{end -}} | 39 {{end -}} |
| 41 | 40 |
| 42 {{end}} | 41 {{end}} |
| 43 ` | 42 ` |
| OLD | NEW |