From f2117906604475fbd6b907ee31925927e72dbdfc Mon Sep 17 00:00:00 2001 From: heck Date: Mon, 14 Dec 2020 20:14:52 +0100 Subject: [PATCH] test_lib forgot half the typedefs and corresponding vars --- gen/data/input/test_data/functions.h | 62 ++---------------------- gen/data/input/test_data/main.c | 10 +++- gen/data/input/test_data/structs.h | 16 +++---- gen/data/input/test_data/test_lib.c | 7 +++ gen/data/input/test_data/typedefs.h | 70 ++++++++++++++++++++++++++-- gen/data/input/test_data/vars.h | 48 +++++++++++++++++++ 6 files changed, 141 insertions(+), 72 deletions(-) diff --git a/gen/data/input/test_data/functions.h b/gen/data/input/test_data/functions.h index 65ffd70..e03d960 100644 --- a/gen/data/input/test_data/functions.h +++ b/gen/data/input/test_data/functions.h @@ -4,68 +4,12 @@ #include "typedefs.h" #include "enums.h" #include "structs.h" +#include "vars.h" -// ret: void -// arg: void -void nada(); - -// ret: void -// arg: primitive -void func1(int a); - -// ret: primitive -// arg: primitive -int func2(int a); - -// ret: aliased_primitive -// arg: aliased_primitive -C func3(B a); - -// ret: aliased_primitive_struct -// arg: primitive -APS func4(int x); - -// ret: primitive -// arg: APS -int func5(APS a); - -// ret: APS -// arg: APS -APS func6(APS a); - -// ret: ACS -// arg: primitive -ACS func7(int a); - -// ret: int -// arg: ACS -int func8(ACS a); - -// ret: struct _CCS -// arg: int -struct _CCS func9(int a); - -// ret: int -// arg: struct _CCS -int func10(struct _CCS a); - -// nested structs -// ret: int -// arg: host_struct -int func11(host_struct a); - -// nested structs -// ret: int -// arg: host_struct -host_struct func12(int a); - - -//void ret , incomplete type arg -// ret: void -// arg: struct _incomplete_S -void func99(struct _incomplete_S a); +struct _PS func__PS_V(); +TT_NNPS func_TT_NNPS_V(); #endif //FUNCTIONS_H diff --git a/gen/data/input/test_data/main.c b/gen/data/input/test_data/main.c index 58cbc5d..547e510 100644 --- a/gen/data/input/test_data/main.c +++ b/gen/data/input/test_data/main.c @@ -3,6 +3,12 @@ int main() { - return 0; -} + printf("test_lib starting...\n"); + + TT_HHS a; + + TT_CCS b; + b.x.x; +// printf("%i, %i\n", a.x, a.y); +} diff --git a/gen/data/input/test_data/structs.h b/gen/data/input/test_data/structs.h index 0074250..7f13d2c 100644 --- a/gen/data/input/test_data/structs.h +++ b/gen/data/input/test_data/structs.h @@ -83,26 +83,26 @@ typedef struct PS { // _CS = complex struct without a an alias struct _CS { - struct _PS *x; - APS *y; + struct _PS x; + APS y; }; // CS = complex struct // ACS = alias of a complex struct typedef struct CS { - APS *y; - struct _PS *x; + APS y; + struct _PS x; } ACS; // _CCS = complex complex struct without an alias struct _CCS { - ACS *x; + ACS x; }; // CCS = complex complex struct // ACCS = alias of a complex complex struct typedef struct CCS { - ACS *x; + ACS x; } ACCS; // Nested structs @@ -118,7 +118,7 @@ typedef struct CCS { struct _HS { int x, y; struct _NCS { - ACS *x; + ACS x; } _ncs; }; @@ -160,7 +160,7 @@ typedef struct HHS { struct _NHS1 { int x, y; struct _NNCS { - struct _CS *a; + struct _CS a; } _nncs; enum _NENHS { _NENHS1, diff --git a/gen/data/input/test_data/test_lib.c b/gen/data/input/test_data/test_lib.c index 58e75a8..7458858 100644 --- a/gen/data/input/test_data/test_lib.c +++ b/gen/data/input/test_data/test_lib.c @@ -1,2 +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/data/input/test_data/typedefs.h b/gen/data/input/test_data/typedefs.h index 56ce845..3b83350 100644 --- a/gen/data/input/test_data/typedefs.h +++ b/gen/data/input/test_data/typedefs.h @@ -1,5 +1,6 @@ #ifndef TYPEDEFS_H #define TYPEDEFS_H + #include "structs.h" #include "enums.h" @@ -63,13 +64,56 @@ typedef struct _PS T_PS; 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; -// nested struct -// T_NPS = typedef of a nested primitive struct without an alias +// _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; -// T_NNPS = typedef of a nested primitive struct without an alias +// 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 @@ -87,6 +131,7 @@ typedef AE TAE; // TT* = typedef of all typedefs + typedef TV TTV; typedef TP TTP; typedef T_IS TT_IS; @@ -95,8 +140,27 @@ 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; diff --git a/gen/data/input/test_data/vars.h b/gen/data/input/test_data/vars.h index 0a72c16..cba2fdc 100644 --- a/gen/data/input/test_data/vars.h +++ b/gen/data/input/test_data/vars.h @@ -62,11 +62,59 @@ struct _NNPS var__NNPS; struct HHS var_HHS; struct _NHS1 var__NHS1; struct _NNCS var__NNCS; + enum _NENHS var__NENHS; AHHS var_ASHS; struct _HS1 var__HS1; enum _NEHS var_NEHS1; +// Typedefs of primitive +//TV var_TV; +TP var_TP; + +// Typedef of structs +// Incomplete types +//T_IS var_T_IS; +//TIS var_TIS; +//TAIS var_TAIS; +T_PS var_T_PS; +TPS var_TPS; +TAPS var_TAPS; +T_NPS var_T_NPS; +T_NNPS var_T_NNPS; + +// 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; + +// Typedef of typedefs +//TTV var_TTV; +TTP var_TTP; + +// incomplete +//TT_IS var_TT_IS; +//TTIS var_TTIS; +//TTAIS var_TTAIS; +TT_PS var_TT_PS; +TTPS var_TTPS; +TTAPS var_TTAPS; +TT_NPS var_TT_NPS; +TT_NNPS var_TT_NNPS; + +// incomplete +//TT_IE var_TT_IE; +//TTIE var_TTIE; +//TTAIE var_TTAIE; +TT_E var_TT_E; +TTE var_TTE; +TAE var_TTAE; + + #endif // VARS_H