Browse Source

lib_test - add anonymous enums

master
heck 5 years ago
parent
commit
89c7f4cdf6
  1. 18
      examples/lib/lib_test/README.md
  2. 16
      examples/lib/lib_test/enums.h
  3. 5
      examples/lib/lib_test/typedefs.h
  4. 14
      examples/lib/lib_test/vars.h

18
examples/lib/lib_test/README.md

@ -1,11 +1,11 @@
pEpACIDgen test library
-----------------------
This here is the test library for pEpACIDgen.
The C language is broken down into its components and common pattern.
The C language is broken down into its components and common patterns.
It is a humble attempt to cover all possible combinations that can be created in the
C language. (like, struct containing` primitive, struct containing struct, typedef chains,
etc..).
Please note, that pointer types have not been addressed yet (at all)
Please note that pointer types have not been addressed yet (at all)
The intended use of this test lib is: If you encounter a scenario using pEpACIDgen that poses problem
@ -46,7 +46,7 @@ define them when you are interested in the combination, and pEpACIDgen the defin
Item Qualifier
===============
==============
V = Void already defined
P = Primitive Type already defined
S = Struct -> struct.h
@ -55,11 +55,12 @@ A = Alias -> structs.h/enums.h
N = Nested (Structs only, cant be aliased) -> structs.h
H = Hosting (Structs only -> structs.h
containing the nested struct, cant be primitive)
T = typedef -> typedefs.h
T = Typedef -> typedefs.h
I = Incomplete / (forward decl) -> struct.h/enums.h
func_ = function -> functions.h
var_ = variable -> vars.h
func_ = Function -> functions.h
var_ = Variable -> vars.h
U = Anonymous (enums onnly) -> enums.h
prefixed underline (e.g _E) means no typedef/alias exists for this item (enum in this case)
@ -159,3 +160,8 @@ their respective "alias".
Then a typedef os applied to every typedef (TT*)
# TODO:
* Pointers
* Unions

16
examples/lib/lib_test/enums.h

@ -3,7 +3,7 @@
// Enums
// =====
// Enums only have the item qualifier I and A,
// Enums can be combined with the item qualifiers I, A and (only enums) X
// so their combinations are simple.
//
// Covered combinations
@ -14,6 +14,8 @@
// _E = enum without an alias
// E = enum
// AE = alias of an enum
// _XE = anonymous enum without an alias
// AXE = alias of an anonymous enum
// _IE = incomplete enum without anb alias
@ -38,5 +40,17 @@ typedef enum E {
E2,
} AE;
// _XE = anonymous enum
enum {
_XE1,
_XE2,
_XE3
};
typedef enum {
AXE1,
AXE2,
AXE3
} AXE;
#endif //ENUMS_H

5
examples/lib/lib_test/typedefs.h

@ -90,6 +90,9 @@ typedef enum _E T_E;
typedef enum E TE;
// TAE = typedef of an alias of an enum
typedef AE TAE;
// T_XE = anonymous without an alias is not a type, and cant be typedef'd
// TAXE = typedef of an anonymous enum
typedef AXE TAXE;
// TT* = typedef of all typedefs above
@ -128,6 +131,8 @@ typedef TAIE TTAIE;
typedef T_E TT_E;
typedef TE TTE;
typedef TAE TTAE;
typedef TAXE TTAXE;
#endif //TYPEDEFS_H

14
examples/lib/lib_test/vars.h

@ -23,6 +23,7 @@ char var__P;
enum _E var__E ;
enum E var_E;
AE var_AE;
AXE var_AXE;
// structs
@ -127,6 +128,7 @@ T_NEHS var_T_NEHS;
T_E var_T_E;
TE var_TE;
TAE var_TAE;
TAXE var_TAXE;
@ -137,8 +139,8 @@ TAE var_TAE;
// ---------------------
TT_P var_TT_P;
// Typedefs of structs
// ------------------
// typedefs of typedefs of structs
// -------------------------------
// primitive structs
TT_PS var_TT_PS;
TTPS var_TTPS;
@ -167,14 +169,16 @@ TT_NNCS var_TT_NNCS;
TT_NENHS var_TT_NENHS;
TT_NHS1 var_TT_NHS1;
//nested enum in hosting struct
// nested enum in hosting struct
TT_HS1 var_TT_HS1;
TT_NEHS var_TT_NEHS;
// Typedef of enums
// ----------------
// typedefs of typedefs enums
// --------------------------
TT_E var_TT_E;
TTE var_TTE;
TTAE var_TTAE;
TTAXE var_TTAXE;
#endif // VARS_H

Loading…
Cancel
Save