Browse Source

lib_test: add structs containing array fields

master
heck 5 years ago
parent
commit
a51d04bcdd
  1. 90
      examples/lib/lib_test/structs.h

90
examples/lib/lib_test/structs.h

@ -18,15 +18,21 @@
// (aliased) struct [ primitive | complex ]
// ----------------------------------------
// _PS = primitive struct without a an alias
// PS = primitive struct
// APS = Alias of primitive struct
// _CS = complex struct without a an alias
// CS = complex struct
// ACS = alias of a complex struct
// _CCS = complex complex struct without an alias
// CCS = complex complex struct
// ACCS = alias of a complex complex struct
// _PS = primitive struct without a an alias
// PS = primitive struct
// _PSIa = primitive struct without an alias containing an incomplete array
// PSIa = primitive struct containing an incomplete array
// APSIa = alias of a primitive struct containing an incomplete array
// _PSa = primitive struct without an alias containing an array
// PSa = primitive struct containing an array
// APSa = alias of a primitive struct containing an array
// APS = Alias of primitive struct
// _CS = complex struct without a an alias
// CS = complex struct
// ACS = alias of a complex struct
// _CCS = complex complex struct without an alias
// CCS = complex complex struct
// ACCS = alias of a complex complex struct
//
// Nested structs
// --------------
@ -54,6 +60,24 @@
// enums in structs
// _NEHS = nested enum in hosting struct
// _NENHS = nested enum in nested hosting struct
//
//
// Arrays
// ------
// Caution: The array combinations are covered in a not entirely systematic way.
// There are designated primitive structs that contain complete/incomplete array
// BUT, the use of array fields has been scattered a bit randomly in an attempt to cover all
// combinations of struct fields:
// * ia_P
// * a_P
// * a_PSa
// * aAPSa
// * iaACS
// * aACS
//
// So, a few of the possible field types are missing.
// Additionally, it gets a little blury with the complex structs (CS) because they dont further
// specify exactly the types of their fields
// _IS = incomplete struct without a typedef (forward decl)
@ -67,7 +91,6 @@ typedef struct IS AIS;
// (aliased) struct [ primitive | complex ]
// ----------------------------------------
// _PS = primitive struct without a an alias
struct _PS {
int x, y;
};
@ -75,31 +98,64 @@ struct _PS {
// PS = primitive struct
// APS = Alias of primitive struct
typedef struct PS {
int x, y;
int field__P_x;
int field__P_y;
} APS;
// _PSIa = primitive struct containing an incomplete array without an alias
struct _PSIa {
int field__P;
char field__Pa[];
};
// PSIa = primitive struct containing an incomplete array
// APSIa = alias of a primitive struct containing an incomplete array
typedef struct PSIa {
int field__P;
char field__Pa[];
} APSIa;
// _PSa = primitive struct containing an array without an alias
struct _PSa {
int field__P;
char field__Pa[3];
};
// PSa = primitive struct containing an array
// APSa = alias of a primitive struct containing an array
typedef struct PSa {
int field__P;
char field__Pa[3];
} APSa;
// _CS = complex struct without a an alias
struct _CS {
struct _PS x;
APS y;
struct _PS field__PS;
APS field_APS;
struct _PSa fiedld__PSa[3];
APSa field_APSa[3];
};
// CS = complex struct
// ACS = alias of a complex struct
typedef struct CS {
APS y;
struct _PS x;
struct _PS field__PS;
APS field_APS;
struct _PSa fiedld__PSa[3];
APSa field_APSa[3];
} ACS;
// _CCS = complex complex struct without an alias
struct _CCS {
ACS x;
struct _CS field__CS;
ACS x[];
};
// CCS = complex complex struct
// ACCS = alias of a complex complex struct
typedef struct CCS {
ACS x;
struct _CS field__CS;
ACS x[3];
} ACCS;
// Nested structs

Loading…
Cancel
Save