Index: tools/json_schema_compiler/templates/ppapi/idl.template |
diff --git a/tools/json_schema_compiler/templates/ppapi/idl.template b/tools/json_schema_compiler/templates/ppapi/idl.template |
new file mode 100644 |
index 0000000000000000000000000000000000000000..13aa6bb34af900f6dfb815dd7144bf20ce0ea796 |
--- /dev/null |
+++ b/tools/json_schema_compiler/templates/ppapi/idl.template |
@@ -0,0 +1,100 @@ |
+{# Copyright 2013 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. -#} |
+ |
+{% extends "base.template" %} |
+ |
+{% macro optional_array_struct(type) %} |
+{%- if type | needs_optional_array %} |
+struct {{ type | ppapi_type(array=True, optional=True) }} { |
+ {{ type | ppapi_type(array=True) }} value; |
+ PP_Bool is_set; |
+}; |
+{% endif -%} |
+{% endmacro %} |
+ |
+{% macro array_struct(type) %} |
+{%- if type | needs_array %} |
+struct {{ type | ppapi_type(array=True) }} { |
+ uint32_t size; |
+ [size_is(size)] {{ type | ppapi_type }}[] elements; |
+}; |
+{% endif -%} |
+{% endmacro %} |
+ |
+{% macro optional_struct(type) %} |
+{%- if type | needs_optional %} |
+struct {{ type | ppapi_type(optional=True) }} { |
+ {{ type | ppapi_type }} value; |
+ PP_Bool is_set; |
+}; |
+{% endif -%} |
+{% endmacro %} |
+ |
+{% block content -%} |
+label Chrome { |
+ M33 = 0.1 |
yzshen1
2013/12/10 21:43:02
[no need to make change right now]
The version inf
Sam McNally
2013/12/11 08:02:38
Added a TODO.
|
+}; |
+{% for type in enums %} |
+enum {{ type | ppapi_type }} { |
+ {%- for value in type.enum_values %} |
+ {{ value | enum_value(type) }}{% if not loop.last %},{% endif %} |
+ {%- endfor %} |
+}; |
+{{ optional_struct(type) -}} |
+{{ array_struct(type) -}} |
+{{ optional_array_struct(type) -}} |
+{%- endfor %} |
+{%- for type in types %} |
+struct {{ type | ppapi_type }} { |
+ {%- for member in type.properties.itervalues() %} |
+ {{ member | format_param_type }} {{ member.unix_name}}; |
+ {%- endfor %} |
+}; |
+{{ optional_struct(type) -}} |
+{{ array_struct(type) -}} |
+{{ optional_array_struct(type) -}} |
+{% endfor %} |
+{%- for event in events.itervalues() %} |
+typedef uint32_t {{ event | ppapi_type }}( |
yzshen1
2013/12/10 21:43:02
Event callback will return void.
Sam McNally
2013/12/11 08:02:38
Done.
|
+ [in] uint32_t listener_id, |
+ [inout] mem_t user_data{% if event.params %},{% endif %} |
+ {%- for param in event.params %} |
+ [inout] {{ param | format_param_type }} {{ param.unix_name }} |
yzshen1
2013/12/10 21:43:02
I think other params are all [in].
Sam McNally
2013/12/11 08:02:38
Done.
|
+ {%- if not loop.last %},{% endif %} |
+ {%- endfor -%} |
+); |
+{% endfor %} |
+interface PPB_{{ name | classname | dev_suffix }} { |
+{% for function in functions.itervalues() %} |
+ {{ function | return_type }} {{ function.name | classname }}( |
+ [in] PP_Instance instance |
+ {%- if function.params or function.callback or function.returns %}, |
+ {%- endif %} |
+ {%- for param in function.params %} |
+ [in] {{ param | format_param_type }} {{ param.unix_name }} |
+ {%- if not loop.last or function.callback or function.returns %}, |
+ {%- endif %} |
+ {%- endfor -%} |
+ {%- if function.returns %} |
+ [out] {{ function.returns | ppapi_type }} result, |
+ {%- endif %} |
+ {%- for param in function.callback.params %} |
+ [out] {{ param | format_param_type }} {{ param.unix_name }}, |
+ {%- endfor %} |
+ {%- if function.callback or function.returns %} |
+ {%- if function | has_array_outs %} |
+ [in] PP_ArrayOutput array_allocator, |
+ {%- endif %} |
+ [in] PP_CompletionCallback callback |
+ {%- endif -%} |
+ ); |
+{% endfor -%} |
+{% for event in events.itervalues() %} |
+ uint32_t Add{{ event.name | classname }}Listener ( |
+ [in] PP_Instance instance, |
+ [in] {{ event | ppapi_type }} callback, |
+ [inout] mem_t user_data); |
+{% endfor %} |
+}; |
+{% endblock %} |