Browse Source

lib_test: struct field naming overhaul

master
heck 4 years ago
parent
commit
e0008e4648
  1. 120
      examples/lib/lib_test/structs.h

120
examples/lib/lib_test/structs.h

@ -12,12 +12,14 @@
// Covered combinations // Covered combinations
// ==================== // ====================
// [ _ - unaliased | A - aliased ] incomplete struct
// --------------------------------------------------
// _IS = incomplete struct without a typedef (forward decl) // _IS = incomplete struct without a typedef (forward decl)
// IS = incomplete struct // IS = incomplete struct
// AIS = alias of an incomplete struct // AIS = alias of an incomplete struct
// (aliased) struct [ primitive | complex ] // [ _ - unaliased | A - aliased ] [ P - primitive | C - complex ] struct [ I - incomplete ] [ a - array ]
// ---------------------------------------- // --------------------------------------------------------------------------------------------------------
// _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 without an alias containing an incomplete array
@ -62,18 +64,18 @@
// _NENHS = nested enum in nested hosting struct // _NENHS = nested enum in nested hosting struct
// //
// //
// Arrays // Struct containing array fields
// ------ // ------------------------------
// Caution: The array combinations are covered in a not entirely systematic way. // Caution: The array combinations are covered in a not entirely systematic way.
// There are designated primitive structs that contain complete/incomplete array // There are designated primitive structs that contain complete/incomplete array fields.
// BUT, the use of array fields has been scattered a bit randomly in an attempt to cover all // BUT, the use of array fields has been scattered a bit randomly in an attempt to cover the most important
// combinations of struct fields: // combinations of struct fields:
// * ia_P // - ia_P
// * a_P // - a_P
// * a_PSa // - a_PSa
// * aAPSa // - aAPSa
// * iaACS // - iaACS
// * aACS // - aACS
// //
// So, a few of the possible field types are missing. // 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 // Additionally, it gets a little blury with the complex structs (CS) because they dont further
@ -92,70 +94,71 @@ typedef struct IS AIS;
// ---------------------------------------- // ----------------------------------------
// _PS = primitive struct without a an alias // _PS = primitive struct without a an alias
struct _PS { struct _PS {
int x, y; int field__P_1;
int field__P_2;
}; };
// PS = primitive struct // PS = primitive struct
// APS = Alias of primitive struct // APS = Alias of primitive struct
typedef struct PS { typedef struct PS {
int field__P_x; int field__P_1;
int field__P_y; int field__P_2;
} APS; } APS;
// _PSIa = primitive struct containing an incomplete array without an alias // _PSIa = primitive struct containing an incomplete array without an alias
struct _PSIa { struct _PSIa {
int field__P; int field__P_1;
char field__Pa[]; char field__Pa_1[];
}; };
// PSIa = primitive struct containing an incomplete array // PSIa = primitive struct containing an incomplete array
// APSIa = alias of a primitive struct containing an incomplete array // APSIa = alias of a primitive struct containing an incomplete array
typedef struct PSIa { typedef struct PSIa {
int field__P; int field__P_1;
char field__Pa[]; char field__Pa_1[];
} APSIa; } APSIa;
// _PSa = primitive struct containing an array without an alias // _PSa = primitive struct containing an array without an alias
struct _PSa { struct _PSa {
int field__P; int field__P_1;
char field__Pa[3]; char field__Pa_1[3];
}; };
// PSa = primitive struct containing an array // PSa = primitive struct containing an array
// APSa = alias of a primitive struct containing an array // APSa = alias of a primitive struct containing an array
typedef struct PSa { typedef struct PSa {
int field__P; int field__P_1;
char field__Pa[3]; char field__Pa_1[3];
} APSa; } APSa;
// _CS = complex struct without a an alias // _CS = complex struct without a an alias
struct _CS { struct _CS {
struct _PS field__PS; struct _PS field__PS_1;
APS field_APS; APS field_APS_1;
struct _PSa fiedld__PSa[3]; struct _PSa fiedld__PSa_1[3];
APSa field_APSa[3]; APSa field_APSa_1[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 {
struct _PS field__PS; struct _PS field__PS_1;
APS field_APS; APS field_APS_1;
struct _PSa fiedld__PSa[3]; struct _PSa fiedld__PSa_1[3];
APSa field_APSa[3]; APSa field_APSa_1[3];
} ACS; } ACS;
// _CCS = complex complex struct without an alias // _CCS = complex complex struct without an alias
struct _CCS { struct _CCS {
struct _CS field__CS; struct _CS field__CS_1;
ACS x[]; ACS field_ACS_1[];
}; };
// 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 {
struct _CS field__CS; struct _CS field__CS_1;
ACS x[3]; ACS field_ACS_1[];
} ACCS; } ACCS;
// Nested structs // Nested structs
@ -169,10 +172,11 @@ typedef struct CCS {
// _HS = hosting struct without an alias // _HS = hosting struct without an alias
// _NCS = nested complex struct without an alias // _NCS = nested complex struct without an alias
struct _HS { struct _HS {
int x, y; int field__P_1;
int field__P_2;
struct _NCS { struct _NCS {
ACS x; ACS field_ACS_1;
} _ncs; } field__NCS_1;
}; };
// (aliased) hosting struct (complex always) // (aliased) hosting struct (complex always)
@ -181,9 +185,11 @@ struct _HS {
// _NPS = nested primitive struct (never has alias) // _NPS = nested primitive struct (never has alias)
typedef struct HS { typedef struct HS {
struct _NPS { struct _NPS {
int x, y; int field__P_1;
} _nps; int field__P_2;
int x, y; } field__NPS_1;
int field__P_1;
int field__P_2;
} AHS; } AHS;
@ -195,13 +201,16 @@ typedef struct HS {
// _NHS = nested hosting struct // _NHS = nested hosting struct
// _NNPS = nested nested primitve struct // _NNPS = nested nested primitve struct
struct _HHS { struct _HHS {
int x, y; int field__P_1;
int field__P_2;
struct _NHS { struct _NHS {
int x, y; int field__P_1;
int field__P_2;
struct _NNPS { struct _NNPS {
int x,y; int field__P_1;
} _nnps; int field__P_2;
} _nhs; } field__NNPS_1;
} field__NHS;
}; };
// HHS = hosting hosting struct // HHS = hosting hosting struct
@ -209,29 +218,32 @@ struct _HHS {
// _NNCS = nested nested complex struct // _NNCS = nested nested complex struct
// _NENHS = nested enum in nested hosting struct // _NENHS = nested enum in nested hosting struct
typedef struct HHS { typedef struct HHS {
int x, y; int field__P_1;
int field__P_2;
struct _NHS1 { struct _NHS1 {
int x, y; int field__P_1;
int field__P_2;
struct _NNCS { struct _NNCS {
struct _CS a; struct _CS field__CS_1;
} _nncs; } field__NNCS_1;
enum _NENHS { enum _NENHS {
_NENHS1, _NENHS1,
_NENHS2, _NENHS2,
_NENHS3 _NENHS3
} _nenhs; } field__NENHS_1;
} _nhs1; } field__NHS1_1;
} AHHS; } AHHS;
// _NEHS = nested enum in hosting struct // _NEHS = nested enum in hosting struct
struct _HS1 { struct _HS1 {
int x, y; int field__P_1;
int field__P_2;
enum _NEHS { enum _NEHS {
_NEHS1, _NEHS1,
_NEHS2, _NEHS2,
_NEHS3 _NEHS3
} _nehs; } field__NEHS_1;
}; };

Loading…
Cancel
Save