#ifndef UCX_UTILS_H
#define UCX_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ucx.h"
#include "string.h"
#include "allocator.h"
#include <inttypes.h>
#include <string.h>
#include <stdarg.h>
#define UCX_STREAM_COPY_BUFSIZE 4096
void *ucx_strcpy(
void *s,
void *data);
void *ucx_memcpy(
void *m,
void *n);
size_t ucx_stream_bncopy(
void *src,
void *dest, read_func rfnc, write_func wfnc,
char* buf,
size_t bufsize,
size_t n);
#define ucx_stream_copy(src,dest,rfnc,wfnc) ucx_stream_bncopy(\
src, dest, (read_func)rfnc, (write_func)wfnc, \
NULL,
UCX_STREAM_COPY_BUFSIZE, (
size_t)-
1)
#define ucx_stream_ncopy(src,dest,rfnc,wfnc, n) ucx_stream_bncopy(\
src, dest, (read_func)rfnc, (write_func)wfnc, \
NULL,
UCX_STREAM_COPY_BUFSIZE, n)
#define ucx_stream_bcopy(src,dest,rfnc,wfnc, buf, bufsize) ucx_stream_bncopy(\
src, dest, (read_func)rfnc, (write_func)wfnc, \
buf, bufsize, (
size_t)-
1)
int ucx_strcmp(
void *s1,
void *s2,
void *data);
int ucx_strncmp(
void *s1,
void *s2,
void *n);
int ucx_intcmp(
void *i1,
void *i2,
void *data);
int ucx_floatcmp(
void *f1,
void *f2,
void *data);
int ucx_doublecmp(
void *d1,
void *d2,
void *data);
int ucx_ptrcmp(
void *ptr1,
void *ptr2,
void *data);
int ucx_memcmp(
void *ptr1,
void *ptr2,
void *n);
int ucx_fprintf(
void *stream, write_func wfc,
const char *fmt, ...);
int ucx_vfprintf(
void *stream, write_func wfc,
const char *fmt, va_list ap);
sstr_t ucx_asprintf(UcxAllocator *allocator,
const char *fmt, ...);
sstr_t ucx_vasprintf(UcxAllocator *allocator,
const char *fmt, va_list ap);
#define ucx_sprintf(...) \
ucx_asprintf(ucx_default_allocator(),
__VA_ARGS__)
#define ucx_bprintf(buffer, ...) ucx_fprintf((UcxBuffer*)buffer, \
(write_func)ucx_buffer_write,
__VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif