The base module containing common functions for working with memory, strings, lists, logging, etc.
dap_binary_tree.h dap_binary_tree.c
dap_binary_tree_insert() - inserting a new element into the tree according to the value of element key
dap_binary_tree_search() - searches for a tree element by key, returns the data of the found node
dap_binary_tree_minimum() - gets the tree element with the minimum (in strcmp() logic) key value
dap_binary_tree_maximum() - gets the tree element with the maximum (in strcmp() logic) key value
dap_binary_tree_count() - counting nodes in a tree
dap_binary_tree_inorder_list() - converting a binary tree (dap_binary_tree_t) to a doubly linked ordered (by key value) list (dap_list_t)
dap_binary_tree_delete() -finds in the tree and removes the element with the given key
dap_binary_tree_clear() - deleting the entire tree and freeing the memory it occupies
DAP_ALIGN_PACKED - structure packing (explicitly aligning elements by byte size, preventing automatic alignment of structure elements by word size)
DAP_NEW(t) - memory allocation for an object of type t
DAP_NEW_Z(t) - allocation of memory for an object of type t
, with initial initialization of the allocated bytes to zeros ("_Z" - zero)
DAP_NEW_SIZE(t, s) - allocation of memory of size s
for an object of type t
DAP_NEW_S(t) - memory allocation for an object of type t
on the stack ("_S" - stack)
DAP_DELETE(p) - freeing memory from under the object * p
... and a few more related macros: DAP_MALLOC (a), DAP_DUP (a), etc.
log_it(_log_level, ...) - writing to the log depending on the logging levels (writing is made if _log_level
(level for the current record) >= s_dap_log_level
(level for the application as a whole)
dap_common_init() - common functions module initialization
wdap_common_init() - the same, for WIN32
dap_common_deinit() - common functions module deinitialization
dap_get_appname() - get application name
dap_set_appname() - set application name
dap_log_level_get() - get the logging level of the application
dap_log_level_set() - setting the logging level for the application
dap_log_get_item() - get log entry
dap_log_set_max_item() - set max. number of entries in the log
dap_set_log_tag_width() - set the width of the text field for LOG_TAG
_log_it() - the logging function used by the log_it() macro
dap_itoa() - string representation of an integer
dap_digit_from_string() - convert string to number
dap_ctime_r() - converting time_t to string
dap_time_to_str_rfc822() - translates a value of type time_t
into a string according to RFC822 format
timespec_diff() - calculating the time interval between two timespec
values
dap_hex2bin() - converting data from HEX to binary
dap_bin2hex() - converting binary data to HEX format
dap_uint_to_hex() - unsigned integer -> HEX
dap_hex_to_uint() - HEX -> unsigned integer
dap_lendian_get16() - get 16-bit unsigned integer (uint16) from memory in LE byte order (Little Endian, least significant byte - at the lowest address)
dap_lendian_put16() - put uint16 in LE memory
dap_lendian_get32() - get uint32 from little endian memory
dap_lendian_put32() - put uint32 in LE memory
dap_lendian_get64() - get uint64 from little endian memory
dap_lendian_put64() - put uint64 in LE memory
exec_with_ret() - execution of a shell command passed to the function as an argument
dap_random_string_create_alloc() - allocating memory for a string on the heap, filling the string with random characters
dap_random_string_fill() - filling a string with random characters
dap_interval_timer_create() - creating a timer, setting a callback
dap_interval_timer_delete() - delete timer
dap_interval_timer_deinit() - deleting all existing timers
dap_usleep() - pause in the execution of the thread for the specified number of microseconds
dap_config_init() - configuration module initialization
dap_config_deinit() - configuration module deinitialization
dap_config_open() - open and read the configuration file, fill in the *g_config structure with data
dap_config_close() - remove *g_config structure from memory
dap_config_path() - get the path to the directory with configuration files
dap_config_get_item_str() - get the value string of the configuration element
dap_config_get_item_str_default() - get configuration element value string or default value
dap_config_get_array_str() - get the value of the configuration element as an array of strings
dap_config_get_item_uint16() - get the value of the configuration element, converting it to the uint16_t type
dap_config_get_item_uint16_default() - get the value of the configuration element by converting it to the uint16_t type, or the default uint16_t value
dap_config_get_item_int16() - get the value of the configuration element and convert it to int16_t
dap_config_get_item_int16_default() - get the value of the configuration element with converting it to the int16_t type, or the default int16_t value
dap_config_get_item_uint32() - get the value of the configuration element, converting it to the uint32_t type
dap_config_get_item_uint32_default() - get the value of the configuration element with converting it to the uint32_t type, or the default uint32_t value
dap_config_get_item_int32() - get the value of the configuration element and convert it to int32_t
dap_config_get_item_int32_default() - get the value of the configuration element with converting it to the int32_t type, or the default int32_t value
dap_config_get_item_uint64() - get the value of the configuration element and convert it to type uint64_t
dap_config_get_item_uint64_default() - get the value of the configuration element with its conversion to the uint64_t type, or the default uint64_t-value
dap_config_get_item_int64() - get the value of the configuration element and convert it to type int64_t
dap_config_get_item_int64_default() - get the value of the configuration element with its conversion to the int64_t type, or the default int64_t value
dap_config_get_item_double() - get the value of the configuration element with its conversion to double type
dap_config_get_item_double_default() - get the value of the configuration element with its conversion to the double type, or the default double value
dap_config_get_item_bool() - get the value of the configuration element and convert it to the bool type
dap_config_get_item_bool_default() - get the value of the configuration element with its conversion to the bool type, or the default boolean value
dap_file_utils.h dap_file_utils.c
dap_valid_ascii_symbols() - checks a string for unsupported symbols
dap_file_test() - checks if a file exists
dap_dir_test() - checks if a directory exists
dap_path_is_absolute() - checks if the given file name is an absolute file name
dap_mkdir_with_parents() - creates a new directory with the specified path, creating parent directories if none exist
dap_file_get_contents() - reads an entire file into allocated memory, with error checking
dap_path_get_dirname() - gets the list of the components of a file path other than the file name
dap_path_get_basename() - gets the last component of the file path (file name)
dap_path_get_ext() - gets the extension component of a file name
dap_list_previous(list) - gets the previous element of the list
dap_list_next(list) - gets the next element of the list
Functions:
dap_list_alloc() - allocates memory space for a new list node
dap_list_free() - deallocates space used for all nodes in a list except for memory allocated dynamically for each node data
dap_list_free1() - deallocates the space used for one node of a list except for memory allocated dynamically for the node data
dap_list_free_full() - deallocates the space used for all nodes in a list by a special function passed as an argument
dap_list_append() - adds a new node to the end of a list
dap_list_prepend() - prepends a new element on to the start of the list
dap_list_insert() - inserts a new element into the list at the given position
dap_list_insert_before() - inserts a new element into the list before the given position
dap_list_insert_sorted() - inserts a new element into the list, using the given comparison function to determine its position
dap_list_insert_sorted_with_data() - inserts a new element into the list, using the given comparison function to determine its position
dap_list_concat() - adds the second list onto the end of the first list
dap_list_remove() - removes an element from a list; if two elements contain the same data, only the first is removed
dap_list_remove_all() - removes all list nodes with data equal to data
dap_list_remove_link() - removes an element from a list, without freeing the element
dap_list_delete_link() - removes a node from a list and frees it
dap_list_reverse() - switches the next and prev pointers of each element
dap_list_copy() - copies a list (dap_list_t)
dap_list_copy_deep() - copies a list (dap_list_t) with all it's elements by a special function passed as an argument
dap_list_nth() - gets the element at the given position in a list
dap_list_nth_prev() - gets the element n places before list
dap_list_nth_data() - gets the data of the element at the given position
dap_list_find() - finds the element in a list which contains the given data
dap_list_find_custom() - finds an element in a list, using a supplied function to find the desired element
dap_list_position() - gets the position of the given element in the list
dap_list_index() - gets the position of the element containing the given data (starting from 0)
dap_list_last() - gets the last element in a list
dap_list_first() - gets the first element in a list
dap_list_length() - gets the length of a list
dap_list_foreach() - calls a function for each element of a list
dap_list_sort() - sorts a list using the given comparison function; the algorithm used is a stable sort
dap_list_sort_with_data() - like dap_list_sort(), but the comparison function accepts a user data argument
dap_strlen() - getting string length
dap_strcmp() - character-by-character comparison of two strings
dap_strncmp() - comparing strings with a limit on the number of characters compared
dap_strdup() - copies a string to a string allocated on the heap
dap_strdup_printf() - creates a string on the heap, copies a format string into it; analogue of asprintf
dap_strdup_vprintf() - creates a string on the heap, copies a format string with a list of arguments into it; analogue of vasprintf
dap_stpcpy() - copies a string, returns a pointer to ending null-character in the copy
dap_strstr_len() - search for a substring, with a limit on the length of the string in which the search is performed
dap_strjoin() - concatenation of multiple strings passed as arguments into a single heap-allocated string
dap_strjoinv() - concatenation of an array of strings passed as an argument into one string allocated on the heap
dap_strsplit() - splitting a string into substrings by labels within the string; the result is a pointer to a heap-allocated array of substrings
dap_str_countv() - counting the number of lines in an array of strings
dap_strdupv() - copying an array of strings, a copy is allocated on the heap
dap_strfreev() - freeing memory from under the array of strings
dap_strchug() - removes whitespace characters at the beginning of the string, shifting the next part of the string to the beginning
dap_strchomp() - removes space chars at the end of the string, replacing them with null characters
dap_strstrip() - trims whitespace at both the beginning and end of the string
dap_strup() - converts all ASCII letters of a string to uppercase, places the resulting string in the heap
dap_strdown() - converts all ASCII letters of a string to lowercase, places the resulting string in the heap
dap_strreverse() - inverts the string, for example: "abcde" -> "edcba"
dap_strtou128() - converting unsigned integer from string form to uint128_t
dap_atou128() - converting an integer unsigned decimal number from string form to uint128_t
dap_strtoi128() - converting an integer from string representation to int128_t
dap_atoi128() - converting integer decimal number from string representation to int128_t
dap_utoa128() - converting unsigned integer uint128_t to string
dap_itoa128() - converting integer int128_t to string
dap_string_new() - creates a new dap_string_t structure, initialized with the given string
dap_string_new_len() - creates a new dap_string_t structure, initialized with the cpecified number of bytes of the given string
dap_string_sized_new() - creates a new dap_string_t structure with enough space for the string whose size is passed as an argument
dap_string_free() - frees the memory of the dap_string_t structure with or without freeing the space allocated for the string element (hereinafter referred to as "dap-string")
dap_string_equal() - compares two strings from dap_string_t structures ("dap-strings") for equality
dap_string_hash() - calculates a simple hash code of a dap-string
dap_string_append() - adds a string to the end of the dap-string, expanding the dap-string if necessary (we do not write about this everywhere, but everywhere for dap-strings this is implied)
dap_string_append_c() - adds a byte to the end of a dap-string
dap_string_append_len() - adds n bytes of the given string to the end of the dap-string
dap_string_append_unichar() - converts a Unicode character into UTF-8, and adds it to the end of the dap-string
dap_string_append_printf() - adds a formatted string to the end of the dap-string
dap_string_append_vprintf() - adds a formatted string (with va_list args) to the end of the dap-string
dap_string_prepend() - adds a string to the beginning of the dap-string, expanding the dap-string if necessary
dap_string_prepend_c() - adds a byte to the beginning of the dap-string
dap_string_prepend_len() - adds n bytes to the beginning of the dap-string
dap_string_prepend_unichar() - converts a Unicode character into UTF-8, and adds it to the beginning of the dap-string
dap_string_insert() - inserts a string into the dap-string at the given position, expanding the dap-string if necessary
dap_string_insert_c() - inserts a byte into the dap-string at the given position
dap_string_insert_len() - inserts n bytes of the given string into the dap-string at the given position
dap_string_insert_unichar() - converts a Unicode character into UTF-8, and inserts it into the dap-string at the given position
dap_string_assign() - replaces a dap-string with the given string without worrying about memory
dap_string_overwrite() - overwrites part of the dap-string with the given string at the given position, expanding the dap-string if necessary
dap_string_overwrite_len() - overwrites part of the dap-string with part of the given string at the given position
dap_string_truncate() - truncates a dap-string to the given length
dap_string_erase() - removes n bytes from the dap-string, starting at the given position
dap_string_set_size() - sets the length of a dap-string
dap_string_printf() - writes a formatted string into a dap-string
dap_string_vprintf() - writes a formatted string (with va_list args) into a dap-string
dap_string_down() - converts a dap-string to lowercase
dap_string_up() - converts a dap-string to uppercase