11 #define CMPR(T, NAME) e_cmpr NAME(t_gen x, t_gen y)\
14 T tmp = (*((T*)(x))) - (*((T*)(y)));\
24 #define ASSGN(T, NAME) t_gen NAME(T y) \
26 t_gen x = get_mem(1, sizeof(T));\
33 #define SWAP(T, NAME) void NAME(t_gen x, t_gen y) \
43 #define FMT_SPF(T) _Generic((T),\
45 signed char: "%hhd", \
46 unsigned char: "%hhu", \
47 signed short: "%hd", \
48 unsigned short: "%hu", \
52 unsigned long int: "%lu", \
53 long long int: "%lld", \
54 unsigned long long int: "%llu", \
63 #define PRINT_GEN(T, NAME) void NAME(t_gen x) \
66 printf(FMT_SPF(y), *((T*)x)); \
70 #define CMPR_IDX(T, NAME) e_cmpr NAME(t_gen x, int idx1, int idx2)\
74 T tmp = arr[idx1] -arr[idx2];\
83 #define SWP_IDX(T, NAME) void NAME(t_gen x, int idx1, int idx2)\
87 arr[idx1] = arr[idx2];\
92 #define COPY_IDX(T, NAME) void NAME(t_gen x, int idx1, t_gen data)\
95 arr[idx1] = *((T*)(data));\
99 #define GET_IDX(T, NAME) t_gen NAME(t_gen x, int idx1)\
102 t_gen tmp = &arr[idx1] ;\
107 #define GET_IDX_CPY(T, NAME) t_gen NAME(t_gen x, int idx1)\
110 t_gen tmp = get_mem(1, sizeof(T));\
111 *(T*)tmp = arr[idx1] ;\
t_gen get_idx_int(t_gen, int)
void swap_idx_char(t_gen, int, int)
void copy_idx_int(t_gen, int, t_gen)
t_gen assign_float(float)
t_gen gen_get_idx(t_gen x, int idx1)
e_cmpr compare_idx_char(t_gen, int, int)
void gen_swp_idx(t_gen x, int idx1, int idx2)
e_cmpr compare_string(t_gen, t_gen)
t_gen get_idx_int_cpy(t_gen, int)
t_gen get_idx_char_cpy(t_gen, int)
void copy_idx_char(t_gen, int, t_gen)
e_cmpr compare_gen(t_gen, t_gen)
e_cmpr compare_int(t_gen, t_gen)
t_gen assign_string(char *)
void gen_cpy_idx(t_gen x, int idx1, t_gen data)
e_cmpr gen_cmpr_idx(t_gen x, int idx1, int idx2)
e_cmpr compare_char(t_gen, t_gen)
Below routines defined as reference for basic datatypes.
t_gen get_idx_float(t_gen, int)
void swap_int(t_gen, t_gen)
void swap_gen(t_gen, t_gen)
void swap_char(t_gen, t_gen)
e_cmpr compare_float(t_gen, t_gen)
t_gen get_idx_float_cpy(t_gen, int)
void copy_idx_float(t_gen, int, t_gen)
t_gen get_idx_char(t_gen, int)
void swap_idx_int(t_gen, int, int)
void swap_string(t_gen, t_gen)
void swap_float(t_gen, t_gen)
e_cmpr compare_idx_int(t_gen, int, int)
e_cmpr compare_idx_float(t_gen, int, int)
void swap_idx_float(t_gen, int, int)
Contains decalration of structures for maintaing all mem alloc and frees.
Contains typedefs for all necessary data type and function pointers.
void * t_gen
Base Data type used for all data structure and data elements.
e_cmpr
Custom Compare function return type.