diff options
Diffstat (limited to 'userland/libc/include/tb')
| -rw-r--r-- | userland/libc/include/tb/sb.h | 8 | ||||
| -rw-r--r-- | userland/libc/include/tb/sv.h | 8 | 
2 files changed, 13 insertions, 3 deletions
diff --git a/userland/libc/include/tb/sb.h b/userland/libc/include/tb/sb.h index 7832015..f75fa5c 100644 --- a/userland/libc/include/tb/sb.h +++ b/userland/libc/include/tb/sb.h @@ -8,12 +8,14 @@ struct sb {    char *string;    size_t length;    size_t capacity; +  size_t to_ignore;    uint8_t prebuffer;  };  struct sv;  void sb_init(struct sb *ctx); +void sb_set_ignore(struct sb *ctx, size_t n);  int sb_init_capacity(struct sb *ctx, size_t starting_capacity);  void sb_init_buffer(struct sb *ctx, char *buffer, size_t size);  void sb_free(struct sb *ctx); @@ -22,8 +24,10 @@ int sb_isempty(const struct sb *ctx);  int sb_append_char(struct sb *ctx, char c);  int sb_delete_right(struct sb *ctx, size_t n);  int sb_append(struct sb *ctx, const char *s); -int sb_append_buffer(struct sb *ctx, const char *buffer, size_t length); +int sb_append_buffer(struct sb *ctx, const void *buffer, size_t length);  int sb_append_sv(struct sb *ctx, struct sv sv);  int sb_prepend_sv(struct sb *ctx, struct sv sv); -int sb_prepend_buffer(struct sb *ctx, const char *buffer, size_t length); +int sb_prepend_buffer(struct sb *ctx, const void *buffer, size_t length); +int sb_modify_location(struct sb *ctx, void *buffer, size_t length, size_t offset); +int sb_reserve_buffer(struct sb *ctx, size_t *offset, size_t length);  #endif diff --git a/userland/libc/include/tb/sv.h b/userland/libc/include/tb/sv.h index 7062741..8a993ec 100644 --- a/userland/libc/include/tb/sv.h +++ b/userland/libc/include/tb/sv.h @@ -2,6 +2,7 @@  #define SV_H  #include "sb.h"  #include <stddef.h> +#include <stdint.h>  #define SB_TO_SV(_sb)                                                          \    (struct sv) {                                                                \ @@ -11,6 +12,7 @@  #define C_TO_SV(_c_string)                                                     \    ((struct sv){.length = strlen(_c_string), .s = (_c_string)}) +#define sv_buffer(a) ((a).s)  #define sv_length(a) ((a).length)  struct sv { @@ -18,6 +20,7 @@ struct sv {    size_t length;  }; +struct sv sv_init(const char *s, size_t length);  char *SV_TO_C(struct sv s);  size_t sv_to_cstring_buffer(struct sv s, char *buffer, size_t length);  struct sv sv_split_delim(const struct sv input, struct sv *rest, char delim); @@ -27,6 +30,7 @@ struct sv sv_split_space(const struct sv input, struct sv *rest);  struct sv sv_skip_chars(const struct sv input, const char *chars);  struct sv sv_split_function(const struct sv input, struct sv *rest,                              int (*function)(int)); +int sv_try_eat(struct sv input, struct sv *rest, struct sv b);  struct sv sv_take(struct sv s, struct sv *rest, size_t n);  struct sv sv_take_end(struct sv s, struct sv *rest, size_t n);  struct sv sv_next(struct sv s); @@ -38,5 +42,7 @@ struct sv sv_trim_left(struct sv s, size_t n);  struct sv sv_clone(struct sv s);  struct sv sv_clone_from_c(const char *s);  char *sv_copy_to_c(struct sv s, char *out, size_t buffer_length); -uint64_t sv_parse_unsigned_number(struct sv input, struct sv *rest); +uint64_t sv_parse_unsigned_number(struct sv input, struct sv *rest, +                                  int *got_num); +int sv_read(struct sv s, struct sv *rest, void *buf, size_t n);  #endif  |