widl: Handle top-level conformance for complex arrays.
[wine] / dlls / rpcrt4 / tests / server.idl
1 /*
2  * A simple interface to test the RPC server.
3  *
4  * Copyright (C) Google 2007 (Dan Hipschman)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "server_defines.h"
22
23 typedef struct tag_vector
24 {
25   int x;
26   int y;
27   int z;
28 } vector_t;
29
30 [
31   uuid(00000000-4114-0704-2301-000000000000),
32   implicit_handle(handle_t IServer_IfHandle)
33 ]
34 interface IServer
35 {
36   typedef struct
37   {
38     int *pi;
39     int **ppi;
40     int ***pppi;
41   } pints_t;
42
43   typedef struct
44   {
45     char *pc;
46     short *ps;
47     long *pl;
48     float *pf;
49     double *pd;
50   } ptypes_t;
51
52   typedef struct
53   {
54     vector_t *pu;
55     vector_t **pv;
56   } pvectors_t;
57
58   typedef struct
59   {
60     [switch_is(s)] union
61     {
62       [case(SUN_I)] int i;
63       [case(SUN_F1, SUN_F2)] float f;
64       [case(SUN_PI)] int *pi;
65     } u;
66
67     int s;
68   } sun_t;
69
70   int int_return(void);
71   int square(int x);
72   int sum(int x, int y);
73   void square_out(int x, [out] int *y);
74   void square_ref([in, out] int *x);
75   int str_length([string] const char *s);
76   int cstr_length([string, size_is(n)] const char *s, int n);
77   int dot_self(vector_t *v);
78   double square_half(double x, [out] double *y);
79   float square_half_float(float x, [out] float *y);
80   long square_half_long(long x, [out] long *y);
81   int sum_fixed_array(int a[5]);
82   int pints_sum(pints_t *pints);
83   double ptypes_sum(ptypes_t *ptypes);
84   int dot_pvectors(pvectors_t *pvectors);
85
86   /* don't use this anywhere except in sp_t */
87   typedef struct
88   {
89     int x;
90   } sp_inner_t;
91
92   typedef struct
93   {
94     int x;
95     sp_inner_t *s;
96   } sp_t;
97
98   int sum_sp(sp_t *sp);
99   double square_sun(sun_t *su);
100
101   typedef struct test_list
102   {
103     int t;
104     [switch_is(t)] union
105     {
106       [case(TL_NULL)] int x;  /* end of list */
107       [case(TL_LIST)] struct test_list *tail;
108     } u;
109   } test_list_t;
110
111   int test_list_length(test_list_t *ls);
112   int sum_fixed_int_3d(int m[2][3][4]);
113   int sum_conf_array([size_is(n)] int x[], int n);
114   int sum_var_array([length_is(n)] int x[20], int n);
115   int dot_two_vectors(vector_t vs[2]);
116
117   typedef struct
118   {
119     int n;
120     [size_is(n)] int ca[];
121   } cs_t;
122
123   typedef struct
124   {
125     int *pn;
126     [size_is(*pn)] int *ca1;
127     [size_is(n * 2)] int *ca2;
128     int n;
129   } cps_t;
130
131   typedef struct
132   {
133     [size_is(c ? a : b)] int *ca;
134     int a;
135     int b;
136     int c;
137   } cpsc_t;
138
139   int sum_cs(cs_t *cs);
140   int sum_cps(cps_t *cps);
141   int sum_cpsc(cpsc_t *cpsc);
142
143   typedef [wire_marshal(int)] void *puint_t;
144   int square_puint(puint_t p);
145   int dot_copy_vectors(vector_t u, vector_t v);
146
147   typedef struct wire_us *wire_us_t;
148   typedef [wire_marshal(wire_us_t)] struct us us_t;
149   struct us
150   {
151     void *x;
152   };
153   struct wire_us
154   {
155     int x;
156   };
157   typedef struct
158   {
159     us_t us;
160   } test_us_t;
161
162   int square_test_us(test_us_t *tus);
163
164   typedef union encu switch (int t)
165   {
166   case ENCU_I: int i;
167   case ENCU_F: float f;
168   } encu_t;
169
170   typedef enum
171   {
172     E1 = 23,
173     E2 = 4,
174     E3 = 0,
175     E4 = 64
176   } e_t;
177
178   typedef union encue switch (e_t t)
179   {
180   case E1: int i1;
181   case E2: float f2;
182   } encue_t;
183
184   double square_encu(encu_t *eu);
185   int sum_parr(int *a[3]);
186   int sum_pcarr([size_is(n)] int *a[], int n);
187   int enum_ord(e_t e);
188   double square_encue(encue_t *eue);
189
190   int sum_toplev_conf_2n([size_is(n * 2)] int *x, int n);
191   int sum_toplev_conf_cond([size_is(c ? a : b)] int *x, int a, int b, int c);
192
193   typedef struct
194   {
195     char c;
196     int i;
197     short s;
198     double d;
199   } aligns_t;
200
201   double sum_aligns(aligns_t *a);
202
203   typedef struct
204   {
205     int i;
206     char c;
207   } padded_t;
208
209   int sum_padded(padded_t *p);
210   int sum_padded2(padded_t ps[2]);
211   int sum_padded_conf([size_is(n)] padded_t *ps, int n);
212
213   typedef struct
214   {
215     int *p1;
216   } bogus_helper_t;
217
218   typedef struct
219   {
220     bogus_helper_t h;
221     int *p2;
222     int *p3;
223     char c;
224   } bogus_t;
225
226   int sum_bogus(bogus_t *b);
227   void check_null([unique] int *null);
228
229   void stop(void);
230 }