Program Listing for File string.h
↰ Return to documentation for file (rcsw/stdio/string.h
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include "rcsw/rcsw.h"
/*******************************************************************************
* Macros
******************************************************************************/
/* these macros operate on single characters */
#define RCSW_STDIO_ISPRINTABLE(c) (((c) >= ' ' && (c) <= '~') ? 1 : 0)
#define RCSW_STDIO_ISSPACE(c) (((c) == ' ') ? 1 : 0)
#define RCSW_STDIO_ISLOWER(c) (((c) >= 'a' && (c) <= 'z') ? 1 : 0)
#define RCSW_STDIO_ISUPPER(c) (((c) >= 'A' && (c) <= 'Z') ? 1 : 0)
#define RCSW_STDIO_ISDIGIT(c) (((c) >= '0' && (c) <= '9') ? 1 : 0)
#define RCSW_STDIO_ISHEX(c) (RCSW_STDIO_ISDIGIT(c) || \
((c) >= 'a' && (c) <= 'f') || \
((c) >= 'A' && (c) <= 'F') ? 1 : 0)
#define RCSW_STDIO_ISALPHA(c) \
((((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) ? 1 : 0)
/*******************************************************************************
* API Functions
******************************************************************************/
BEGIN_C_DECLS
RCSW_API void* stdio_memcpy(void* __restrict__ dest,
const void* __restrict__ src,
size_t n);
RCSW_API void* stdio_memset(void* __restrict__ dest,
int c,
size_t n);
RCSW_API int stdio_toupper(int c) RCSW_CONST;
RCSW_API int stdio_tolower(int c) RCSW_CONST;
RCSW_API size_t stdio_strlen(const char * s) RCSW_PURE;
RCSW_API size_t stdio_strnlen(const char* const s, size_t maxsize) RCSW_PURE;
RCSW_API void stdio_strrev(char *s, size_t len);
RCSW_API const char *stdio_strstr(const char * haystack,
const char * needle) RCSW_PURE;
RCSW_API const char *stdio_strchr(const char * haystack, char needle) RCSW_PURE;
RCSW_API char *stdio_strncpy(char * __restrict__ dest,
const char * __restrict__ src,
size_t n);
RCSW_API char *stdio_strcpy(char * __restrict__ dest,
const char * __restrict__ src);
RCSW_API int stdio_strncmp(const char * s1,
const char * s2,
size_t len) RCSW_PURE;
RCSW_API int stdio_strcmp(const char * s1, const char * s2) RCSW_PURE;
RCSW_API char *stdio_strrep(const char * __restrict__ original,
const char * __restrict__ pattern,
const char * __restrict__ replacement,
char * __restrict__ new_str);
END_C_DECLS