Index: mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
diff --git a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
index d5bff304836aec1b0708ab6752a9a35e28a1f2c2..e0dd27f35cb8e3a16e265f6e30e47d53f7b5c607 100644 |
--- a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
+++ b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
@@ -1,4 +1,5 @@ |
{% from "module_macros.tmpl" import enum_values %} |
+{% from "module_macros.tmpl" import struct_descriptor %} |
# Copyright 2014 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
@@ -18,39 +19,39 @@ import {{import.python_module}} |
{{constant|name}} = {{constant.value|expression_to_text}} |
{% endfor %} |
{% endif %} |
-{% for enum in module.enums %} |
+{% for enum in enums %} |
class {{enum|name}}(object): |
__metaclass__ = _reflection.MojoEnumType |
VALUES = {{enum_values(enum)|indent(2)}} |
{% endfor %} |
-{% for struct in module.structs %} |
+{% for struct in structs %} |
class {{struct|name}}(object): |
__metaclass__ = _reflection.MojoStructType |
+ DESCRIPTOR = {{struct_descriptor(struct)|indent(2)}} |
+{% endfor %} |
+{% for interface in interfaces %} |
+ |
+class {{interface|name}}(object): |
+ __metaclass__ = _reflection.MojoInterfaceType |
DESCRIPTOR = { |
-{% if struct.constants %} |
- 'constants': { |
-{% for constant in struct.constants %} |
- '{{constant|name}}': {{constant.value|expression_to_text}}, |
-{% endfor %} |
- }, |
-{% endif %} |
-{% if struct.enums %} |
- 'enums': { |
-{% for enum in struct.enums %} |
- '{{enum|name}}': {{enum_values(enum)|indent(6)}}, |
-{% endfor %} |
- }, |
-{% endif %} |
-{% if struct.fields %} |
- 'fields': [ |
-{% for byte in struct.bytes %} |
-{% if byte.packed_fields %} |
- {{byte|field_group}}, |
-{% endif %} |
-{% endfor %} |
+{% if interface.client %} |
+ 'client': {{interface.qualified_client|fully_qualified_name}}, |
+{% endif %} |
+ 'methods': [ |
+{% for method in interface.methods %} |
+ { |
+ 'name': '{{method|name}}', |
+ 'ordinal': {{method.ordinal}}, |
+{% set request_struct = method|struct_from_method %} |
+ 'parameters': {{struct_descriptor(request_struct)|indent(8)}}, |
+{% if method.response_parameters != None %} |
+{% set response_struct = method|response_struct_from_method %} |
+ 'responses': {{struct_descriptor(response_struct)|indent(8)}}, |
+{% endif %} |
+ }, |
+{% endfor %} |
], |
-{% endif %} |
} |
{% endfor %} |