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
// ====================
// [ _ - unaliased | A - aliased ] incomplete struct
// --------------------------------------------------
// _IS = incomplete struct without a typedef (forward decl)
// IS = 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
// _PSIa = primitive struct without an alias containing an incomplete array
@ -62,18 +64,18 @@
// _NENHS = nested enum in nested hosting struct
//
//
// Arrays
// ------
// Struct containing array fields
// ------------------------------
// 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
// 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 the most important
// combinations of struct fields:
// * ia_P
// * a_P
// * a_PSa
// * aAPSa
// * iaACS
// * aACS
// - 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
@ -92,70 +94,71 @@ typedef struct IS AIS;
// ----------------------------------------
// _PS = primitive struct without a an alias
struct _PS {
int x, y;
int field__P_1;
int field__P_2;
};
// PS = primitive struct
// APS = Alias of primitive struct
typedef struct PS {
int field__P_x;
int field__P_y;
int field__P_1;
int field__P_2;
} APS;
// _PSIa = primitive struct containing an incomplete array without an alias
struct _PSIa {
int field__P;
char field__Pa[];
int field__P_1;
char field__Pa_1[];
};
// 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[];
int field__P_1;
char field__Pa_1[];
} APSIa;
// _PSa = primitive struct containing an array without an alias
struct _PSa {
int field__P;
char field__Pa[3];
int field__P_1;
char field__Pa_1[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];
int field__P_1;
char field__Pa_1[3];
} APSa;
// _CS = complex struct without a an alias
struct _CS {
struct _PS field__PS;
APS field_APS;
struct _PSa fiedld__PSa[3];
APSa field_APSa[3];
struct _PS field__PS_1;
APS field_APS_1;
struct _PSa fiedld__PSa_1[3];
APSa field_APSa_1[3];
};
// CS = complex struct
// ACS = alias of a complex struct
typedef struct CS {
struct _PS field__PS;
APS field_APS;
struct _PSa fiedld__PSa[3];
APSa field_APSa[3];
struct _PS field__PS_1;
APS field_APS_1;
struct _PSa fiedld__PSa_1[3];
APSa field_APSa_1[3];
} ACS;
// _CCS = complex complex struct without an alias
struct _CCS {
struct _CS field__CS;
ACS x[];
struct _CS field__CS_1;
ACS field_ACS_1[];
};
// CCS = complex complex struct
// ACCS = alias of a complex complex struct
typedef struct CCS {
struct _CS field__CS;
ACS x[3];
struct _CS field__CS_1;
ACS field_ACS_1[];
} ACCS;
// Nested structs
@ -169,10 +172,11 @@ typedef struct CCS {
// _HS = hosting struct without an alias
// _NCS = nested complex struct without an alias
struct _HS {
int x, y;
int field__P_1;
int field__P_2;
struct _NCS {
ACS x;
} _ncs;
ACS field_ACS_1;
} field__NCS_1;
};
// (aliased) hosting struct (complex always)
@ -181,9 +185,11 @@ struct _HS {
// _NPS = nested primitive struct (never has alias)
typedef struct HS {
struct _NPS {
int x, y;
} _nps;
int x, y;
int field__P_1;
int field__P_2;
} field__NPS_1;
int field__P_1;
int field__P_2;
} AHS;
@ -195,13 +201,16 @@ typedef struct HS {
// _NHS = nested hosting struct
// _NNPS = nested nested primitve struct
struct _HHS {
int x, y;
int field__P_1;
int field__P_2;
struct _NHS {
int x, y;
int field__P_1;
int field__P_2;
struct _NNPS {
int x,y;
} _nnps;
} _nhs;
int field__P_1;
int field__P_2;
} field__NNPS_1;
} field__NHS;
};
// HHS = hosting hosting struct
@ -209,29 +218,32 @@ struct _HHS {
// _NNCS = nested nested complex struct
// _NENHS = nested enum in nested hosting struct
typedef struct HHS {
int x, y;
int field__P_1;
int field__P_2;
struct _NHS1 {
int x, y;
int field__P_1;
int field__P_2;
struct _NNCS {
struct _CS a;
} _nncs;
struct _CS field__CS_1;
} field__NNCS_1;
enum _NENHS {
_NENHS1,
_NENHS2,
_NENHS3
} _nenhs;
} _nhs1;
} field__NENHS_1;
} field__NHS1_1;
} AHHS;
// _NEHS = nested enum in hosting struct
struct _HS1 {
int x, y;
int field__P_1;
int field__P_2;
enum _NEHS {
_NEHS1,
_NEHS2,
_NEHS3
} _nehs;
} field__NEHS_1;
};

Loading…
Cancel
Save