#ifndef CMONKEY_SLICE_H #define CMONKEY_SLICE_H #include struct slice { const char *str; size_t start; size_t end; }; struct slice slice_new(const char *str, size_t start, size_t end); struct slice slice_fullstr(const char *str); void slice_set(struct slice *, const char *str, size_t start, size_t end); size_t slice_len(const struct slice *); /* Returns 0 if equal, 1 if a > b, -1 if a < b */ int slice_cmp(const struct slice *restrict a, const struct slice *restrict b); void slice_cpy(struct slice *dst, const struct slice *src); char *slice_sprint(struct slice *, char *str); #endif