From 91016bd3855375796fd1eabd501ebc12491f2655 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 11 Jan 2022 09:58:43 +0800 Subject: 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. --- src/list.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/list.c') diff --git a/src/list.c b/src/list.c index 143c693..3c430f6 100644 --- a/src/list.c +++ b/src/list.c @@ -32,7 +32,7 @@ new_list() } H_ATTR -unsigned char +BOOL add_to_list(List *ls, void *element) { if (!(ls->capacity)) { @@ -141,10 +141,10 @@ copy_num(void *p) return pointer; } -unsigned char +BOOL copy_list(List *dest, List *source, copyer copyf) { - unsigned char sign = 0; + BOOL sign = 0; if ((sign = list_assure_size(dest, source->len))) return sign; @@ -162,19 +162,19 @@ copy_list(List *dest, List *source, copyer copyf) H_ATTR void * -list_nth(List *ls, NUM n) +list_nth(const List * const ls, NUM n) { return *(ls->array+n); } H_ATTR NUM -list_length(List *ls) +list_length(const List * const restrict ls) { return ls->len; } -unsigned char +BOOL list_assure_size(List *ls, NUM size) { if (ls->capacity >= size) return 0; /* we are good */ @@ -203,7 +203,7 @@ list_assure_size(List *ls, NUM size) return 0; } -unsigned char +BOOL list_set_length(List *ls, NUM len) { list_assure_size(ls, len); @@ -254,7 +254,7 @@ array_to_list(void **array, NUM size) } void -destroy_list(List *ls, unsigned char all_free_p) +destroy_list(List *ls, BOOL all_free_p) { if (all_free_p == 1) for (NUM i = 0; i < ls->len; i++) -- cgit v1.2.3-18-g5258