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

Unified Diff: mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl

Issue 695583002: Update mojo sdk to rev e083961bf11fd0c94d40be8853761da529b6d444 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch in https://codereview.chromium.org/692823003 Created 6 years, 2 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
Index: mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl
diff --git a/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl b/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl
index 305b26a832ca59b6704fb1d38b171b577a87b468..b42fc3047c4f744f4994c979a34bc851a20bf972 100644
--- a/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl
+++ b/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl
@@ -9,3 +9,31 @@
{% endfor %}
]
{%- endmacro -%}
+
+{%- macro struct_descriptor(struct) -%}
+{
+{% 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 %}
+}
+{%- endmacro -%}

Powered by Google App Engine
This is Rietveld 408576698