Merge branch 'main' into feature/new-object-system
This commit is contained in:
31
core/include/blue/core/encoding.h
Normal file
31
core/include/blue/core/encoding.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef BLUE_CORE_ENCODING_H_
|
||||
#define BLUE_CORE_ENCODING_H_
|
||||
|
||||
#include <blue/core/misc.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define B_WCHAR_INVALID ((b_wchar) - 1)
|
||||
|
||||
typedef int32_t b_wchar;
|
||||
|
||||
BLUE_API bool b_wchar_is_alpha(b_wchar c);
|
||||
BLUE_API bool b_wchar_is_number(b_wchar c);
|
||||
static inline bool b_wchar_is_bin_digit(b_wchar c)
|
||||
{
|
||||
return c >= '0' && c <= '1';
|
||||
}
|
||||
static inline bool b_wchar_is_oct_digit(b_wchar c)
|
||||
{
|
||||
return c >= '0' && c <= '7';
|
||||
}
|
||||
BLUE_API bool b_wchar_is_hex_digit(b_wchar c);
|
||||
BLUE_API bool b_wchar_is_space(b_wchar c);
|
||||
static inline bool b_wchar_is_alnum(b_wchar c)
|
||||
{
|
||||
return b_wchar_is_alpha(c) || b_wchar_is_number(c);
|
||||
}
|
||||
|
||||
BLUE_API bool b_wchar_is_punct(b_wchar c);
|
||||
|
||||
#endif
|
||||
@@ -86,7 +86,7 @@
|
||||
__FILE__, __LINE__, __FUNCTION__, NULL))
|
||||
#define b_error_caused_by_code(vendor, code, cause_vendor, cause_code) \
|
||||
(z__b_error_create( \
|
||||
vendor, code, z__b_error_with_code(cause_vendor, cause_code), \
|
||||
vendor, code, b_error_with_code(cause_vendor, cause_code), \
|
||||
__FILE__, __LINE__, __FUNCTION__, NULL))
|
||||
#define b_error_with_string(vendor, code, ...) \
|
||||
(z__b_error_create( \
|
||||
@@ -330,6 +330,9 @@ BLUE_API b_error *z__b_error_caused_by(b_error *, b_error *);
|
||||
BLUE_API b_error *z__b_error_caused_by_b_status(b_error *, b_status);
|
||||
BLUE_API void z__b_error_throw(b_error *, const char *, unsigned int, const char *);
|
||||
|
||||
BLUE_API bool b_result_is(
|
||||
b_result result, const b_error_vendor *vendor, b_error_status_code code);
|
||||
|
||||
BLUE_API const b_error_vendor *b_error_vendor_get_builtin(void);
|
||||
BLUE_API const b_error_vendor *b_error_vendor_get_errno(void);
|
||||
BLUE_API const b_error_definition *b_error_vendor_get_error_definition(
|
||||
|
||||
@@ -97,8 +97,8 @@ typedef struct b_hash_ctx {
|
||||
} ctx_state;
|
||||
} b_hash_ctx;
|
||||
|
||||
BLUE_API uint64_t b_hash_string(const char *s);
|
||||
BLUE_API uint64_t b_hash_string_ex(const char *s, size_t *len);
|
||||
BLUE_API uint64_t b_hash_cstr(const char *s);
|
||||
BLUE_API uint64_t b_hash_cstr_ex(const char *s, size_t *len);
|
||||
|
||||
BLUE_API b_status b_hash_ctx_init(b_hash_ctx *ctx, b_hash_function func);
|
||||
BLUE_API b_status b_hash_ctx_reset(b_hash_ctx *ctx);
|
||||
|
||||
@@ -24,7 +24,7 @@ struct b_string;
|
||||
.r_v = { \
|
||||
.v_cstr = { \
|
||||
.s = (str), \
|
||||
.hash = b_hash_string(str), \
|
||||
.hash = b_hash_cstr(str), \
|
||||
}, \
|
||||
}, \
|
||||
}
|
||||
@@ -36,7 +36,7 @@ struct b_string;
|
||||
.r_v = { \
|
||||
.v_cstr = { \
|
||||
.s = (str), \
|
||||
.hash = b_hash_string(str), \
|
||||
.hash = b_hash_cstr(str), \
|
||||
}, \
|
||||
}, \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user