OLD | NEW |
(Empty) | |
| 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 */ |
| 6 |
| 7 /** |
| 8 * This file will test that the pnacl-generated wrapper functions match |
| 9 * the comments in this IDL. |
| 10 */ |
| 11 |
| 12 label Chrome { |
| 13 M13 = 0.0, |
| 14 M14 = 1.0, |
| 15 M15 = 2.0 |
| 16 }; |
| 17 |
| 18 describe { |
| 19 void; |
| 20 mem_t; |
| 21 int32_t; |
| 22 }; |
| 23 |
| 24 [passByValue, returnByValue] struct some_struct { |
| 25 mem_t X; |
| 26 int32_t Y; |
| 27 }; |
| 28 |
| 29 struct some_struct2 { |
| 30 mem_t X; |
| 31 int32_t Y; |
| 32 }; |
| 33 |
| 34 [union, passByValue, returnByValue] struct some_union { |
| 35 mem_t X; |
| 36 int32_t Y; |
| 37 }; |
| 38 |
| 39 /* |
| 40 * static __attribute__((pnaclcall)) int32_t |
| 41 * Pnacl_M15_PPB_Iface_struct_wrap_foo1(int32_t a, struct some_struct b) { |
| 42 * const struct PPB_Iface_struct_wrap *iface = |
| 43 * Pnacl_WrapperInfo_PPB_Iface_struct_wrap.real_iface; |
| 44 * return iface->foo1(a, b); |
| 45 * } |
| 46 */ |
| 47 [version=2.0] |
| 48 interface PPB_Iface_struct_wrap { |
| 49 int32_t foo1(int32_t a, [in] some_struct b); |
| 50 }; |
| 51 |
| 52 /* |
| 53 * static __attribute__((pnaclcall)) int32_t |
| 54 * Pnacl_M15_PPB_Iface_union_wrap_foo1(int32_t a, union some_union b) { |
| 55 * const struct PPB_Iface_union_wrap *iface = |
| 56 * Pnacl_WrapperInfo_PPB_Iface_union_wrap.real_iface; |
| 57 * return iface->foo1(a, b); |
| 58 * } |
| 59 */ |
| 60 [version=2.0] |
| 61 interface PPB_Iface_union_wrap { |
| 62 int32_t foo1(int32_t a, [in] some_union b); |
| 63 }; |
| 64 |
| 65 |
| 66 [version=2.0] |
| 67 interface PPB_Iface_nowrap { |
| 68 int32_t foo1(int32_t a, [in] some_struct2 b); |
| 69 }; |
| 70 |
| 71 |
| 72 /* |
| 73 * static __attribute__((pnaclcall)) |
| 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 * } |
| 79 * |
| 80 * static __attribute__((pnaclcall)) |
| 81 * struct some_struct Pnacl_M13_PPB_SomeWrap_foo2(int32_t a) { |
| 82 * const struct PPB_SomeWrap_0_0 *iface = |
| 83 * Pnacl_WrapperInfo_PPB_SomeWrap_0_0.real_iface; |
| 84 * return iface->foo2(a); |
| 85 * } |
| 86 */ |
| 87 [version=0.0] |
| 88 interface PPB_SomeWrap { |
| 89 int32_t foo1([in] some_struct a); |
| 90 some_struct foo2([in] int32_t a); |
| 91 |
| 92 /* Not generating wrapper methods for PPB_SomeWrap_1_0 */ |
| 93 [version=1.0] |
| 94 int32_t foo1([in] some_struct[] a); |
| 95 [version=1.0] |
| 96 void foo2([in] int32_t a, [out] some_struct b); |
| 97 |
| 98 /* Not generating wrapper methods for PPB_SomeWrap */ |
| 99 [version=2.0] |
| 100 int32_t foo1([in] some_struct2 a); |
| 101 }; |
| 102 |
| 103 |
| 104 /* |
| 105 * static int32_t Pnacl_M13_PPP_SomeWrap_foo1(struct some_struct a) { |
| 106 * const struct PPP_SomeWrap_0_0 *iface = |
| 107 * Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface; |
| 108 * int32_t (__attribute__((pnaclcall)) *temp_fp)(struct some_struct a) = |
| 109 * ((int32_t (__attribute__((pnaclcall)) *)(struct some_struct a))iface->foo1); |
| 110 * return temp_fp(a); |
| 111 * } |
| 112 * |
| 113 * static struct some_struct Pnacl_M13_PPP_SomeWrap_foo2(int32_t a) { |
| 114 * const struct PPP_SomeWrap_0_0 *iface = |
| 115 * Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface; |
| 116 * struct some_struct (__attribute__((pnaclcall)) *temp_fp)(int32_t a) = |
| 117 * ((struct some_struct (__attribute__((pnaclcall)) *)(int32_t a))iface->foo2); |
| 118 * return temp_fp(a); |
| 119 * } |
| 120 * |
| 121 * static struct some_struct Pnacl_M14_PPP_SomeWrap_foo2(int32_t a) { |
| 122 * const struct PPP_SomeWrap_1_0 *iface = |
| 123 * Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface; |
| 124 * struct some_struct (__attribute__((pnaclcall)) *temp_fp)(int32_t a) = |
| 125 * ((struct some_struct (__attribute__((pnaclcall)) *)(int32_t a))iface->foo2); |
| 126 * return temp_fp(a); |
| 127 * } |
| 128 * |
| 129 * static int32_t Pnacl_M14_PPP_SomeWrap_foo1(const struct some_struct a[]) { |
| 130 * const struct PPP_SomeWrap_1_0 *iface = |
| 131 * Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface; |
| 132 * int32_t (__attribute__((pnaclcall)) *temp_fp)(const struct some_struct a[])
= |
| 133 * ((int32_t (__attribute__((pnaclcall)) *)(const struct some_struct a[]))iface
->foo1); |
| 134 * return temp_fp(a); |
| 135 * } |
| 136 */ |
| 137 [version=0.0] |
| 138 interface PPP_SomeWrap { |
| 139 int32_t foo1([in] some_struct a); |
| 140 some_struct foo2([in] int32_t a); |
| 141 |
| 142 [version=1.0] |
| 143 int32_t foo1([in] some_struct[] a); |
| 144 |
| 145 /* Not generating wrapper interface for PPP_SomeWrap */ |
| 146 [version=2.0] |
| 147 int32_t foo1([in] some_struct2 a); |
| 148 [version=2.0] |
| 149 void foo2([in] int32_t a); |
| 150 }; |
OLD | NEW |