1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3
4#include <mos/moslib_global.h>
5#include <mos/types.h>
6
7/**
8 * @defgroup libs_std_string libs.String
9 * @ingroup libs
10 * @brief String manipulation functions, similar to the ones in the C standard library.
11 * @{
12 */
13
14MOSAPI size_t strlen(const char *str) __pure;
15MOSAPI size_t strnlen(const char *, size_t);
16MOSAPI s32 strcmp(const char *str1, const char *str2);
17MOSAPI s32 strncmp(const char *str1, const char *str2, size_t n);
18MOSAPI s32 strncasecmp(const char *str1, const char *str2, size_t n);
19
20// ! The memory areas must not overlap.
21MOSAPI void *memcpy(void *__restrict dest, const void *__restrict src, size_t n);
22MOSAPI void *memmove(void *dest, const void *src, size_t n);
23MOSAPI void *memset(void *s, int c, size_t n);
24MOSAPI int memcmp(const void *s1, const void *s2, size_t n);
25MOSAPI void memzero(void *s, size_t n);
26MOSAPI void *memchr(const void *m, int c, size_t n);
27
28MOSAPI char *strcpy(char *__restrict dest, const char *__restrict src);
29MOSAPI char *strcat(char *__restrict dest, const char *__restrict src);
30
31MOSAPI char *strncpy(char *__restrict dest, const char *__restrict src, size_t n);
32
33MOSAPI char *strdup(const char *src);
34MOSAPI char *strndup(const char *src, size_t n);
35
36MOSAPI char *strchr(const char *s, int c);
37MOSAPI char *strrchr(const char *s, int c);
38
39MOSAPI size_t strspn(const char *s, const char *accept);
40MOSAPI char *strpbrk(const char *s, const char *accept);
41MOSAPI char *strtok(char *str, const char *delim);
42MOSAPI char *strtok_r(char *str, const char *delim, char **saveptr);
43/** @} */
44