From 931d830adf09f70b304eaa1a47d750de221f9047 Mon Sep 17 00:00:00 2001 From: heck Date: Thu, 7 Jan 2021 21:18:33 +0100 Subject: [PATCH] Here are the example c libs (to be used from python) --- gen/examples/lib/Makefile | 10 ++ gen/examples/lib/synth_shed/Makefile | 42 ++++++ gen/examples/lib/synth_shed/main.c | 16 ++ gen/examples/lib/synth_shed/synth_shed.c | 86 +++++++++++ gen/examples/lib/synth_shed/synth_shed.h | 65 ++++++++ gen/examples/lib/test_cid/Makefile | 25 ++++ gen/examples/lib/test_cid/enums.h | 42 ++++++ gen/examples/lib/test_cid/functions.h | 39 +++++ gen/examples/lib/test_cid/main.c | 13 ++ gen/examples/lib/test_cid/structs.h | 183 +++++++++++++++++++++++ gen/examples/lib/test_cid/test_lib.c | 9 ++ gen/examples/lib/test_cid/test_lib.h | 110 ++++++++++++++ gen/examples/lib/test_cid/typedefs.h | 133 ++++++++++++++++ gen/examples/lib/test_cid/vars.h | 180 ++++++++++++++++++++++ 14 files changed, 953 insertions(+) create mode 100644 gen/examples/lib/Makefile create mode 100644 gen/examples/lib/synth_shed/Makefile create mode 100644 gen/examples/lib/synth_shed/main.c create mode 100644 gen/examples/lib/synth_shed/synth_shed.c create mode 100644 gen/examples/lib/synth_shed/synth_shed.h create mode 100644 gen/examples/lib/test_cid/Makefile create mode 100644 gen/examples/lib/test_cid/enums.h create mode 100644 gen/examples/lib/test_cid/functions.h create mode 100644 gen/examples/lib/test_cid/main.c create mode 100644 gen/examples/lib/test_cid/structs.h create mode 100644 gen/examples/lib/test_cid/test_lib.c create mode 100644 gen/examples/lib/test_cid/test_lib.h create mode 100644 gen/examples/lib/test_cid/typedefs.h create mode 100644 gen/examples/lib/test_cid/vars.h diff --git a/gen/examples/lib/Makefile b/gen/examples/lib/Makefile new file mode 100644 index 0000000..43151d1 --- /dev/null +++ b/gen/examples/lib/Makefile @@ -0,0 +1,10 @@ +.PHONY: all clean + +all: + $(MAKE) -C synth_shed + $(MAKE) -C test_cid + +clean: + $(MAKE) -C synth_shed clean + $(MAKE) -C test_cid clean + diff --git a/gen/examples/lib/synth_shed/Makefile b/gen/examples/lib/synth_shed/Makefile new file mode 100644 index 0000000..dfb0160 --- /dev/null +++ b/gen/examples/lib/synth_shed/Makefile @@ -0,0 +1,42 @@ +TARGET_EXE=synth_shed +LIB_STATIC=libsynth_shed.a +LIB_DYN=libsynth_shed.so + +# C +CFLAGS+=-std=c99 -g -fPIC + +# Sources +SRCS=$(wildcard *.c) + +#Link +OBJS=$(SRCS:.c=.o) + + +$(info -----BUILD INFO----) +$(info SRCS $(SRCS)) +$(info OBJS $(OBJS)) + +.PHONY: all lib_static lib_dyn exe clean + +all: lib_static lib_dyn exe + +lib_static: $(LIB_STATIC) + +lib_dyn: $(LIB_DYN) + +exe: $(TARGET_EXE) + +$(LIB_STATIC): $(OBJS) + $(AR) -rc $@ $^ + +$(LIB_DYN): $(OBJS) + $(CC) $(CFLAGS) -shared -o $@ $^ + +$(TARGET_EXE): $(OBJS) + $(CC) $(LDFLAGS) -o $@ $^ + +clean: + rm -f $(TARGET_EXE) + rm -f $(LIB_STATIC) + rm -f $(LIB_DYN) + rm -f $(OBJS) diff --git a/gen/examples/lib/synth_shed/main.c b/gen/examples/lib/synth_shed/main.c new file mode 100644 index 0000000..db8c62c --- /dev/null +++ b/gen/examples/lib/synth_shed/main.c @@ -0,0 +1,16 @@ +#include "synth_shed.h" +#include + + + +int main() { + init_synth_shed(); + + synth_t* my_synth = synth_create("UltraBoog"); + printf("%s", play_synth(my_synth)); + + synth_set_osc_count(my_synth, 33); + printf("%s", play_synth(my_synth)); + + return 0; +} diff --git a/gen/examples/lib/synth_shed/synth_shed.c b/gen/examples/lib/synth_shed/synth_shed.c new file mode 100644 index 0000000..4f8f8a6 --- /dev/null +++ b/gen/examples/lib/synth_shed/synth_shed.c @@ -0,0 +1,86 @@ +#include "synth_shed.h" +#include +#include +#include +#include + +void init_synth_shed() { + printf("init_synth_shed() - called\n"); +} + +synth_t* synth_create(const char* name) { + synth_t* new = (synth_t*) malloc(sizeof(synth_t)); + assert(new); + if (new != NULL) { + new->model_name = name; + new->osc_count = 1; + new->technolgy = ANALOG; + new->filter.technology = ANALOG; + new->filter.type = LPF; + } + return new; +} + +SYNTH_STATUS synth_set_osc_count(synth_t* synth, int osc_count) { + assert(synth); + SYNTH_STATUS status = 0; + if (osc_count < 0) { + status = 1; + } else { + synth->osc_count = osc_count; + } + return status; +} + + +//SYNTH_STATUS synth_set_filter(synth_t* synth, +// filter_t* filt); +// +//SYNTH_STATUS synth_set_tech(synth_t* synth, +// tech_t tech); + +const char* tech_to_string(const tech_t* const tech) { + assert(tech); + const char* ret = "unknown tech"; + if (*tech == ANALOG) { + return "ANALOG"; + } + if (*tech == DIGITAL) { + return "DIGITAL"; + } + return ret; +} + + +const char* filtertype_to_string(const filtertype_t* const filt) { + assert(filt); + const char* ret = "unknown filtertype"; + if (*filt == LPF) { + ret = "LPF"; + } + if (*filt == HPF) { + ret = "HPF"; + } + if (*filt == BPF) { + ret = "BPF"; + } + return ret; +} + + +const char* play_synth(synth_t* synth) { + assert(synth); + char ret[9999]; + const char* greet = "Playing synth:"; + const char* model = synth->model_name; + + char osc[4]; + sprintf(osc, "%i", synth->osc_count); + + const char* tech = tech_to_string(&synth->technolgy); + const char* filt_tech = tech_to_string(&synth->filter.technology); + const char* filt_type = filtertype_to_string(&synth->filter.type); + + sprintf(ret, "%s\nnamed: %s\nosc: %s\ntech:%s\nfilt:%s / %s\n\n", greet, model, osc, tech, filt_tech, filt_type); + return strdup(ret); +} diff --git a/gen/examples/lib/synth_shed/synth_shed.h b/gen/examples/lib/synth_shed/synth_shed.h new file mode 100644 index 0000000..144d5af --- /dev/null +++ b/gen/examples/lib/synth_shed/synth_shed.h @@ -0,0 +1,65 @@ +#ifndef SYNTH_SHED_H +#define SYNTH_SHED_H + +#ifdef __cplusplus +extern "C" { +#endif + + +// Types (as forward declarations) +// != 0 means ERR +typedef int SYNTH_STATUS; +typedef struct _synth synth_t; +typedef synth_t synth; + +// Enums +typedef enum _filtertype { + HPF, + LPF, + BPF +} filtertype_t; + +typedef enum _tech { + ANALOG, + DIGITAL +} tech_t; + +// Structs +typedef struct _filter { + tech_t technology; + filtertype_t type; +} filter_t; + +struct _synth { + const char* model_name; + int osc_count; + tech_t technolgy; + filter_t filter; +}; + + +// Functions +void init_synth_shed(); + +synth_t* synth_create(const char* name); + +SYNTH_STATUS synth_set_osc_count(synth_t* synth, int osc_count); + +//SYNTH_STATUS synth_set_filter(synth_t* synth, +// filter_t* filt); +// +//SYNTH_STATUS synth_set_tech(synth_t* synth, +// tech_t tech); + +const char* tech_to_string(const tech_t* tech); + +const char* filtertype_to_string(const filtertype_t* filt); + + +const char* play_synth(synth_t* synth); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif //SYNTH_SHED_H diff --git a/gen/examples/lib/test_cid/Makefile b/gen/examples/lib/test_cid/Makefile new file mode 100644 index 0000000..827f905 --- /dev/null +++ b/gen/examples/lib/test_cid/Makefile @@ -0,0 +1,25 @@ +TARGET=test_lib + +SRCS+=$(wildcard *.c) +CFLAGS+=-std=c99 -g +INCLUDES+= +LIB_DIRS+= +LIBS+= +LDFLAGS+= + + +CXXFLAGS+=$(INCLUDES) +LDFLAGS+=$(LIB_DIRS+) +LDFLAGS+=$(LIBS) +OBJS+=$(SRCS:.c=.o) + +.PHONY: all clean + +all: $(TARGET) + +$(TARGET) : $(OBJS) + $(CC) $(LDFLAGS) -o $@ $^ + +clean: + rm -f $(TARGET) + rm -f $(OBJS) diff --git a/gen/examples/lib/test_cid/enums.h b/gen/examples/lib/test_cid/enums.h new file mode 100644 index 0000000..daa9fea --- /dev/null +++ b/gen/examples/lib/test_cid/enums.h @@ -0,0 +1,42 @@ +#ifndef ENUMS_H +#define ENUMS_H + +// 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 + + +// _IE = incomplete enum without anb alias +enum _IE; + +// IE = incomplete enum +// AIE = alias of an incomplete enum +typedef enum IE AIE; + +// _E = enum without an alias +enum _E { + _E1, + _E2, + _E3 +}; + +// E = enum +// AE = alias of an enum +typedef enum E { + E1, + E3, + E2, +} AE; + + +#endif //ENUMS_H diff --git a/gen/examples/lib/test_cid/functions.h b/gen/examples/lib/test_cid/functions.h new file mode 100644 index 0000000..eaccca3 --- /dev/null +++ b/gen/examples/lib/test_cid/functions.h @@ -0,0 +1,39 @@ +#ifndef FUNCTIONS_H +#define FUNCTIONS_H + +#include "typedefs.h" +#include "enums.h" +#include "structs.h" +#include "vars.h" + + +void func_void_void(); + +int func_int_void(); + +void func_void_int(int); + +int func_int_int(int); + +// struct +struct _PS func__PS_V(); + +// enum +enum _E func__E_V(); + +// typedef +T_P func_TP_V(); +void func_V_TP(T_P); +T_P func_TP_TP(T_P); + +APS func_APS_V(); +void func_V_APS(APS); +APS func_APS_APS(APS); + +TPS func_TPS_V(); +void func_V_TPS(TPS); +TPS func_TPS_TPS(TPS); + + + +#endif //FUNCTIONS_H diff --git a/gen/examples/lib/test_cid/main.c b/gen/examples/lib/test_cid/main.c new file mode 100644 index 0000000..4a03cb8 --- /dev/null +++ b/gen/examples/lib/test_cid/main.c @@ -0,0 +1,13 @@ +#include "test_lib.h" +#include + + +int main() { + printf("test_lib starting...\n"); + + + TT_HHS a; + + TT_CCS b; +// printf("%i, %i\n", a.x, a.y); +} diff --git a/gen/examples/lib/test_cid/structs.h b/gen/examples/lib/test_cid/structs.h new file mode 100644 index 0000000..a3ae4f8 --- /dev/null +++ b/gen/examples/lib/test_cid/structs.h @@ -0,0 +1,183 @@ +#ifndef STRUCTS_H +#define STRUCTS_H + +// 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 + + +// _IS = incomplete struct without a typedef (forward decl) +struct _IS; + +// IS = incomplete struct +// AIS = alias of an incomplete struct +typedef struct IS AIS; + +// +// (aliased) struct [ primitive | complex ] +// ---------------------------------------- +// _PS = primitive struct without a an alias + +struct _PS { + int x, y; +}; + +// PS = primitive struct +// APS = Alias of primitive struct +typedef struct PS { + int x, y; +} APS; + +// _CS = complex struct without a an alias +struct _CS { + struct _PS x; + APS y; +}; + +// CS = complex struct +// ACS = alias of a complex struct +typedef struct CS { + APS y; + struct _PS x; +} ACS; + +// _CCS = complex complex struct without an alias +struct _CCS { + ACS x; +}; + +// CCS = complex complex struct +// ACCS = alias of a complex complex struct +typedef struct CCS { + ACS x; +} ACCS; + +// 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 ] +// -------------------------------------------- + +// _HS = hosting struct without an alias +// _NCS = nested complex struct without an alias +struct _HS { + int x, y; + struct _NCS { + ACS x; + } _ncs; +}; + +// (aliased) hosting struct (complex always) +// HS = hosting struct +// AHS = alias of a hosting struct +// _NPS = nested primitive struct (never has alias) +typedef struct HS { + struct _NPS { + int x, y; + } _nps; + int x, y; +} AHS; + + +// doubly nested struct (complex always) +// ------------------------------------- +// (And enums in struct) +// +// _HHS = hosting hosting struct without an alias +// _NHS = nested hosting struct +// _NNPS = nested nested primitve struct +struct _HHS { + int x, y; + struct _NHS { + int x, y; + struct _NNPS { + int x,y; + } _nnps; + } _nhs; +}; + +// HHS = hosting hosting struct +// AHHS = alias of a hosting hosting struct +// _NNCS = nested nested complex struct +// _NENHS = nested enum in nested hosting struct +typedef struct HHS { + int x, y; + struct _NHS1 { + int x, y; + struct _NNCS { + struct _CS a; + } _nncs; + enum _NENHS { + _NENHS1, + _NENHS2, + _NENHS3 + } _nenhs; + } _nhs1; +} AHHS; + + +// _NEHS = nested enum in hosting struct +struct _HS1 { + int x, y; + enum _NEHS { + _NEHS1, + _NEHS2, + _NEHS3 + } _nehs; +}; + + +#endif //STRUCTS_H + diff --git a/gen/examples/lib/test_cid/test_lib.c b/gen/examples/lib/test_cid/test_lib.c new file mode 100644 index 0000000..7458858 --- /dev/null +++ b/gen/examples/lib/test_cid/test_lib.c @@ -0,0 +1,9 @@ +#include "test_lib.h" + +struct _PS func__PS_V() { + return var__PS; +} + +TT_NNPS func_TT_NNPS_V() { + return var_TT_NNPS; +} diff --git a/gen/examples/lib/test_cid/test_lib.h b/gen/examples/lib/test_cid/test_lib.h new file mode 100644 index 0000000..87fded2 --- /dev/null +++ b/gen/examples/lib/test_cid/test_lib.h @@ -0,0 +1,110 @@ +#ifndef MAIN_INCLUDE_H +#define MAIN_INCLUDE_H + +#include "typedefs.h" +#include "enums.h" +#include "structs.h" +#include "functions.h" +#include "vars.h" + +// Gen-CID +// ======= +// Gen-CID generates a C Interface Defintion file (json) given the inputs: +// * headerfile +// * list of function names needed +// * list of var names needed +// The generator searches each function/var in the headerfile (recursively) and collects all the +// types needed (var type, return type, parm types). +// As structs can contain further types, these dependent types need to be collected +// recursively. +// Finally, all the collected types will be resolved to their final underlying type. +// If a type is primitive, nothing needs to be done, cause its already defined. +// But types of typekind struct or enum need to be defined. +// Their definition will be searched for in the headerfile and included in the interface definition +// The CID file contains all the information needed to represent: +// * functions +// * vars +// * structs +// * enums +// Well enough so they can be expressed in pyBind11 +// use "pyBind11-CID" to generate the pyBind11 code out of the CID file. +// +// Gen-CID test library +// -------------------- +// This here is the test main test library for Gen-CID. +// The C language is broken down into its components and common pattern. +// 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 Gen-CID that poses problem +// it is most likely that the scenario can be reproduced using this test lib pretty easily. +// lets say you Gen-CID 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 CID 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 Gen-CID the defintion. + + +// Item Qualitfier +// =============== +// 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 +// +// prefixed underline (e.g _E) means no typedef/alias exists for this item (enum in this case) +// +// Alias vs. Typedef +// ----------------- +// aliased means direct typedef directly, like +// structs and enums only +/* + * typedef struct _X { + int x; + * } X; + * + */ + +// Typedef means, not typdeffed directly, but anywhere, like +/* + * typedef _X X; + * + */ + + +#endif //MAIN_INCLUDE_H diff --git a/gen/examples/lib/test_cid/typedefs.h b/gen/examples/lib/test_cid/typedefs.h new file mode 100644 index 0000000..68f4be8 --- /dev/null +++ b/gen/examples/lib/test_cid/typedefs.h @@ -0,0 +1,133 @@ +#ifndef TYPEDEFS_H +#define TYPEDEFS_H + +#include "structs.h" +#include "enums.h" + +// Typedefs +// ======== +// Typedefs are simply applied to all defined enums and structs, and the +// their respecitve "alias". +// Then a typedef os applied to every typedef (TT*) + +typedef void T_V; +typedef int T_P; + +// typedef struct +// -------------- +// T_IS = typedef of an incomplete struct without a typedef (forward decl) +typedef struct _IS T_IS; +// TIS = typedef of an incomplete struct +typedef struct IS TIS; +// TAIS = typedef of an alias of an incomplete struct +typedef AIS TAIS; +// T_PS = typedef of a primitive struct without a an alias +typedef struct _PS T_PS; +// TPS = typedef of a primitive struct +typedef struct PS TPS; +// TAPS = typedef of an Alias of primitive struct +typedef APS TAPS; +// _CS = complex struct without a an alias +typedef struct _CS T_CS; +// CS = complex struct +typedef struct CS TCS; +// ACS = alias of a complex struct +typedef ACS TACS; +// _CCS = complex complex struct without an alias +typedef struct _CCS T_CCS; +// CCS = complex complex struct +typedef struct CCS TCCS; +// ACCS = alias of a complex complex struct +typedef ACCS TACCS; + +// _HS = hosting struct without an alias +typedef struct _HS T_HS; +// _NCS = nested primitive struct without an alias +typedef struct _NCS T_NCS; +// HS = hosting struct +typedef struct HS THS; +// _NPS = nested primitive struct (never has alias) +typedef struct _NPS T_NPS; +// AHS = alias of a hosting struct +typedef AHS TAHS; + + +// _HHS = hosting hosting struct without an alias +typedef struct _HHS T_HHS; +// _NHS = nested hosting struct +typedef struct _NHS T_NHS; +// _NNPS = nested nested primitve struct +typedef struct _NNPS T_NNPS; + +// HHS = hosting hosting struct +typedef struct HHS THHS; +// AHHS = alias of a hosting hosting struct +typedef AHHS TAHHS; +// _NNCS = nested nested complex struct +typedef struct _NNCS T_NNCS; +// _NENHS = nested enum in nested hosting struct +typedef enum _NENHS T_NENHS; +// _NHS1 = nested hosting struct +typedef struct _NHS1 T_NHS1; + + +// _NEHS = nested enum in hosting struct +typedef struct _HS1 T_HS1; +typedef enum _NEHS T_NEHS; + + +// typedef enum +// ------------ +// T_IE = typedef of an incomplete enum without an alias +typedef enum _IE T_IE; +// TIE = typedef of an incomplete enum +typedef enum IE TIE; +// TAIE = typedef of an alias of an incomplete enum +typedef AIE TAIE; +// T_E = typedef of an enum without an alias +typedef enum _E T_E; +// TE = typedef of an enum +typedef enum E TE; +// TAE = typedef of an alias of an enum +typedef AE TAE; + + +// TT* = typedef of all typedefs above +typedef T_V TT_V; +typedef T_P TT_P; +typedef T_IS TT_IS; +typedef TIS TTIS; +typedef TAIS TTAIS; +typedef T_PS TT_PS; +typedef TPS TTPS; +typedef TAPS TTAPS; +typedef T_CS TT_CS; +typedef TCS TTCS; +typedef TACS TTACS; +typedef T_CCS TT_CCS; +typedef TCCS TTCCS; +typedef TACCS TTACCS; +typedef T_HS TT_HS; +typedef T_NCS TT_NCS; +typedef THS TTHS; +typedef T_NPS TT_NPS; +typedef TAHS TTAHS; +typedef T_HHS TT_HHS; +typedef T_NHS TT_NHS; +typedef T_NNPS TT_NNPS; +typedef THHS TTHHS; +typedef TAHHS TTAHHS; +typedef T_NNCS TT_NNCS; +typedef T_NENHS TT_NENHS; +typedef T_NHS1 TT_NHS1; +typedef T_HS1 TT_HS1; +typedef T_NEHS TT_NEHS; +typedef T_IE TT_IE; +typedef TIE TTIE; +typedef TAIE TTAIE; +typedef T_E TT_E; +typedef TE TTE; +typedef TAE TTAE; + +#endif //TYPEDEFS_H + diff --git a/gen/examples/lib/test_cid/vars.h b/gen/examples/lib/test_cid/vars.h new file mode 100644 index 0000000..4973b18 --- /dev/null +++ b/gen/examples/lib/test_cid/vars.h @@ -0,0 +1,180 @@ +#ifndef VARS_H +#define VARS_H + +#include "typedefs.h" +#include "enums.h" +#include "structs.h" + +// Variables +// ========= +// _V = Void +//void var__V; + +// _P +char var__P; + +// enums +// ===== +// Incomplete types: +// enum _IE var__IE; +// enum IE var_IE; +// AIE var_AIE; + +enum _E var__E ; +enum E var_E; +AE var_AE; + + +// structs +// ======= + +// Incomplete types +// struct _IS var__IS; +// struct IS var_IS; +// AIS var_AIS; + +// primitive structs +struct _PS var__PS; +struct PS var_PS; +APS var_APS; + +// complex structs +struct _CS var__CS; +struct CS var_CS; +ACS var_ACS; + +struct _CCS var__CCS; +struct CCS var_CCS; +ACCS var_ACCS; + +// nested structs / hosting structs +struct _HS var__HS; +struct _NCS var__NCS; + +struct HS var_HS; +struct _NPS var__NPS; +AHS var_AHS; + +struct _HHS var__HHS; +struct _NHS var__NHS; +struct _NNPS var__NNPS; + +struct HHS var_HHS; +struct _NHS1 var__NHS1; +struct _NNCS var__NNCS; + +//nested enum in hosting struct +enum _NENHS var__NENHS; +AHHS var_AHHS; + +struct _HS1 var__HS1; +enum _NEHS var__NEHS; + + +// TYPEDEFS +// ======== + +// Typedefs of primitive +// --------------------- +//TV var_TV; +T_P var_T_P; + +// Typedefs of structs +// ------------------ +// Incomplete types +//T_IS var_T_IS; +//TIS var_TIS; +//TAIS var_TAIS; + +// primitive structs +T_PS var_T_PS; +TPS var_TPS; +TAPS var_TAPS; + +// complex structs +T_CS var_T_CS; +TCS var_TCS; +TACS var_TACS; +T_CCS var_T_CCS; +TCCS var_TCCS; +TACCS var_TACCS; + +// nested structs / hosting structs +T_HS var_T_HS; +T_NCS var_T_NCS; +THS var_THS; +T_NPS var_T_NPS; +TAHS var_TAHS; +T_HHS var_T_HHS; +T_NHS var_T_NHS; +T_NNPS var_T_NNPS; +THHS var_THHS; +TAHHS var_TAHHS; +T_NNCS var_T_NNCS; +T_NENHS var_T_NENHS; +T_NHS1 var_T_NHS1; + +//nested enum in hosting struct +T_HS1 var_T_HS1; +T_NEHS var_T_NEHS; + +// Typedef of enums +// ---------------- +// Incomplete types +//T_IE var_TIE; +//TIE var_TIE; +//TAIE var_TAIE; +T_E var_T_E; +TE var_TE; +TAE var_TAE; + + + +// TYPEDEFS OF TYPEDEFS +// ==================== + +// Typedefs of primitive +// --------------------- +TT_P var_TT_P; + +// Typedefs of structs +// ------------------ +// primitive structs +TT_PS var_TT_PS; +TTPS var_TTPS; +TTAPS var_TTAPS; + +// complex structs +TT_CS var_TT_CS; +TTCS var_TTCS; +TTACS var_TTACS; +TT_CCS var_TT_CCS; +TTCCS var_TTCCS; +TTACCS var_TTACCS; + +// nested structs / hosting structs +TT_HS var_TT_HS; +TT_NCS var_TT_NCS; +TTHS var_TTHS; +TT_NPS var_TT_NPS; +TTAHS var_TTAHS; +TT_HHS var_TT_HHS; +TT_NHS var_TT_NHS; +TT_NNPS var_TT_NNPS; +TTHHS var_TTHHS; +TTAHHS var_TTAHHS; +TT_NNCS var_TT_NNCS; +TT_NENHS var_TT_NENHS; +TT_NHS1 var_TT_NHS1; + +//nested enum in hosting struct +TT_HS1 var_TT_HS1; +TT_NEHS var_TT_NEHS; + +// Typedef of enums +// ---------------- +TT_E var_TT_E; +TTE var_TTE; +TTAE var_TTAE; + +#endif // VARS_H