From ddcba43d911f6a5faae9130073820e4442b9d4c8 Mon Sep 17 00:00:00 2001 From: wens Date: Sun, 15 Jun 2008 14:34:06 +0000 Subject: General vector-like list git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4357 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/cmsys.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include') diff --git a/include/cmsys.h b/include/cmsys.h index 1e866630..2a219324 100644 --- a/include/cmsys.h +++ b/include/cmsys.h @@ -147,4 +147,25 @@ int delete_records(const char *fpath, size_t size, int id, size_t num); #define delete_record(fpath, size, id) delete_records(fpath, size, id, 1) int apply_record(const char *fpath, int (*fptr) (void *item, void *optarg), size_t size, void *arg); +/* vector.c */ +struct Vector { + int size; + int length; + int capacity; + char *base; +}; + +void Vector_init(struct Vector *self, const int size); +void Vector_delete(struct Vector *self); +void Vector_clear(struct Vector *self, const int size); +int Vector_length(struct Vector *self); +void Vector_resize(struct Vector *self, const int length); +void Vector_add(struct Vector *self, const char *name); +const char* Vector_get(struct Vector *self, const int idx); +int Vector_MaxLen(const struct Vector *list, const int offset, const int count); +int Vector_match(const struct Vector *src, struct Vector *dst, const int key, const int pos); +void Vector_sublist(struct Vector *src, struct Vector *dst, const char *tag); +int Vector_remove(struct Vector *self, const char *name); +int Vector_search(const struct Vector *self, const char *name); + #endif -- cgit v1.2.3