This commit is contained in:
snarmph 2026-02-26 13:56:31 +01:00
parent ff748bd3ff
commit 23bf010834

39
colla.h
View file

@ -487,6 +487,7 @@ usize strv_rfind_view(strview_t ctx, strview_t view, usize from_right);
bool char_is_space(char c); bool char_is_space(char c);
bool char_is_alpha(char c); bool char_is_alpha(char c);
bool char_is_num(char c); bool char_is_num(char c);
bool char_is_hex(char c);
char char_lower(char c); char char_lower(char c);
char char_upper(char c); char char_upper(char c);
@ -603,23 +604,23 @@ bool ibstr_get_i16(ibstream_t *ib, i16 *out);
bool ibstr_get_i32(ibstream_t *ib, i32 *out); bool ibstr_get_i32(ibstream_t *ib, i32 *out);
bool ibstr_get_i64(ibstream_t *ib, i64 *out); bool ibstr_get_i64(ibstream_t *ib, i64 *out);
// SIMPLE REGEX ///////////////////////////////// // REGEX ////////////////////////////////////////
// only supports *, every star matches until the following character // typedef struct rg_result_t rg_result_t;
// is found, e.g. // struct rg_result_t {
// ab*e // strview_t text;
// abcde // i64 offset;
// matches (cd) // };
//
// typedef struct rg_match_t rg_match_t;
// struct rg_match_t {
// rg_result_t matches[COLLA_RG_MAX_MATCHES];
// int count;
// bool found_match;
// };
typedef struct rg_match_t rg_match_t; bool rg_matches(strview_t rg, strview_t text);
struct rg_match_t { bool glob_matches(strview_t glob, strview_t text);
strview_t text[COLLA_RG_MAX_MATCHES];
int count;
bool matches;
};
rg_match_t rg_match(strview_t rg, strview_t text);
bool rg_match_easy(strview_t rg, strview_t text);
///////////////////////////////////////////////// /////////////////////////////////////////////////
@ -824,6 +825,12 @@ oshandle_t os_stdin(void);
// windows specific // windows specific
oshandle_t os_win_conout(void); oshandle_t os_win_conout(void);
oshandle_t os_win_conin(void); oshandle_t os_win_conin(void);
oshandle_t os_win_regopen(arena_t scratch, strview_t name);
void os_win_regclose(oshandle_t key);
str_t os_win_regread_str(arena_t *arena, oshandle_t key, strview_t value);
i64 os_win_regread_int(arena_t scratch, oshandle_t key, strview_t value);
str_t os_win_regkey_str(arena_t *arena, strview_t key, strview_t value);
#define print(...) fmt_print(__VA_ARGS__) #define print(...) fmt_print(__VA_ARGS__)
#define println(...) os_log_print(__FILE__, __LINE__, LOG_BASIC, __VA_ARGS__) #define println(...) os_log_print(__FILE__, __LINE__, LOG_BASIC, __VA_ARGS__)
@ -921,6 +928,7 @@ typedef strv_list_t os_cmd_t;
typedef struct os_cmd_options_t os_cmd_options_t; typedef struct os_cmd_options_t os_cmd_options_t;
struct os_cmd_options_t { struct os_cmd_options_t {
os_env_t *env; os_env_t *env;
bool quiet;
// redirected if !NULL // redirected if !NULL
oshandle_t *error; oshandle_t *error;
oshandle_t *out; oshandle_t *out;
@ -1439,3 +1447,4 @@ str_t pretty_print_get_stringv(arena_t *arena, const char *fmt, va_list args);
usize pretty_print_get_length(strview_t view); usize pretty_print_get_length(strview_t view);
#endif #endif