summaryrefslogtreecommitdiff
path: root/src/list.h
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-01-11 09:58:43 +0800
committerJSDurand <mmemmew@gmail.com>2022-01-11 09:58:43 +0800
commit91016bd3855375796fd1eabd501ebc12491f2655 (patch)
treec4a608966b686c9639a90b92c31c00632532fac8 /src/list.h
parent949888ad5d0cd0f9f9a87f9938a632b3e32df051 (diff)
Add the framework for character classes.
Now we have the potential to recognize character classes. But the most important task for us now is to experiment with ((B)RN)GLR algorithms, so we leave the character classes at the present state for a moment.
Diffstat (limited to 'src/list.h')
-rw-r--r--src/list.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/list.h b/src/list.h
index ff401f4..6ace213 100644
--- a/src/list.h
+++ b/src/list.h
@@ -17,7 +17,7 @@ List *new_list();
/* add an element to the end of the list */
/* upon failure return non-zero */
-unsigned char add_to_list(List *ls, void *element);
+BOOL add_to_list(List *ls, void *element);
/* pop an element from the end of the list, and return that element */
/* upon failure return NULL */
@@ -43,23 +43,23 @@ typedef void *(*copyer)(void *);
void *copy_num(void *);
/* upon failure return 1 */
-unsigned char copy_list(List *dest, List *source, copyer copyf);
+BOOL copy_list(List *dest, List *source, copyer copyf);
-void *list_nth(List *ls, NUM n);
+void *list_nth(const List * const ls, NUM n);
-NUM list_length(List *ls);
+NUM list_length(const List * const restrict ls);
/* Make sure the list has at least SIZE slots to use. This should
only be used to create fixed capacity arrays, otherwise we risk
frequently re-allocating and hence losing performance. */
/* Upon failure return non-zero. */
-unsigned char list_assure_size(List *ls, NUM size);
+BOOL list_assure_size(List *ls, NUM size);
/* This is mainly used to set the length of a sparse list, since only
when dealing with sparse lists do we not need to care about the
elements. */
/* Upon failure return non-zero. */
-unsigned char list_set_length(List *ls, NUM len);
+BOOL list_set_length(List *ls, NUM len);
/* Convert a list to an array.
@@ -79,7 +79,7 @@ List *array_to_list(void ** array, NUM size);
/* destroy the list: If ALL_FREE_P is 1, this frees every void
pointers contained in the list; if it is 2, this frees the first
pointer. In any case, the list is de-allocated. */
-void destroy_list(List *ls, unsigned char all_free_p);
+void destroy_list(List *ls, BOOL all_free_p);
void destroy_list_free_all(void *ls);
void destroy_list_free_first(void *ls);