Move isempty_(non_)utf8 to utils.c
[smenu.git] / index.h
blobd498a8014652254ce0ac936162f86cd954fe56fa
1 /* ################################################################### */
2 /* Copyright 2015, Pierre Gentile (p.gen.progs@gmail.com) */
3 /* */
4 /* This Source Code Form is subject to the terms of the Mozilla Public */
5 /* License, v. 2.0. If a copy of the MPL was not distributed with this */
6 /* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
7 /* ################################################################### */
9 #ifndef INDEX_H
10 #define INDEX_H
12 /* *************************************** */
13 /* Ternary Search Tree specific structures */
14 /* *************************************** */
16 typedef struct tst_node_s tst_node_t;
17 typedef struct sub_tst_s sub_tst_t;
19 #if 0 /* here for coherency but not used. */
20 void tst_cleanup(tst_node_t * p);
21 #endif
23 tst_node_t *
24 tst_insert(tst_node_t *p, wchar_t *w, void *data);
26 void *
27 tst_prefix_search(tst_node_t *root, wchar_t *w, int (*callback)(void *));
29 void *
30 tst_search(tst_node_t *root, wchar_t *w);
32 int
33 tst_traverse(tst_node_t *p, int (*callback)(void *), int first_call);
35 int
36 tst_substring_traverse(tst_node_t *p,
37 int (*callback)(void *),
38 int first_call,
39 wchar_t w);
40 int
41 tst_fuzzy_traverse(tst_node_t *p,
42 int (*callback)(void *),
43 int first_call,
44 wchar_t w);
46 sub_tst_t *
47 sub_tst_new(void);
49 void
50 insert_sorted_ptr(tst_node_t ***array,
51 long *size,
52 long *filled,
53 tst_node_t *ptr);
55 /* Ternary node structure */
56 /* """""""""""""""""""""" */
57 struct tst_node_s
59 tst_node_t *lokid, *eqkid, *hikid;
60 void *data;
61 wchar_t splitchar;
64 /* Structure to contain data and metadata attached to a fuzzy/substring. */
65 /* search step. */
66 /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */
67 struct sub_tst_s
69 tst_node_t **array;
70 long size;
71 long count;
74 #endif