Browse Source

lib_test: add structs containing array fields

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

72
examples/lib/lib_test/structs.h

@ -20,6 +20,12 @@
// ---------------------------------------- // ----------------------------------------
// _PS = primitive struct without a an alias // _PS = primitive struct without a an alias
// PS = primitive struct // 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 // APS = Alias of primitive struct
// _CS = complex struct without a an alias // _CS = complex struct without a an alias
// CS = complex struct // CS = complex struct
@ -54,6 +60,24 @@
// enums in structs // enums in structs
// _NEHS = nested enum in hosting struct // _NEHS = nested enum in hosting struct
// _NENHS = nested enum in nested 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) // _IS = incomplete struct without a typedef (forward decl)
@ -67,7 +91,6 @@ typedef struct IS AIS;
// (aliased) struct [ primitive | complex ] // (aliased) struct [ primitive | complex ]
// ---------------------------------------- // ----------------------------------------
// _PS = primitive struct without a an alias // _PS = primitive struct without a an alias
struct _PS { struct _PS {
int x, y; int x, y;
}; };
@ -75,31 +98,64 @@ struct _PS {
// PS = primitive struct // PS = primitive struct
// APS = Alias of primitive struct // APS = Alias of primitive struct
typedef struct PS { typedef struct PS {
int x, y; int field__P_x;
int field__P_y;
} APS; } 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 // _CS = complex struct without a an alias
struct _CS { struct _CS {
struct _PS x; struct _PS field__PS;
APS y; APS field_APS;
struct _PSa fiedld__PSa[3];
APSa field_APSa[3];
}; };
// CS = complex struct // CS = complex struct
// ACS = alias of a complex struct // ACS = alias of a complex struct
typedef struct CS { typedef struct CS {
APS y; struct _PS field__PS;
struct _PS x; APS field_APS;
struct _PSa fiedld__PSa[3];
APSa field_APSa[3];
} ACS; } ACS;
// _CCS = complex complex struct without an alias // _CCS = complex complex struct without an alias
struct _CCS { struct _CCS {
ACS x; struct _CS field__CS;
ACS x[];
}; };
// CCS = complex complex struct // CCS = complex complex struct
// ACCS = alias of a complex complex struct // ACCS = alias of a complex complex struct
typedef struct CCS { typedef struct CCS {
ACS x; struct _CS field__CS;
ACS x[3];
} ACCS; } ACCS;
// Nested structs // Nested structs

Loading…
Cancel
Save