Bump to release 1.4.0
[smenu.git] / index.h
blob4a7ef4aa1cbc4b93b7bb6844105ba5bf3a8b9e84
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_index(long **array, long *size, long *filled, long value);
52 void
53 insert_sorted_ptr(tst_node_t ***array,
54 long *size,
55 long *filled,
56 tst_node_t *ptr);
58 /* Ternary node structure */
59 /* """""""""""""""""""""" */
60 struct tst_node_s
62 wchar_t splitchar;
64 tst_node_t *lokid, *eqkid, *hikid;
65 void *data;
68 /* Structure to contain data and metadata attached to a fuzzy/substring. */
69 /* search step. */
70 /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */
71 struct sub_tst_s
73 tst_node_t **array;
74 long size;
75 long count;
78 #endif