5.3 KiB
pEpACIDgen test library
This here is the test library for pEpACIDgen. 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)
The intended use of this test lib is: If you encounter a scenario using pEpACIDgen that poses problem it is most likely that the scenario can be reproduced using this test lib pretty easily. lets say you pEpACIDgen a function with sig:
TT_E(*)(ACCS), where:
TT_E = typedef of typedef of an enum without an alias.
ACCS = Alias to a complex struct containing another complex struct
These types exist already along with a systematic permutation of possible types that amount to over 100 of types. just write your func/var using these types and debug the generation.
The ACID format deals with items. Everything is an item. There are qualifiers that can be used and combined to define an item. (list below) e.g PS = primitive struct that possibly has a typedef
Of all the possible combinations, not all are valid (C lang). Its a futile attempt trying to cover all the valid ones. But an effort has been made to cover the most of the valid combinations. Combination of structs, enums and typedefs are systematically explored in the files:
- structs.h
- enums.h
- typedefs.h
For all the types defined the file:
- vars.h
contains an instance of each.
for all the possible function signature, well with a 100 types, we can create 10000 different sigantures using 1 ret and 1 arg. Therefore, no functions have been defined. define them when you are interested in the combination, and pEpACIDgen the defintion.
Item Qualifier
V = Void already defined
P = Primitive Type already defined
S = Struct -> struct.h
E = Enum -> enums.h
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
I = Incomplete / (forward decl) -> struct.h/enums.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)
Alias vs. Typedef
aliased means typedef'd directly, like:
typedef struct _X { int x; } X;
(structs and enums only)
Typedef means, not typedef'd directly, but anywhere, like
typedef _X X;
Structs
For structs, a combination is needed to define the type of struct
IS = Struct (Empty or incomplete, neither primitive nor complex)
PS = Primitive struct (struct containing only primitive types)
CS = Complex struct (struct containing other structs and primitive)
NPS = Nested primitive struct
Covered combinations
_IS = incomplete struct without a typedef (forward decl)
IS = incomplete struct
AIS = alias of an incomplete struct
(aliased) struct [ primitive | complex ]
_PS = primitive struct without a an alias
PS = primitive struct
APS = Alias of primitive struct
_CS = complex struct without a an alias
CS = complex struct
ACS = alias of a complex struct
_CCS = complex complex struct without an alias
CCS = complex complex struct
ACCS = alias of a complex complex struct
Nested structs
there is always a hosting struct and a nesting struct
in case of double nesting it can be both
Simply nested struct [ primitive | complex ]
(aliased) hosting struct (complex always)
_HS = hosting struct without an alias
HS = hosting struct
AHS = alias of a hosting struct
_NPS = nested primitive struct without an alias
_NCS = nested complex struct without an alias
Doubly nested struct (complex always)
_HHS = hosting hosting struct without an alias
HHS = hosting hosting struct
AHHS = alias of a hosting hosting struct
_NHS = nested hosting struct
_NNPS = nested nested struct
_NNCS = nested nested complex struct
enums in structs
_NEHS = nested enum in hosting struct
_NENHS = nested enum in nested hosting struct
Enums
Enums only have the item qualifier I and A, so their combinations are simple.
Covered combinations
_IE = incomplete enum without an alias
IE = incomplete enum
AIE = alias of an incomplete enum
_E = enum without an alias
E = enum
AE = alias of an enum
Typedefs
Typedefs are simply applied to all defined enums and structs, and the their respective "alias". Then a typedef os applied to every typedef (TT*)
TODO:
- Pointers
- Unions