diff options
| author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2026-04-12 20:57:06 +0200 |
|---|---|---|
| committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2026-04-12 20:59:39 +0200 |
| commit | e5af28536bfb0f4c9131df56d2009ba5196f5e3a (patch) | |
| tree | 3ab928f961a1ccd8440b070d7b57f79146457e8c /src/util/str.h | |
| download | animtool-e5af28536bfb0f4c9131df56d2009ba5196f5e3a.tar.xz | |
init
Diffstat (limited to 'src/util/str.h')
| -rw-r--r-- | src/util/str.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util/str.h b/src/util/str.h new file mode 100644 index 0000000..4a0de1a --- /dev/null +++ b/src/util/str.h @@ -0,0 +1,24 @@ +#ifndef ANIMTOOL_STR_H_ +#define ANIMTOOL_STR_H_ + +#include "container.h" + +typedef arraybuf(char) strbuf; +typedef array(char) str; + +#define S(x) ((str) { sizeof (x) - 1, (x) }) +#define PSTR(x) (int) (x).len, (x).ptr + +#define NULTERM(S, BUF) char BUF[(S).len+1]; memcpy(BUF, (S).ptr, (S).len); BUF[(S).len] = '\0'; + +size_t str_find(str s, str tokens); +str str_walk(str *s, str sep); +str str_eat(str s, str tokens); +str str_advance(str s, size_t x); +bool str_start(str s, str start); +str str_intro(char *s); +bool str_parse_int(str s, long *x); +bool str_parse_double(str s, double *x); +bool str_split(str s, str sep, str *a, str *b); + +#endif |
