Browse Source

lib_test - add anonymous enums

master
heck 5 years ago
parent
commit
7485787ebe
  1. 18
      examples/lib/lib_test/README.md
  2. 16
      examples/lib/lib_test/enums.h
  3. 5
      examples/lib/lib_test/typedefs.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

Loading…
Cancel
Save