koliseo 0.4.9
|
Go to the source code of this file.
Data Structures | |
struct | KLS_Region |
Represents an allocated memory region in a Koliseo. More... | |
struct | KLS_list_region |
Defines the node for a KLS_Region_List. More... | |
struct | KLS_Autoregion_Extension_Conf |
struct | KLS_Autoregion_Extension_Data |
Macros | |
#define | _POSIX_C_SOURCE 200809L |
#define | KLS_AUTOREGION_ALLOC_DEFAULT KLS_REGLIST_ALLOC_KLS_BASIC |
#define | KLS_AUTOREGION_REGLIST_SIZE_DEFAULT KLS_DEFAULT_SIZE |
#define | KLS_AUTOREGION_AUTOSET_TEMP_DEFAULT 1 |
#define | KLS_AUTOREGION_ALLOC_TEMP_DEFAULT KLS_REGLIST_ALLOC_KLS_BASIC |
#define | KLS_AUTOREGION_REGLIST_TEMP_SIZE_DEFAULT KLS_DEFAULT_SIZE |
#define | KLS_REGIONTYPE_MAX KLS_Header |
Defines max index for Koliseo's own Region_Type values. | |
#define | KLS_REGION_MAX_NAME_SIZE 15 |
Defines max size for KLS_Region's name field. | |
#define | KLS_REGION_MAX_DESC_SIZE 20 |
Defines max size for KLS_Region's desc field. | |
#define | KLS_DEFAULT_HOOKS |
#define | KLS_PUSH_ARR_NAMED(kls, type, count, name, desc) |
#define | KLS_PUSH_ARR_TYPED(kls, type, count, region_type, name, desc) |
#define | KLS_PUSH_ARR_T_NAMED(kls_temp, type, count, name, desc) |
#define | KLS_PUSH_ARR_T_TYPED(kls_temp, type, count, region_type, name, desc) |
#define | KLS_RL_GETLIST() |
#define | KLS_RL_FREELIST(kls_list) |
#define | kls_showList(list) |
#define | kls_showList_toFile(list, fp) |
#define | KLS_RL_ECHOLIST(kls_list) |
#define | KLS_RL_PRINTLIST(kls_list, file) |
#define | KLS_RL_PUSHLIST(kls, reg, kls_list) |
#define | KLS_RL_PUSHLIST_P(kls, reg, kls_list) |
#define | KLS_RL_DIFF(kls, kls_list1, kls_list2) |
Typedefs | |
typedef enum KLS_RegList_Alloc_Backend | KLS_RegList_Alloc_Backend |
Defines allocation backend for KLS_Region_List items. | |
typedef enum KLS_Region_Type | KLS_Region_Type |
Represents a type index for Regions. | |
typedef struct KLS_Region | KLS_Region |
Represents an allocated memory region in a Koliseo. | |
typedef KLS_Region * | KLS_list_element |
Redundant typedef to better denote the actual value field of a KLS_region_list_item. | |
typedef struct KLS_list_region | KLS_region_list_item |
Defines the node for a KLS_Region_List. | |
typedef KLS_region_list_item * | KLS_Region_List |
typedef struct KLS_Autoregion_Extension_Conf | KLS_Autoregion_Extension_Conf |
typedef struct KLS_Autoregion_Extension_Data | KLS_Autoregion_Extension_Data |
Enumerations | |
enum | KLS_RegList_Alloc_Backend { KLS_REGLIST_ALLOC_LIBC = 0 , KLS_REGLIST_ALLOC_KLS_BASIC , KLS_REGLIST_TOTAL_BACKENDS } |
Defines allocation backend for KLS_Region_List items. More... | |
enum | KLS_Region_Type { KLS_None = 0 , Temp_KLS_Header = 1 , KLS_Header = 2 } |
Represents a type index for Regions. More... |
Functions | |
const char * | kls_reglist_backend_string (KLS_RegList_Alloc_Backend kls_be) |
Returns the string corresponding to passed kls_be. | |
void | KLS_autoregion_on_new (struct Koliseo *kls) |
void | KLS_autoregion_on_free (struct Koliseo *kls) |
void | KLS_autoregion_on_push (struct Koliseo *kls, ptrdiff_t padding, const char *caller, void *user) |
void | KLS_autoregion_on_temp_start (struct Koliseo_Temp *t_kls) |
void | KLS_autoregion_on_temp_free (struct Koliseo_Temp *t_kls) |
void | KLS_autoregion_on_temp_push (struct Koliseo_Temp *t_kls, ptrdiff_t padding, const char *caller, void *user) |
void * | kls_push_zero_named (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count, char *name, char *desc) |
Takes a Koliseo pointer, and ptrdiff_t values for size, align and count. | |
void * | kls_push_zero_typed (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count, int type, char *name, char *desc) |
Takes a Koliseo pointer, a KLS_Region_Type index, and ptrdiff_t values for size, align and count. | |
void * | kls_temp_push_zero_named (Koliseo_Temp *t_kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count, char *name, char *desc) |
Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count. | |
void * | kls_temp_push_zero_typed (Koliseo_Temp *t_kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count, int type, char *name, char *desc) |
Takes a Koliseo_Temp, a KLS_Region_Type index, and ptrdiff_t values for size, align and count. | |
KLS_Region_List | kls_rl_emptyList (void) |
bool | kls_rl_empty (KLS_Region_List) |
KLS_list_element | kls_rl_head (KLS_Region_List) |
KLS_Region_List | kls_rl_tail (KLS_Region_List) |
KLS_Region_List | kls_rl_cons (Koliseo *, KLS_list_element, KLS_Region_List) |
KLS_Region_List | kls_rl_t_cons (Koliseo_Temp *, KLS_list_element, KLS_Region_List) |
void | kls_rl_freeList (KLS_Region_List) |
Frees all values and nodes for passed Region list. | |
void | kls_rl_showList (KLS_Region_List) |
void | kls_rl_showList_toFile (KLS_Region_List, FILE *fp) |
bool | kls_rl_member (KLS_list_element, KLS_Region_List) |
int | kls_rl_length (KLS_Region_List) |
KLS_Region_List | kls_rl_append (Koliseo *, KLS_Region_List, KLS_Region_List) |
KLS_Region_List | kls_rl_reverse (Koliseo *, KLS_Region_List) |
KLS_Region_List | kls_rl_copy (Koliseo *, KLS_Region_List) |
KLS_Region_List | kls_rl_delete (Koliseo *, KLS_list_element, KLS_Region_List) |
KLS_Region_List | kls_rl_insord (Koliseo *, KLS_list_element, KLS_Region_List) |
KLS_Region_List | kls_rl_insord_p (Koliseo *, KLS_list_element, KLS_Region_List) |
bool | kls_rl_isLess (KLS_list_element, KLS_list_element) |
bool | kls_rl_isEqual (KLS_list_element, KLS_list_element) |
KLS_Region_List | kls_rl_mergeList (Koliseo *, KLS_Region_List, KLS_Region_List) |
KLS_Region_List | kls_rl_intersect (Koliseo *, KLS_Region_List, KLS_Region_List) |
KLS_Region_List | kls_rl_diff (Koliseo *, KLS_Region_List, KLS_Region_List) |
double | kls_usageShare (KLS_list_element, Koliseo *) |
ptrdiff_t | kls_regionSize (KLS_list_element) |
ptrdiff_t | kls_avg_regionSize (Koliseo *) |
Return average region size in usage for the passed Koliseo. | |
void | kls_usageReport_toFile (Koliseo *, FILE *) |
Prints an usage report for the passed Koliseo to the passed file. | |
void | kls_usageReport (Koliseo *) |
Print usage report for passed Koliseo to stdout. | |
ptrdiff_t | kls_type_usage (int, Koliseo *) |
Calc memory used by the specific type of KLS_list_element. | |
ptrdiff_t | kls_total_padding (Koliseo *) |
Calc memory used as padding for the passed Koliseo. |
Variables | |
const char * | kls_reglist_backend_strings [KLS_REGLIST_TOTAL_BACKENDS] |
Defines strings for KLS_RegList_Alloc_Backend values. |
#define _POSIX_C_SOURCE 200809L |
#define KLS_AUTOREGION_ALLOC_DEFAULT KLS_REGLIST_ALLOC_KLS_BASIC |
#define KLS_AUTOREGION_ALLOC_TEMP_DEFAULT KLS_REGLIST_ALLOC_KLS_BASIC |
#define KLS_AUTOREGION_AUTOSET_TEMP_DEFAULT 1 |
#define KLS_AUTOREGION_REGLIST_SIZE_DEFAULT KLS_DEFAULT_SIZE |
#define KLS_AUTOREGION_REGLIST_TEMP_SIZE_DEFAULT KLS_DEFAULT_SIZE |
#define KLS_DEFAULT_HOOKS |
#define KLS_PUSH_ARR_NAMED | ( | kls, | |
type, | |||
count, | |||
name, | |||
desc ) |
#define KLS_PUSH_ARR_T_NAMED | ( | kls_temp, | |
type, | |||
count, | |||
name, | |||
desc ) |
#define KLS_PUSH_ARR_T_TYPED | ( | kls_temp, | |
type, | |||
count, | |||
region_type, | |||
name, | |||
desc ) |
#define KLS_PUSH_ARR_TYPED | ( | kls, | |
type, | |||
count, | |||
region_type, | |||
name, | |||
desc ) |
#define KLS_REGION_MAX_DESC_SIZE 20 |
Defines max size for KLS_Region's desc field.
#define KLS_REGION_MAX_NAME_SIZE 15 |
Defines max size for KLS_Region's name field.
#define KLS_REGIONTYPE_MAX KLS_Header |
Defines max index for Koliseo's own Region_Type values.
#define KLS_RL_DIFF | ( | kls, | |
kls_list1, | |||
kls_list2 ) |
#define KLS_RL_ECHOLIST | ( | kls_list | ) |
#define KLS_RL_FREELIST | ( | kls_list | ) |
#define KLS_RL_GETLIST | ( | ) |
#define KLS_RL_PRINTLIST | ( | kls_list, | |
file ) |
#define KLS_RL_PUSHLIST | ( | kls, | |
reg, | |||
kls_list ) |
#define KLS_RL_PUSHLIST_P | ( | kls, | |
reg, | |||
kls_list ) |
#define kls_showList | ( | list | ) |
#define kls_showList_toFile | ( | list, | |
fp ) |
typedef struct KLS_Autoregion_Extension_Conf KLS_Autoregion_Extension_Conf |
typedef struct KLS_Autoregion_Extension_Data KLS_Autoregion_Extension_Data |
typedef KLS_Region* KLS_list_element |
Redundant typedef to better denote the actual value field of a KLS_region_list_item.
typedef struct KLS_Region KLS_Region |
Represents an allocated memory region in a Koliseo.
typedef KLS_region_list_item* KLS_Region_List |
typedef struct KLS_list_region KLS_region_list_item |
Defines the node for a KLS_Region_List.
typedef enum KLS_Region_Type KLS_Region_Type |
Represents a type index for Regions.
typedef enum KLS_RegList_Alloc_Backend KLS_RegList_Alloc_Backend |
Defines allocation backend for KLS_Region_List items.
enum KLS_Region_Type |
Defines allocation backend for KLS_Region_List items.
Enumerator | |
---|---|
KLS_REGLIST_ALLOC_LIBC | |
KLS_REGLIST_ALLOC_KLS_BASIC | |
KLS_REGLIST_TOTAL_BACKENDS |
void KLS_autoregion_on_free | ( | struct Koliseo * | kls | ) |
void KLS_autoregion_on_new | ( | struct Koliseo * | kls | ) |
void KLS_autoregion_on_push | ( | struct Koliseo * | kls, |
ptrdiff_t | padding, | ||
const char * | caller, | ||
void * | user ) |
void KLS_autoregion_on_temp_free | ( | struct Koliseo_Temp * | t_kls | ) |
void KLS_autoregion_on_temp_push | ( | struct Koliseo_Temp * | t_kls, |
ptrdiff_t | padding, | ||
const char * | caller, | ||
void * | user ) |
void KLS_autoregion_on_temp_start | ( | struct Koliseo_Temp * | t_kls | ) |
ptrdiff_t kls_avg_regionSize | ( | Koliseo * | kls | ) |
Return average region size in usage for the passed Koliseo.
kls | The Koliseo to check usage for. |
void * kls_push_zero_named | ( | Koliseo * | kls, |
ptrdiff_t | size, | ||
ptrdiff_t | align, | ||
ptrdiff_t | count, | ||
char * | name, | ||
char * | desc ) |
Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.
Tries pushing the specified amount of memory to the Koliseo data field, or goes to exit() if the operation fails. Uses the passed name and desc fields to initialise the allocated KLS_Region fields. Notably, it zeroes the memory region.
kls | The Koliseo at hand. |
size | The size for data to push. |
align | The alignment for data to push. |
count | The multiplicative quantity to scale data size to push for. |
name | The name to assign to the resulting KLS_Region. |
desc | The desc to assign to the resulting KLS_Region. |
void * kls_push_zero_typed | ( | Koliseo * | kls, |
ptrdiff_t | size, | ||
ptrdiff_t | align, | ||
ptrdiff_t | count, | ||
int | type, | ||
char * | name, | ||
char * | desc ) |
Takes a Koliseo pointer, a KLS_Region_Type index, and ptrdiff_t values for size, align and count.
Tries pushing the specified amount of memory to the Koliseo data field, or goes to exit() if the operation fails. Uses the passed name and desc fields to initialise the allocated KLS_Region fields. Notably, it zeroes the memory region.
kls | The Koliseo at hand. |
size | The size for data to push. |
align | The alignment for data to push. |
count | The multiplicative quantity to scale data size to push for. |
type | The type index for pushed KLS_Region. |
name | The name to assign to the resulting KLS_Region. |
desc | The desc to assign to the resulting KLS_Region. |
ptrdiff_t kls_regionSize | ( | KLS_list_element | ) |
const char * kls_reglist_backend_string | ( | KLS_RegList_Alloc_Backend | kls_be | ) |
Returns the string corresponding to passed kls_be.
KLS_Region_List kls_rl_append | ( | Koliseo * | kls, |
KLS_Region_List | l1, | ||
KLS_Region_List | l2 ) |
KLS_Region_List kls_rl_cons | ( | Koliseo * | kls, |
KLS_list_element | e, | ||
KLS_Region_List | l ) |
KLS_Region_List kls_rl_copy | ( | Koliseo * | kls, |
KLS_Region_List | l ) |
KLS_Region_List kls_rl_delete | ( | Koliseo * | kls, |
KLS_list_element | el, | ||
KLS_Region_List | l ) |
KLS_Region_List kls_rl_diff | ( | Koliseo * | kls, |
KLS_Region_List | l1, | ||
KLS_Region_List | l2 ) |
bool kls_rl_empty | ( | KLS_Region_List | l | ) |
KLS_Region_List kls_rl_emptyList | ( | void | ) |
void kls_rl_freeList | ( | KLS_Region_List | l | ) |
Frees all values and nodes for passed Region list.
Should only be used internally for operations with ALLOC_LIBC for allocation backend.
l | The list to free (allocated by using malloc). |
KLS_list_element kls_rl_head | ( | KLS_Region_List | l | ) |
KLS_Region_List kls_rl_insord | ( | Koliseo * | kls, |
KLS_list_element | el, | ||
KLS_Region_List | l ) |
KLS_Region_List kls_rl_insord_p | ( | Koliseo * | kls, |
KLS_list_element | el, | ||
KLS_Region_List | l ) |
KLS_Region_List kls_rl_intersect | ( | Koliseo * | kls, |
KLS_Region_List | l1, | ||
KLS_Region_List | l2 ) |
bool kls_rl_isEqual | ( | KLS_list_element | , |
KLS_list_element | ) |
bool kls_rl_isLess | ( | KLS_list_element | , |
KLS_list_element | ) |
int kls_rl_length | ( | KLS_Region_List | l | ) |
bool kls_rl_member | ( | KLS_list_element | el, |
KLS_Region_List | l ) |
KLS_Region_List kls_rl_mergeList | ( | Koliseo * | kls, |
KLS_Region_List | l1, | ||
KLS_Region_List | l2 ) |
KLS_Region_List kls_rl_reverse | ( | Koliseo * | kls, |
KLS_Region_List | l ) |
void kls_rl_showList | ( | KLS_Region_List | l | ) |
void kls_rl_showList_toFile | ( | KLS_Region_List | l, |
FILE * | fp ) |
KLS_Region_List kls_rl_t_cons | ( | Koliseo_Temp * | t_kls, |
KLS_list_element | e, | ||
KLS_Region_List | l ) |
KLS_Region_List kls_rl_tail | ( | KLS_Region_List | l | ) |
void * kls_temp_push_zero_named | ( | Koliseo_Temp * | t_kls, |
ptrdiff_t | size, | ||
ptrdiff_t | align, | ||
ptrdiff_t | count, | ||
char * | name, | ||
char * | desc ) |
Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count.
Tries pushing the specified amount of memory to the referred Koliseo data field, or goes to exit() if the operation fails. Uses the passed name and desc fields to initialise the allocated KLS_Region fields. Notably, it zeroes the memory region.
t_kls | The Koliseo_Temp at hand. |
size | The size for data to push. |
align | The alignment for data to push. |
count | The multiplicative quantity to scale data size to push for. |
name | The name to assign to the resulting KLS_Region. |
desc | The desc to assign to the resulting KLS_Region. |
void * kls_temp_push_zero_typed | ( | Koliseo_Temp * | t_kls, |
ptrdiff_t | size, | ||
ptrdiff_t | align, | ||
ptrdiff_t | count, | ||
int | type, | ||
char * | name, | ||
char * | desc ) |
Takes a Koliseo_Temp, a KLS_Region_Type index, and ptrdiff_t values for size, align and count.
Tries pushing the specified amount of memory to the referred Koliseo data field, or goes to exit() if the operation fails. Uses the passed name and desc fields to initialise the allocated KLS_Region fields. Notably, it zeroes the memory region.
t_kls | The Koliseo_Temp at hand. |
size | The size for data to push. |
align | The alignment for data to push. |
count | The multiplicative quantity to scale data size to push for. |
type | The type index for pushed KLS_Region. |
name | The name to assign to the resulting KLS_Region. |
desc | The desc to assign to the resulting KLS_Region. |
ptrdiff_t kls_total_padding | ( | Koliseo * | kls | ) |
Calc memory used as padding for the passed Koliseo.
kls | The Koliseo to check total padding for. |
ptrdiff_t kls_type_usage | ( | int | type, |
Koliseo * | kls ) |
Calc memory used by the specific type of KLS_list_element.
type | The integer corresponding to element->type |
kls | The Koliseo to check usage for. |
void kls_usageReport | ( | Koliseo * | kls | ) |
Print usage report for passed Koliseo to stdout.
kls | The Koliseo to print info for. |
void kls_usageReport_toFile | ( | Koliseo * | kls, |
FILE * | fp ) |
Prints an usage report for the passed Koliseo to the passed file.
kls | The Koliseo to check. |
fp | The file pointer to print to. |
double kls_usageShare | ( | KLS_list_element | , |
Koliseo * | ) |
|
extern |
Defines strings for KLS_RegList_Alloc_Backend values.