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

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 };
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 label Chrome {
36 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.
37 };
38 {% for type in enums %}
39 enum {{ type | ppapi_type }} {
40 {%- for value in type.enum_values %}
41 {{ value | enum_value(type) }}{% if not loop.last %},{% endif %}
42 {%- endfor %}
43 };
44 {{ optional_struct(type) -}}
45 {{ array_struct(type) -}}
46 {{ optional_array_struct(type) -}}
47 {%- endfor %}
48 {%- for type in types %}
49 struct {{ type | ppapi_type }} {
50 {%- for member in type.properties.itervalues() %}
51 {{ member | format_param_type }} {{ member.unix_name}};
52 {%- endfor %}
53 };
54 {{ optional_struct(type) -}}
55 {{ array_struct(type) -}}
56 {{ optional_array_struct(type) -}}
57 {% endfor %}
58 {%- for event in events.itervalues() %}
59 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.
60 [in] uint32_t listener_id,
61 [inout] mem_t user_data{% if event.params %},{% endif %}
62 {%- for param in event.params %}
63 [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.
64 {%- if not loop.last %},{% endif %}
65 {%- endfor -%}
66 );
67 {% endfor %}
68 interface PPB_{{ name | classname | dev_suffix }} {
69 {% for function in functions.itervalues() %}
70 {{ function | return_type }} {{ function.name | classname }}(
71 [in] PP_Instance instance
72 {%- if function.params or function.callback or function.returns %},
73 {%- endif %}
74 {%- for param in function.params %}
75 [in] {{ param | format_param_type }} {{ param.unix_name }}
76 {%- if not loop.last or function.callback or function.returns %},
77 {%- endif %}
78 {%- endfor -%}
79 {%- if function.returns %}
80 [out] {{ function.returns | ppapi_type }} result,
81 {%- endif %}
82 {%- for param in function.callback.params %}
83 [out] {{ param | format_param_type }} {{ param.unix_name }},
84 {%- endfor %}
85 {%- if function.callback or function.returns %}
86 {%- if function | has_array_outs %}
87 [in] PP_ArrayOutput array_allocator,
88 {%- endif %}
89 [in] PP_CompletionCallback callback
90 {%- endif -%}
91 );
92 {% endfor -%}
93 {% for event in events.itervalues() %}
94 uint32_t Add{{ event.name | classname }}Listener (
95 [in] PP_Instance instance,
96 [in] {{ event | ppapi_type }} callback,
97 [inout] mem_t user_data);
98 {% endfor %}
99 };
100 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698