You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.1 KiB
58 lines
1.1 KiB
#ifndef STRUCTS_H
|
|
#define STRUCTS_H
|
|
|
|
// incomplete type
|
|
// type: _incomplete_struct
|
|
struct _incomplete_struct;
|
|
|
|
// an empty struct
|
|
// type: _empty_struct
|
|
struct _empty_struct {
|
|
};
|
|
|
|
// a struct withouth typdef
|
|
// type: struct _untypedeffed_struct
|
|
struct _untypedeffed_struct {
|
|
int x;
|
|
int y;
|
|
};
|
|
|
|
// a struct containing primititve fields only
|
|
// type: primitive_struct
|
|
typedef struct _primitive_struct {
|
|
int x;
|
|
float y;
|
|
const char* str;
|
|
char one;
|
|
} primitive_struct;
|
|
|
|
// a struct that has one typeref
|
|
// type: complex_struct1
|
|
typedef struct _complex_struct1 {
|
|
int x;
|
|
primitive_struct p;
|
|
} complex_struct1;
|
|
|
|
// struct containing typeref to complex_struct1 struct
|
|
// type: _complex_struct2
|
|
struct _complex_struct2 {
|
|
primitive_struct *p;
|
|
complex_struct1 *c;
|
|
};
|
|
|
|
// nested structs, semantic parent is global
|
|
// type: host2
|
|
typedef struct _host_struct {
|
|
int x;
|
|
int y;
|
|
// type: _nested_struct
|
|
struct _nested_struct {
|
|
int x;
|
|
int y;
|
|
} nested1;
|
|
} host_struct;
|
|
|
|
typedef struct _nested_struct nested_struct;
|
|
|
|
#endif //STRUCTS_H
|
|
|
|
|