diff -r 7dfa5bcf39ee -r 88a9ee79c102 docs/api-2.1/utils_8h.html --- a/docs/api-2.1/utils_8h.html Wed Jan 22 21:02:46 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2233 +0,0 @@ - - -
- - - - -![]() |
-
- ucx
-
- UAP Common Extensions
- |
-
Compare, copy and printf functions. -More...
-#include "ucx.h"#include "string.h"#include "allocator.h"#include <inttypes.h>#include <stdarg.h>Go to the source code of this file.
--Macros | |
| -#define | UCX_STREAM_COPY_BUFSIZE 4096 |
| Default buffer size for ucx_stream_copy() and ucx_stream_ncopy(). | |
| #define | ucx_stream_copy(src, dest, rfnc, wfnc) |
| Shorthand for an unbounded ucx_stream_bncopy call using a default buffer. More... | |
| #define | ucx_stream_ncopy(src, dest, rfnc, wfnc, n) |
| Shorthand for ucx_stream_bncopy using a default copy buffer. More... | |
| #define | ucx_stream_bcopy(src, dest, rfnc, wfnc, buf, bufsize) |
| Shorthand for an unbounded ucx_stream_bncopy call using the specified buffer. More... | |
| #define | ucx_sprintf(...) ucx_asprintf(ucx_default_allocator(), __VA_ARGS__) |
| Shortcut for ucx_asprintf() with default allocator. More... | |
| #define | ucx_bprintf(buffer, ...) |
A printf() like function which writes the output to a UcxBuffer. More... | |
-Functions | |
| void * | ucx_strcpy (const void *s, void *data) |
| Copies a string. More... | |
| void * | ucx_memcpy (const void *m, void *n) |
| Copies a memory area. More... | |
| size_t | ucx_stream_bncopy (void *src, void *dest, read_func rfnc, write_func wfnc, char *buf, size_t bufsize, size_t n) |
| Reads data from a stream and writes it to another stream. More... | |
| int | ucx_cmp_str (const void *s1, const void *s2, void *data) |
| Wraps the strcmp function. More... | |
| int | ucx_cmp_strn (const void *s1, const void *s2, void *n) |
| Wraps the strncmp function. More... | |
| int | ucx_cmp_sstr (const void *s1, const void *s2, void *data) |
| Wraps the sstrcmp function. More... | |
| int | ucx_cmp_int (const void *i1, const void *i2, void *data) |
| Compares two integers of type int. More... | |
| int | ucx_cmp_longint (const void *i1, const void *i2, void *data) |
| Compares two integers of type long int. More... | |
| int | ucx_cmp_longlong (const void *i1, const void *i2, void *data) |
| Compares two integers of type long long. More... | |
| int | ucx_cmp_int16 (const void *i1, const void *i2, void *data) |
| Compares two integers of type int16_t. More... | |
| int | ucx_cmp_int32 (const void *i1, const void *i2, void *data) |
| Compares two integers of type int32_t. More... | |
| int | ucx_cmp_int64 (const void *i1, const void *i2, void *data) |
| Compares two integers of type int64_t. More... | |
| int | ucx_cmp_uint (const void *i1, const void *i2, void *data) |
| Compares two integers of type unsigned int. More... | |
| int | ucx_cmp_ulongint (const void *i1, const void *i2, void *data) |
| Compares two integers of type unsigned long int. More... | |
| int | ucx_cmp_ulonglong (const void *i1, const void *i2, void *data) |
| Compares two integers of type unsigned long long. More... | |
| int | ucx_cmp_uint16 (const void *i1, const void *i2, void *data) |
| Compares two integers of type uint16_t. More... | |
| int | ucx_cmp_uint32 (const void *i1, const void *i2, void *data) |
| Compares two integers of type uint32_t. More... | |
| int | ucx_cmp_uint64 (const void *i1, const void *i2, void *data) |
| Compares two integers of type uint64_t. More... | |
| intmax_t | ucx_dist_int (const void *i1, const void *i2, void *data) |
| Distance function for integers of type int. More... | |
| intmax_t | ucx_dist_longint (const void *i1, const void *i2, void *data) |
| Distance function for integers of type long int. More... | |
| intmax_t | ucx_dist_longlong (const void *i1, const void *i2, void *data) |
| Distance function for integers of type long long. More... | |
| intmax_t | ucx_dist_int16 (const void *i1, const void *i2, void *data) |
| Distance function for integers of type int16_t. More... | |
| intmax_t | ucx_dist_int32 (const void *i1, const void *i2, void *data) |
| Distance function for integers of type int32_t. More... | |
| intmax_t | ucx_dist_int64 (const void *i1, const void *i2, void *data) |
| Distance function for integers of type int64_t. More... | |
| intmax_t | ucx_dist_uint (const void *i1, const void *i2, void *data) |
| Distance function for integers of type unsigned int. More... | |
| intmax_t | ucx_dist_ulongint (const void *i1, const void *i2, void *data) |
| Distance function for integers of type unsigned long int. More... | |
| intmax_t | ucx_dist_ulonglong (const void *i1, const void *i2, void *data) |
| Distance function for integers of type unsigned long long. More... | |
| intmax_t | ucx_dist_uint16 (const void *i1, const void *i2, void *data) |
| Distance function for integers of type uint16_t. More... | |
| intmax_t | ucx_dist_uint32 (const void *i1, const void *i2, void *data) |
| Distance function for integers of type uint32_t. More... | |
| intmax_t | ucx_dist_uint64 (const void *i1, const void *i2, void *data) |
| Distance function for integers of type uint64_t. More... | |
| int | ucx_cmp_float (const void *f1, const void *f2, void *data) |
| Compares two real numbers of type float. More... | |
| int | ucx_cmp_double (const void *d1, const void *d2, void *data) |
| Compares two real numbers of type double. More... | |
| int | ucx_cmp_ptr (const void *ptr1, const void *ptr2, void *data) |
| Compares two pointers. More... | |
| int | ucx_cmp_mem (const void *ptr1, const void *ptr2, void *n) |
| Compares two memory areas. More... | |
| int | ucx_fprintf (void *stream, write_func wfc, const char *fmt,...) |
A printf() like function which writes the output to a stream by using a write_func(). More... | |
| int | ucx_vfprintf (void *stream, write_func wfc, const char *fmt, va_list ap) |
va_list version of ucx_fprintf(). More... | |
| sstr_t | ucx_asprintf (UcxAllocator *allocator, const char *fmt,...) |
A printf() like function which allocates space for a sstr_t the result is written to. More... | |
| sstr_t | ucx_vasprintf (UcxAllocator *allocator, const char *fmt, va_list ap) |
va_list version of ucx_asprintf(). More... | |
Compare, copy and printf functions.
- -| #define ucx_bprintf | -( | -- | buffer, | -
| - | - | - | ... | -
| - | ) | -- |
A printf() like function which writes the output to a UcxBuffer.
| buffer | the buffer the data is written to |
| ... | format string and additional arguments |
| #define ucx_sprintf | -( | -- | ... | ) | -ucx_asprintf(ucx_default_allocator(), __VA_ARGS__) | -
Shortcut for ucx_asprintf() with default allocator.
- -| #define ucx_stream_bcopy | -( | -- | src, | -
| - | - | - | dest, | -
| - | - | - | rfnc, | -
| - | - | - | wfnc, | -
| - | - | - | buf, | -
| - | - | - | bufsize | -
| - | ) | -- |
Shorthand for an unbounded ucx_stream_bncopy call using the specified buffer.
-| src | the source stream |
| dest | the destination stream |
| rfnc | the read function |
| wfnc | the write function |
| buf | a pointer to the copy buffer or NULL if a buffer shall be implicitly created on the heap |
| bufsize | the size of the copy buffer - if NULL was provided for buf, this is the size of the buffer that shall be implicitly created |
| #define ucx_stream_copy | -( | -- | src, | -
| - | - | - | dest, | -
| - | - | - | rfnc, | -
| - | - | - | wfnc | -
| - | ) | -- |
Shorthand for an unbounded ucx_stream_bncopy call using a default buffer.
-| src | the source stream |
| dest | the destination stream |
| rfnc | the read function |
| wfnc | the write function |
| #define ucx_stream_ncopy | -( | -- | src, | -
| - | - | - | dest, | -
| - | - | - | rfnc, | -
| - | - | - | wfnc, | -
| - | - | - | n | -
| - | ) | -- |
Shorthand for ucx_stream_bncopy using a default copy buffer.
-| src | the source stream |
| dest | the destination stream |
| rfnc | the read function |
| wfnc | the write function |
| n | maximum number of bytes that shall be copied |
| sstr_t ucx_asprintf | -( | -UcxAllocator * | -allocator, | -
| - | - | const char * | -fmt, | -
| - | - | - | ... | -
| - | ) | -- |
A printf() like function which allocates space for a sstr_t the result is written to.
Attention: The sstr_t data is allocated with the allocators ucx_allocator_malloc() function. So it is implementation dependent, if the returned sstr_t.ptr pointer must be passed to the allocators ucx_allocator_free() function manually.
-Note: The sstr_t.ptr of the return value will always be NULL-terminated.
| allocator | the UcxAllocator used for allocating the result sstr_t |
| fmt | format string |
| ... | additional arguments |
| int ucx_cmp_double | -( | -const void * | -d1, | -
| - | - | const void * | -d2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two real numbers of type double.
-| d1 | pointer to double one |
| d2 | pointer to double two |
| data | if provided: a pointer to precision (default: 1e-14) |
| int ucx_cmp_float | -( | -const void * | -f1, | -
| - | - | const void * | -f2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two real numbers of type float.
-| f1 | pointer to float one |
| f2 | pointer to float two |
| data | if provided: a pointer to precision (default: 1e-6f) |
| int ucx_cmp_int | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type int.
-| i1 | pointer to integer one |
| i2 | pointer to integer two |
| data | omitted |
| int ucx_cmp_int16 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type int16_t.
-| i1 | pointer to int16_t one |
| i2 | pointer to int16_t two |
| data | omitted |
| int ucx_cmp_int32 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type int32_t.
-| i1 | pointer to int32_t one |
| i2 | pointer to int32_t two |
| data | omitted |
| int ucx_cmp_int64 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type int64_t.
-| i1 | pointer to int64_t one |
| i2 | pointer to int64_t two |
| data | omitted |
| int ucx_cmp_longint | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type long int.
-| i1 | pointer to long integer one |
| i2 | pointer to long integer two |
| data | omitted |
| int ucx_cmp_longlong | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type long long.
-| i1 | pointer to long long one |
| i2 | pointer to long long two |
| data | omitted |
| int ucx_cmp_mem | -( | -const void * | -ptr1, | -
| - | - | const void * | -ptr2, | -
| - | - | void * | -n | -
| - | ) | -- |
Compares two memory areas.
-| ptr1 | pointer one |
| ptr2 | pointer two |
| n | a pointer to the size_t containing the third parameter for memcmp |
| int ucx_cmp_ptr | -( | -const void * | -ptr1, | -
| - | - | const void * | -ptr2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two pointers.
-| ptr1 | pointer one |
| ptr2 | pointer two |
| data | omitted |
| int ucx_cmp_sstr | -( | -const void * | -s1, | -
| - | - | const void * | -s2, | -
| - | - | void * | -data | -
| - | ) | -- |
Wraps the sstrcmp function.
-| s1 | sstr one |
| s2 | sstr two |
| data | ignored |
| int ucx_cmp_str | -( | -const void * | -s1, | -
| - | - | const void * | -s2, | -
| - | - | void * | -data | -
| - | ) | -- |
Wraps the strcmp function.
-| s1 | string one |
| s2 | string two |
| data | omitted |
| int ucx_cmp_strn | -( | -const void * | -s1, | -
| - | - | const void * | -s2, | -
| - | - | void * | -n | -
| - | ) | -- |
Wraps the strncmp function.
-| s1 | string one |
| s2 | string two |
| n | a pointer to the size_t containing the third strncmp parameter |
| int ucx_cmp_uint | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type unsigned int.
-| i1 | pointer to unsigned integer one |
| i2 | pointer to unsigned integer two |
| data | omitted |
| int ucx_cmp_uint16 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type uint16_t.
-| i1 | pointer to uint16_t one |
| i2 | pointer to uint16_t two |
| data | omitted |
| int ucx_cmp_uint32 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type uint32_t.
-| i1 | pointer to uint32_t one |
| i2 | pointer to uint32_t two |
| data | omitted |
| int ucx_cmp_uint64 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type uint64_t.
-| i1 | pointer to uint64_t one |
| i2 | pointer to uint64_t two |
| data | omitted |
| int ucx_cmp_ulongint | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type unsigned long int.
-| i1 | pointer to unsigned long integer one |
| i2 | pointer to unsigned long integer two |
| data | omitted |
| int ucx_cmp_ulonglong | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Compares two integers of type unsigned long long.
-| i1 | pointer to unsigned long long one |
| i2 | pointer to unsigned long long two |
| data | omitted |
| intmax_t ucx_dist_int | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type int.
-| i1 | pointer to integer one |
| i2 | pointer to integer two |
| data | omitted |
| intmax_t ucx_dist_int16 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type int16_t.
-| i1 | pointer to int16_t one |
| i2 | pointer to int16_t two |
| data | omitted |
| intmax_t ucx_dist_int32 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type int32_t.
-| i1 | pointer to int32_t one |
| i2 | pointer to int32_t two |
| data | omitted |
| intmax_t ucx_dist_int64 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type int64_t.
-| i1 | pointer to int64_t one |
| i2 | pointer to int64_t two |
| data | omitted |
| intmax_t ucx_dist_longint | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type long int.
-| i1 | pointer to long integer one |
| i2 | pointer to long integer two |
| data | omitted |
| intmax_t ucx_dist_longlong | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type long long.
-| i1 | pointer to long long one |
| i2 | pointer to long long two |
| data | omitted |
| intmax_t ucx_dist_uint | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type unsigned int.
-| i1 | pointer to unsigned integer one |
| i2 | pointer to unsigned integer two |
| data | omitted |
| intmax_t ucx_dist_uint16 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type uint16_t.
-| i1 | pointer to uint16_t one |
| i2 | pointer to uint16_t two |
| data | omitted |
| intmax_t ucx_dist_uint32 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type uint32_t.
-| i1 | pointer to uint32_t one |
| i2 | pointer to uint32_t two |
| data | omitted |
| intmax_t ucx_dist_uint64 | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type uint64_t.
-| i1 | pointer to uint64_t one |
| i2 | pointer to uint64_t two |
| data | omitted |
| intmax_t ucx_dist_ulongint | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type unsigned long int.
-| i1 | pointer to unsigned long integer one |
| i2 | pointer to unsigned long integer two |
| data | omitted |
| intmax_t ucx_dist_ulonglong | -( | -const void * | -i1, | -
| - | - | const void * | -i2, | -
| - | - | void * | -data | -
| - | ) | -- |
Distance function for integers of type unsigned long long.
-| i1 | pointer to unsigned long long one |
| i2 | pointer to unsigned long long two |
| data | omitted |
| int ucx_fprintf | -( | -void * | -stream, | -
| - | - | write_func | -wfc, | -
| - | - | const char * | -fmt, | -
| - | - | - | ... | -
| - | ) | -- |
A printf() like function which writes the output to a stream by using a write_func().
| stream | the stream the data is written to |
| wfc | the write function |
| fmt | format string |
| ... | additional arguments |
| void* ucx_memcpy | -( | -const void * | -m, | -
| - | - | void * | -n | -
| - | ) | -- |
Copies a memory area.
-| m | a pointer to the memory area |
| n | a pointer to the size_t containing the size of the memory area |
| void* ucx_strcpy | -( | -const void * | -s, | -
| - | - | void * | -data | -
| - | ) | -- |
Copies a string.
-| s | the string to copy |
| data | omitted |
| size_t ucx_stream_bncopy | -( | -void * | -src, | -
| - | - | void * | -dest, | -
| - | - | read_func | -rfnc, | -
| - | - | write_func | -wfnc, | -
| - | - | char * | -buf, | -
| - | - | size_t | -bufsize, | -
| - | - | size_t | -n | -
| - | ) | -- |
Reads data from a stream and writes it to another stream.
-| src | the source stream |
| dest | the destination stream |
| rfnc | the read function |
| wfnc | the write function |
| buf | a pointer to the copy buffer or NULL if a buffer shall be implicitly created on the heap |
| bufsize | the size of the copy buffer - if NULL was provided for buf, this is the size of the buffer that shall be implicitly created |
| n | the maximum number of bytes that shall be copied |
| sstr_t ucx_vasprintf | -( | -UcxAllocator * | -allocator, | -
| - | - | const char * | -fmt, | -
| - | - | va_list | -ap | -
| - | ) | -- |
va_list version of ucx_asprintf().
| allocator | the UcxAllocator used for allocating the result sstr_t |
| fmt | format string |
| ap | argument list |
| int ucx_vfprintf | -( | -void * | -stream, | -
| - | - | write_func | -wfc, | -
| - | - | const char * | -fmt, | -
| - | - | va_list | -ap | -
| - | ) | -- |
va_list version of ucx_fprintf().
| stream | the stream the data is written to |
| wfc | the write function |
| fmt | format string |
| ap | argument list |
- 1.8.13
-
-
-