--- psiconv/trunk/lib/psiconv/list.h 2000/12/23 20:21:40 72 +++ psiconv/trunk/lib/psiconv/list.h 2000/12/25 22:25:33 79 @@ -23,6 +23,7 @@ #ifndef PSICONV_LIST_H #define PSICONV_LIST_H +#include #include #include @@ -40,7 +41,7 @@ If there is not enough memory available, NULL is returned. You should always test for this explicitely, because the other functions do not like a psiconv_list argument that is equal to NULL */ -extern psiconv_list psiconv_list_new(int element_size); +extern psiconv_list psiconv_list_new(size_t element_size); /* This frees the list. If elements contain pointers that need to be freed separately, call list_free_el below. */ @@ -52,7 +53,7 @@ extern void psiconv_list_free_el(psiconv_list l, void free_el(void *el)); /* Return the number of allocated elements */ -extern int psiconv_list_length(const psiconv_list l); +extern psiconv_u32 psiconv_list_length(const psiconv_list l); /* Return 1 if the list is empty, 0 if not */ extern int psiconv_list_is_empty(const psiconv_list l); @@ -61,7 +62,7 @@ directly modify this element, but be careful not to write beyond the element memory space. If indx is out of range, NULL is returned. */ -extern void * psiconv_list_get(const psiconv_list l, unsigned int indx); +extern void * psiconv_list_get(const psiconv_list l, psiconv_u32 indx); /* Add an element at the end of the list. The element is copied from the supplied element. Of course, this does not help if the element contains @@ -87,6 +88,14 @@ not enough memory could be allocated, 0 is simply returned. */ extern size_t psiconv_list_fread(psiconv_list l,size_t size, FILE *f); +/* Read the whole file f to list l. Returns 0 on succes, and an errorcode + on failure. */ +extern int psiconv_list_fread_all(psiconv_list l, FILE *f); + +/* Write the whole list l to the opened file f. Returns 0 on succes, and + an errorcode on failure. */ +extern int psiconv_list_fwrite_all(const psiconv_list l, FILE *f); + /* Concatenate two lists. The element sized does not have to be the same, but the result may be quite unexpected if it is not. */ int psiconv_list_concat(psiconv_list l, const psiconv_list extra);