Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / generators / test_gen_pnacl / test_interfaces.idl
blob0abe79934a7cc48b4b7569513aae3d3a1d2a2f6e
1 /*
2 * Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
7 /**
8 * This file will test that the pnacl-generated wrapper functions match
9 * the comments in this IDL.
12 label Chrome {
13 M13 = 0.0,
14 M14 = 1.0,
15 M15 = 2.0
18 describe {
19 void;
20 mem_t;
21 int32_t;
24 [passByValue, returnByValue] struct some_struct {
25 mem_t X;
26 int32_t Y;
29 struct some_struct2 {
30 mem_t X;
31 int32_t Y;
34 [union, passByValue, returnByValue] struct some_union {
35 mem_t X;
36 int32_t Y;
40 * static int32_t
41 * Pnacl_M15_PPB_Iface_struct_wrap_foo1(int32_t a, struct some_struct* b) {
42 * const struct PPB_Iface_struct_wrap_2_0 *iface =
43 * Pnacl_WrapperInfo_PPB_Iface_struct_wrap_2_0.real_iface;
44 * return iface->foo1(a, *b);
45 * }
47 [version=2.0]
48 interface PPB_Iface_struct_wrap {
49 int32_t foo1(int32_t a, [in] some_struct b);
53 * static int32_t
54 * Pnacl_M15_PPB_Iface_union_wrap_foo1(int32_t a, union some_union* b) {
55 * const struct PPB_Iface_union_wrap_2_0 *iface =
56 * Pnacl_WrapperInfo_PPB_Iface_union_wrap_2_0.real_iface;
57 * return iface->foo1(a, *b);
58 * }
60 [version=2.0]
61 interface PPB_Iface_union_wrap {
62 int32_t foo1(int32_t a, [in] some_union b);
66 [version=2.0]
67 interface PPB_Iface_nowrap {
68 int32_t foo1(int32_t a, [in] some_struct2 b);
73 * static
74 * int32_t Pnacl_M13_PPB_SomeWrap_foo1(struct some_struct* a) {
75 * const struct PPB_SomeWrap_0_0 *iface =
76 * Pnacl_WrapperInfo_PPB_SomeWrap_0_0.real_iface;
77 * return iface->foo1(*a);
78 * }
80 * static
81 * void Pnacl_M13_PPB_SomeWrap_foo2(struct some_struct* _struct_result,
82 * int32_t a) {
83 * const struct PPB_SomeWrap_0_0 *iface =
84 * Pnacl_WrapperInfo_PPB_SomeWrap_0_0.real_iface;
85 * *_struct_result = iface->foo2(a);
86 * }
88 [version=0.0]
89 interface PPB_SomeWrap {
90 int32_t foo1([in] some_struct a);
91 some_struct foo2([in] int32_t a);
93 /* Not generating wrapper methods for PPB_SomeWrap_1_0 */
94 [version=1.0]
95 int32_t foo1([in] some_struct[] a);
96 [version=1.0]
97 void foo2([in] int32_t a, [out] some_struct b);
99 /* Not generating wrapper methods for PPB_SomeWrap */
100 [version=2.0]
101 int32_t foo1([in] some_struct2 a);
106 * static int32_t Pnacl_M13_PPP_SomeWrap_foo1(struct some_struct a) {
107 * const struct PPP_SomeWrap_0_0 *iface =
108 * Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface;
109 * int32_t (*temp_fp)(struct some_struct* a) =
110 * ((int32_t (*)(struct some_struct* a))iface->foo1);
111 * return temp_fp(&a);
114 * static struct some_struct Pnacl_M13_PPP_SomeWrap_foo2(int32_t a) {
115 * const struct PPP_SomeWrap_0_0 *iface =
116 * Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface;
117 * void (*temp_fp)(struct some_struct* _struct_result, int32_t a) =
118 * ((void (*)(struct some_struct* _struct_result, int32_t a))iface->foo2);
119 * struct some_struct _struct_result;
120 * temp_fp(&_struct_result, a);
121 * return _struct_result;
124 * static struct some_struct Pnacl_M14_PPP_SomeWrap_foo2(int32_t a) {
125 * const struct PPP_SomeWrap_1_0 *iface =
126 * Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface;
127 * void (*temp_fp)(struct some_struct* _struct_result, int32_t a) =
128 * ((void (*)(struct some_struct* _struct_result, int32_t a))iface->foo2);
129 * struct some_struct _struct_result;
130 * temp_fp(&_struct_result, a);
131 * return _struct_result;
134 * static int32_t Pnacl_M14_PPP_SomeWrap_foo1(const struct some_struct a[]) {
135 * const struct PPP_SomeWrap_1_0 *iface =
136 * Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface;
137 * int32_t (*temp_fp)(const struct some_struct a[]) =
138 * ((int32_t (*)(const struct some_struct a[]))iface->foo1);
139 * return temp_fp(a);
142 [version=0.0]
143 interface PPP_SomeWrap {
144 int32_t foo1([in] some_struct a);
145 some_struct foo2([in] int32_t a);
147 [version=1.0]
148 int32_t foo1([in] some_struct[] a);
150 /* Not generating wrapper interface for PPP_SomeWrap */
151 [version=2.0]
152 int32_t foo1([in] some_struct2 a);
153 [version=2.0]
154 void foo2([in] int32_t a);
157 [no_interface_string]
158 interface PPP_NoIFString {
159 int32_t Dummy([in] some_struct a);