Home | History | Annotate | Download | only in ppapi
      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. -#}
      4 
      5 {% extends "base.template" %}
      6 
      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;
     11   PP_Bool is_set;
     12 };
     13 {% endif -%}
     14 {% endmacro %}
     15 
     16 {% macro array_struct(type) %}
     17 {%- if type | needs_array %}
     18 struct {{ type | ppapi_type(array=True) }} {
     19   uint32_t size;
     20   [size_is(size)] {{ type | ppapi_type }}[] elements;
     21 };
     22 {% endif -%}
     23 {% endmacro %}
     24 
     25 {% macro optional_struct(type) %}
     26 {%- if type | needs_optional %}
     27 struct {{ type | ppapi_type(optional=True) }} {
     28   {{ type | ppapi_type }} value;
     29   PP_Bool is_set;
     30 };
     31 {% endif -%}
     32 {% endmacro %}
     33 
     34 {% block content -%}
     35 {# TODO(sammc): Generate version information. -#}
     36 label Chrome {
     37   [channel=dev] M33 = 0.1
     38 };
     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 %}
     43   {%- endfor %}
     44 };
     45 {{ optional_struct(type) -}}
     46 {{ array_struct(type) -}}
     47 {{ optional_array_struct(type) -}}
     48 {%- endfor %}
     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}};
     53   {%- endfor %}
     54 };
     55 {{ optional_struct(type) -}}
     56 {{ array_struct(type) -}}
     57 {{ optional_array_struct(type) -}}
     58 {% endfor %}
     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 %}
     66     {%- endfor -%}
     67 );
     68 {% endfor %}
     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 %},
     74       {%- endif %}
     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 %},
     78       {%- endif %}
     79       {%- endfor -%}
     80       {%- if function.returns %}
     81       [out] {{ function.returns | ppapi_type }} result,
     82       {%- endif %}
     83       {%- for param in function.callback.params %}
     84       [out] {{ param | format_param_type }} {{ param.unix_name }},
     85       {%- endfor %}
     86       {%- if function.callback or function.returns %}
     87       {%- if function | has_array_outs %}
     88       [in] PP_ArrayOutput array_allocator,
     89       {%- endif %}
     90       [in] PP_CompletionCallback callback
     91       {%- endif -%}
     92       );
     93 {% endfor -%}
     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);
     99 {% endfor %}
    100 };
    101 {% endblock %}
    102