1 {# Copyright 2013 The Chromium Authors. All rights reserved.
2 Use of this source code is governed by a BSD-style license that can be
3 found in the LICENSE file. -#}
5 {% extends "base.template" %}
7 {% macro optional_array_struct(type) %}
8 {%- if type | needs_optional_array %}
9 struct {{ type | ppapi_type(array=True, optional=True) }} {
10 {{ type | ppapi_type(array=True) }} value;
16 {% macro array_struct(type) %}
17 {%- if type | needs_array %}
18 struct {{ type | ppapi_type(array=True) }} {
20 [size_is(size)] {{ type | ppapi_type }}[] elements;
25 {% macro optional_struct(type) %}
26 {%- if type | needs_optional %}
27 struct {{ type | ppapi_type(optional=True) }} {
28 {{ type | ppapi_type }} value;
35 {# TODO(sammc): Generate version information. -#}
37 [channel=dev] M33 = 0.1
39 {% for type in enums %}
40 enum {{ type | ppapi_type }} {
41 {%- for value in type.enum_values %}
42 {{ value | enum_value(type) }}{% if not loop.last %},{% endif %}
45 {{ optional_struct(type) -}}
46 {{ array_struct(type) -}}
47 {{ optional_array_struct(type) -}}
49 {%- for type in types %}
50 struct {{ type | ppapi_type }} {
51 {%- for member in type.properties.itervalues() %}
52 {{ member | format_param_type }} {{ member.unix_name}};
55 {{ optional_struct(type) -}}
56 {{ array_struct(type) -}}
57 {{ optional_array_struct(type) -}}
59 {%- for event in events.itervalues() %}
60 typedef void {{ event | ppapi_type }}(
61 [in] uint32_t listener_id,
62 [inout] mem_t user_data{% if event.params %},{% endif %}
63 {%- for param in event.params %}
64 [in] {{ param | format_param_type }} {{ param.unix_name }}
65 {%- if not loop.last %},{% endif %}
69 interface PPB_{{ name | classname }} {
70 {% for function in functions.itervalues() %}
71 {{ function | return_type }} {{ function.name | classname }}(
72 [in] PP_Instance instance
73 {%- if function.params or function.callback or function.returns %},
75 {%- for param in function.params %}
76 [in] {{ param | format_param_type }} {{ param.unix_name }}
77 {%- if not loop.last or function.callback or function.returns %},
80 {%- if function.returns %}
81 [out] {{ function.returns | ppapi_type }} result,
83 {%- for param in function.callback.params %}
84 [out] {{ param | format_param_type }} {{ param.unix_name }},
86 {%- if function.callback or function.returns %}
87 {%- if function | has_array_outs %}
88 [in] PP_ArrayOutput array_allocator,
90 [in] PP_CompletionCallback callback
94 {% for event in events.itervalues() %}
95 uint32_t Add{{ event.name | classname }}Listener (
96 [in] PP_Instance instance,
97 [in] {{ event | ppapi_type }} callback,
98 [inout] mem_t user_data);