2022-06-02 15:53:09 +03:00
|
|
|
/* This software is licensed by the MIT License, see LICENSE file */
|
|
|
|
|
/* Copyright © 2022 Gregory Lirent */
|
|
|
|
|
|
|
|
|
|
#include "../../modules/libunic/include.h"
|
2022-08-22 12:13:20 +03:00
|
|
|
#include "../../include/string.h"
|
2022-06-02 15:53:09 +03:00
|
|
|
#include "../__internal/include.h"
|
|
|
|
|
|
|
|
|
|
#ifndef LIBCDSB_SRC_STRING_INCLUDE_H
|
|
|
|
|
#define LIBCDSB_SRC_STRING_INCLUDE_H
|
|
|
|
|
|
2022-08-22 14:18:38 +03:00
|
|
|
ainline(char* libcdsb_builtin_next_char(char* s)) {
|
2022-06-02 15:53:09 +03:00
|
|
|
int cs = charsize(s);
|
|
|
|
|
|
|
|
|
|
if (cs) return s + cs;
|
|
|
|
|
return ++s;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-22 14:18:38 +03:00
|
|
|
ainline(char* libcdsb_builtin_prev_char(char* s)) {
|
2022-06-02 15:53:09 +03:00
|
|
|
|
|
|
|
|
if (*(--s)&0x80) {
|
|
|
|
|
char* p = s;
|
|
|
|
|
|
|
|
|
|
while ((*(--p)&0xc0) == 0x80) {}
|
|
|
|
|
|
|
|
|
|
if (charsize(p) == s - p)
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-22 14:18:38 +03:00
|
|
|
#define next_char libcdsb_builtin_next_char
|
|
|
|
|
#define prev_char libcdsb_builtin_prev_char
|
|
|
|
|
|
2022-06-02 15:53:09 +03:00
|
|
|
#endif /* LIBCDSB_SRC_STRING_INCLUDE_H */
|