#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