hollyhock
Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
1
7#pragma once
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#define __UCONCAT(a, b) #a b
14#define _UCONCAT(a, b) __UCONCAT(a, b)
15#define UCONCAT(b) _UCONCAT(__USER_LABEL_PREFIX__, b)
16
17#ifndef __clang__
18#define cstr(x) __attribute__((null_terminated_string_arg(x)))
19#define ro(...) __attribute__((access(read_only, __VA_ARGS__)))
20#define rw(...) __attribute__((access(read_write, __VA_ARGS__)))
21#define wo(...) __attribute__((access(write_only, __VA_ARGS__)))
22#else
23#define cstr(x)
24#define ro(...)
25#define rw(...)
26#define wo(...)
27#endif
28
29#define inline inline __attribute__((always_inline))
30
31extern char *(*String_Strcat)(char *dest, const char *src) cstr(1) cstr(2) rw(1) ro(2);
32
33extern const char *(*_FP_String_Strchr)(const char *str, char c) __asm__ (UCONCAT("String_Strchr")) cstr(1) ro(1);
34
35static inline __attribute__((pure)) cstr(1) ro(1) const char *String_Strchr(const char *str, char c) {
36 return _FP_String_Strchr(str, c);
37}
38
39extern int (*_FP_String_Strcmp)(const char *str1, const char *str2) __asm__ (UCONCAT("String_Strcmp")) cstr(1) cstr(2) ro(1) ro(2);
40
41static inline __attribute__((pure)) cstr(1) cstr(2) ro(1) ro(2) int String_Strcmp(const char *str1, const char *str2) {
42 return _FP_String_Strcmp(str1, str2);
43}
44
45extern char *(*String_Strcpy)(char *destination, const char *source) cstr(2) wo(1) ro(2);
46
47extern unsigned int (*_FP_String_Strlen)(const char *str) __asm__ (UCONCAT("String_Strlen")) cstr(1) ro(1);
48
49static inline __attribute__((pure)) cstr(1) ro(1) unsigned int String_Strlen(const char *str) {
50 return _FP_String_Strlen(str);
51}
52
53#undef cstr
54#undef ro
55#undef rw
56#undef wo
57#undef __UCONCAT
58#undef _UCONCAT
59#undef UCONCAT
60#undef inline
61
62#ifdef __cplusplus
63}
64#endif