diff options
Diffstat (limited to 'include/argot/list.h')
-rw-r--r-- | include/argot/list.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/include/argot/list.h b/include/argot/list.h new file mode 100644 index 0000000..8293fc6 --- /dev/null +++ b/include/argot/list.h @@ -0,0 +1,54 @@ +/* argot - Gray's Extensible Configuration System -*- c -*- + Copyright (C) 2007-2016 Sergey Poznyakoff + + Grecs is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Grecs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Grecs. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _ARGOT_LIST_H +#define _ARGOT_LIST_H + +typedef struct argot_list_entry *argot_list_entry_ptr_t; +typedef struct argot_list *argot_list_ptr_t; + +struct argot_list_entry { + struct argot_list_entry *next, *prev; + void *data; +}; + +struct argot_list { + struct argot_list_entry *head, *tail; + size_t count; + int (*cmp)(const void *, const void *); + void (*free_entry)(void *); +}; + +argot_list_ptr_t argot_list_create(void); +size_t argot_list_size(argot_list_ptr_t); +void argot_list_append(argot_list_ptr_t, void *); +void argot_list_push(argot_list_ptr_t, void *); +void *argot_list_pop(argot_list_ptr_t); +void *argot_list_locate(argot_list_ptr_t, void *); +void *argot_list_index(argot_list_ptr_t, size_t); +void *argot_list_remove_tail(argot_list_ptr_t); +void argot_list_remove_entry(argot_list_ptr_t, argot_list_entry_ptr_t); +void argot_list_clear(argot_list_ptr_t); +void argot_list_free(argot_list_ptr_t); +void argot_list_add(argot_list_ptr_t, argot_list_ptr_t); +int argot_list_compare(argot_list_ptr_t, argot_list_ptr_t); + +/* FIXME */ +struct argot_list *_argot_simple_list_create(int dispose); +struct argot_list *argot_value_list_create(void); + + +#endif |