1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/* Structs, unions and typedefs */
struct s1 {
int x;
double d;
float f;
long l[3];
};
int foo0([in] struct s1 s);
int foo1([in] struct s1 * s);
void foo2([out] struct s1 * s);
typedef struct {
int x;
struct { int y; int z; } t;
double d;
} t;
int foo3([in] t * s);
struct s2 {
int n;
[size_is(n)] long l[];
};
int foo4([in] struct s2 * s);
void foo5([out] struct s2 * s);
struct s4 {
float x, y, z;
};
int foo6([in] struct s4 * s);
void foo7([out] struct s4 * s);
// Forward declarations
struct s5;
struct s6 {
int info;
[unique] struct s5 * next;
};
struct s5 {
int count;
[unique] struct s6 * data;
};
// Unions
enum switchtype { FLOAT_ARRAY = 1, DOUBLE_ARRAY = 2, OTHER = 3 };
struct su1
{
int len;
enum switchtype type;
[switch_is(type)] union
{
case FLOAT_ARRAY: [size_is(len)] float* fl;
case DOUBLE_ARRAY: [size_is(len)] double* db;
case OTHER: struct { int len2; [size_is(len2)] int* c; } i;
} data;
};
|