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

Side by Side Diff: tools/json_schema_compiler/templates/ppapi/idl.template

Issue 101483003: Add a Pepper IDL generator to the JSON schema compiler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years 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 unified diff | Download patch
OLDNEW
(Empty)
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 PP_ArrayOutput output;
22 };
23 {% endif -%}
24 {% endmacro %}
25
26 {% macro optional_struct(type) %}
27 {%- if type | needs_optional %}
28 struct {{ type | ppapi_type(optional=True) }} {
29 {{ type | ppapi_type }} value;
30 PP_Bool is_set;
31 };
32 {% endif -%}
33 {% endmacro %}
34
35 {% block content -%}
36 label Chrome {
37 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.values() %}
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.values() %}
60 typedef uint32_t {{ 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 [inout] {{ param | format_param_type }} {{ param.unix_name }}
65 {%- if not loop.last %},{% endif %}
66 {%- endfor -%}
67 );
68 {% endfor %}
69 interface PPB_{{ name | classname | dev_suffix }} {
70 {% for function in functions.values() %}
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 [in] PP_CompletionCallback callback
88 {%- endif -%}
89 );
90 {% endfor -%}
91 {% for event in events.values() %}
92 uint32_t Add{{ event.name | classname }}Listener (
93 [in] PP_Instance instance,
94 [in] {{ event | ppapi_type }} callback,
95 [inout] mem_t user_data);
96 {% endfor %}
97 };
98 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698