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 e0dd27f35cb8e3a16e265f6e30e47d53f7b5c607..d5bff304836aec1b0708ab6752a9a35e28a1f2c2 100644 |
--- a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
+++ b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
@@ -1,5 +1,4 @@ |
{% 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. |
@@ -19,39 +18,39 @@ |
{{constant|name}} = {{constant.value|expression_to_text}} |
{% endfor %} |
{% endif %} |
-{% for enum in enums %} |
+{% for enum in module.enums %} |
class {{enum|name}}(object): |
__metaclass__ = _reflection.MojoEnumType |
VALUES = {{enum_values(enum)|indent(2)}} |
{% endfor %} |
-{% for struct in structs %} |
+{% for struct in module.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 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 %} |
+{% 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 %} |
], |
+{% endif %} |
} |
{% endfor %} |