TABLE OF CONTENTS
- trish2/patricia_search
- trish2/psearch_solution_t
- trish2/psearch_t
- trish2/PSEARCH_OPTION_START
- trish2/PSEARCH_OPTION_START_MANDATORY
- trish2/PSEARCH_OPTION_WHOLE
- trish2/PSEARCH_OPTION_END
- trish2/PSEARCH_OPTION_END_MANDATORY
- trish2/PSEARCH_OPTION_FULL
- trish2/PSEARCH_OPTION_TAG
- trish2/PSEARCH_OPTION_CI_FIRST
- trish2/PSEARCH_OPTION_CI_TAIL
- trish2/PSEARCH_OPTION_CI_ALL
- trish2/PSEARCH_OPTION_GCI_FIRST
- trish2/PSEARCH_OPTION_GCI_TAIL
- trish2/PSEARCH_OPTION_GCI_ALL
- trish2/psearch_new
- trish2/psearch_reinit
- trish2/psearch_free
- trish2/psearch_new_query
- trish2/psearch
trish2/patricia_search [ Modules ]
NAME
patricia_search
SYNOPSIS
#include <patricia_search.h>
DESCRIPTION
EXAMPLE
SEE ALSO
patricia, psearch_solution_t, psearch_t, PSEARCH_OPTION_START, PSEARCH_OPTION_START_MANDATORY, PSEARCH_OPTION_WHOLE, PSEARCH_OPTION_END, PSEARCH_OPTION_END_MANDATORY, PSEARCH_OPTION_FULL, PSEARCH_OPTION_TAG, PSEARCH_OPTION_CI_FIRST, PSEARCH_OPTION_CI_TAIL, PSEARCH_OPTION_CI_ALL, PSEARCH_OPTION_GCI_FIRST, PSEARCH_OPTION_GCI_TAIL, PSEARCH_OPTION_GCI_ALL, psearch_new, psearch_reinit, psearch_free, psearch_new_query, psearch
trish2/psearch_solution_t [ Structures ]
[ Top ] [ Structures ]
NAME
psearch_solution_t
SYNOPSIS
#include <patricia_search.h> typedef struct { wchar_t *query; int query_pos; pnode_t *node; int tail_pos; size_t found_pos; int mismatch; psearch_solution_t *next; psearch_solution_t *prev; } psearch_solution_t;
DESCRIPTION
This structure holds information on how far in the tree the search was proceeded. It is a doubly linked list because there can be several solutions for a single search (multiple identical matches, case insesitveness, GCI).
ATTRIBUTES
- query : String searched for.
- query_pos : Position of the last matched character.
- node : PATRICIA tree node reached.
- tail_pos : Position in the tail string reached.
- found_pos : Length of the matched entry.
- mismatch : Number of characters matched by case insensitveness or GCI.
- next : Next solution (NULL if it is the last).
- prev : Previous solution (NULL if it is the first).
SEE ALSO
patricia_search, psearch_t, pnode_t
trish2/psearch_t [ Structures ]
[ Top ] [ Structures ]
NAME
psearch_t
SYNOPSIS
#include <patricia_search.h> typedef struct { patricia_t *pat; int options; patricia_t *gci; bunch_t *solutions; psearch_solution_t *current; psearch_solution_t *next; psearch_solution_t *used; psearch_solution_t *final; psearch_solution_t *free; } psearch_t;
DESCRIPTION
This structure is intitialized and passed to patricia_search in order to supply the query string along with options and solutions.
ATTRIBUTES
- pat : PATRICIA tree to search in.
- options : OR'ed search options.
- gci : GCI table to use.
- solutions : Bunch of solutions.
- current : Currently examined solution.
- next : Solution to be examined after.
- used : Successful solutions.
- final : Unused parameter.
- free : Discarded solutions (can be recycled).
SEE ALSO
patricia_search, psearch_solution_t, PSEARCH_OPTION_START, PSEARCH_OPTION_START_MANDATORY, PSEARCH_OPTION_WHOLE, PSEARCH_OPTION_END, PSEARCH_OPTION_END_MANDATORY, PSEARCH_OPTION_FULL, PSEARCH_OPTION_TAG, PSEARCH_OPTION_CI_FIRST, PSEARCH_OPTION_CI_TAIL, PSEARCH_OPTION_CI_ALL, PSEARCH_OPTION_GCI_FIRST, PSEARCH_OPTION_GCI_TAIL, PSEARCH_OPTION_GCI_ALL, psearch_new, psearch_reinit, psearch_free, psearch_new_query, psearch, patricia, bunch, gci
trish2/PSEARCH_OPTION_START, trish2/PSEARCH_OPTION_START_MANDATORY,
trish2/PSEARCH_OPTION_WHOLE, trish2/PSEARCH_OPTION_END,
trish2/PSEARCH_OPTION_END_MANDATORY, trish2/PSEARCH_OPTION_FULL,
trish2/PSEARCH_OPTION_TAG, trish2/PSEARCH_OPTION_CI_FIRST,
trish2/PSEARCH_OPTION_CI_TAIL, trish2/PSEARCH_OPTION_CI_ALL,
trish2/PSEARCH_OPTION_GCI_FIRST, trish2/PSEARCH_OPTION_GCI_TAIL,
trish2/PSEARCH_OPTION_GCI_ALL [ Definitions ]
[ Top ] [ Definitions ]
NAME
PSEARCH_OPTION_START, PSEARCH_OPTION_START_MANDATORY, PSEARCH_OPTION_WHOLE, PSEARCH_OPTION_END, PSEARCH_OPTION_END_MANDATORY, PSEARCH_OPTION_FULL, PSEARCH_OPTION_TAG, PSEARCH_OPTION_CI_FIRST, PSEARCH_OPTION_CI_TAIL, PSEARCH_OPTION_CI_ALL, PSEARCH_OPTION_GCI_FIRST, PSEARCH_OPTION_GCI_TAIL, PSEARCH_OPTION_GCI_ALL
SYNOPSIS
#include <patricia_search.h> #define PSEARCH_OPTION_START 1 #define PSEARCH_OPTION_START_MANDATORY (2 | PSEARCH_OPTION_START) #define PSEARCH_OPTION_WHOLE 4 #define PSEARCH_OPTION_END 8 #define PSEARCH_OPTION_END_MANDATORY (16 | PSEARCH_OPTION_END) #define PSEARCH_OPTION_FULL (PSEARCH_OPTION_START_MANDATORY | PSEARCH_OPTION_WHOLE | PSEARCH_OPTION_END_MANDATORY) #define PSEARCH_OPTION_TAG (PSEARCH_OPTION_START_MANDATORY | PSEARCH_OPTION_END_MANDATORY) #define PSEARCH_OPTION_CI_FIRST 32 #define PSEARCH_OPTION_CI_TAIL 64 #define PSEARCH_OPTION_CI_ALL (PSEARCH_OPTION_CI_FIRST | PSEARCH_OPTION_CI_TAIL) #define PSEARCH_OPTION_GCI_FIRST 128 #define PSEARCH_OPTION_GCI_TAIL 256 #define PSEARCH_OPTION_GCI_ALL (PSEARCH_OPTION_GCI_FIRST | PSEARCH_OPTION_GCI_TAIL)
DESCRIPTION
The PSEARCH_OPTION_* are meant to be OR'ed options to a call to patricia_search.
* PSEARCH_OPTION_START : May match start of entry. * PSEARCH_OPTION_START_MANDATORY : Must match start of entry (no need to OR
with PSEARCH_OPTION_START).
* PSEARCH_OPTION_WHOLE : Must match all characters of the query,
otherwise it will match the prefixes.
* PSEARCH_OPTION_END : May match end of entry. * PSEARCH_OPTION_END_MANDATORY : Must match end of entry (no need to OR
with PSEARCH_OPTION_END).
* PSEARCH_OPTION_TAG : Must match start of entry and end of entry. * PSEARCH_OPTION_FULL : Must match start of entry, all characters
of the query and end of entry.
* PSEARCH_OPTION_CI_FIRST : Case insensitive match for the first
character of the query.
* PSEARCH_OPTION_CI_TAIL : Case insensitive match for all but the
first characters of the query.
* PSEARCH_OPTION_CI_ALL : Case insensitive match for all characters
of the query (no need to OR PSEARCH_OPTION_CI_FIRST and PSEARCH_OPTION_CI_TAIL).
* PSEARCH_OPTION_GCI_FIRST : GCI match for the first character of the
query.
* PSEARCH_OPTION_GCI_TAIL : GCI match for all but the first characters
of the query.
* PSEARCH_OPTION_GCI_ALL : GCI match for all characters of the query
(no need to OR PSEARCH_OPTION_GCI_FIRST and PSEARCH_OPTION_GCI_TAIL).
SEE ALSO
patricia_search, psearch_t, psearch_new
trish2/psearch_new [ Functions ]
NAME
psearch_new
SYNOPSIS
#include <patricia_seach.h> psearch_t *psearch_new(patricia_t *pat, int options, patricia_t *gci, int density);
FUNCTION
psearch_new creates a new search context to be passed to patricia_seach.
INPUTS
- pat : PATRICIA tree to search in.
- options : OR'ed set of PSEARCH_OPTION_*.
- gci : GCI table, NULL if none needed.
- density : Estimation of the number of solutions; actually the block size of the solutions bunch.
RETURN VALUE
A freshly allocated pointer to a psearch_t structure filled according to the arguments value.
SEE ALSO
patricia_search, psearch_t, PSEARCH_OPTION_START, PSEARCH_OPTION_START_MANDATORY, PSEARCH_OPTION_WHOLE, PSEARCH_OPTION_END, PSEARCH_OPTION_END_MANDATORY, PSEARCH_OPTION_FULL, PSEARCH_OPTION_TAG, PSEARCH_OPTION_CI_FIRST, PSEARCH_OPTION_CI_TAIL, PSEARCH_OPTION_CI_ALL, PSEARCH_OPTION_GCI_FIRST, PSEARCH_OPTION_GCI_TAIL, PSEARCH_OPTION_GCI_ALL, psearch_reinit, psearch_free, psearch_new_query, psearch, patricia, bunch, gci
trish2/psearch_reinit [ Functions ]
NAME
psearch_reinit
SYNOPSIS
#include <patricia_seach.h> void psearch_reinit(psearch_t *search);
FUNCTION
psearch_reinit discards all solutions and all queries of a search context. However it keeps the options and the GCI table. This function allows to reuse a search context without having to free and realloc.
INPUTS
- search : Search context to reinitialize.
SEE ALSO
patricia_search, psearch_t, psearch
trish2/psearch_free [ Functions ]
NAME
psearch_free
SYNOPSIS
#include <patricia_seach.h> void psearch_free(psearch_t *search);
FUNCTION
psearch_free frees the memory used by search. The PATRICIA tree and the GCI table are not freed.
INPUTS
- search : Search context to destroy.
SEE ALSO
patricia_search, psearch_t, psearch_new
trish2/psearch_new_query [ Functions ]
NAME
psearch_new_query
SYNOPSIS
#include <patricia_seach.h> void psearch_new_query(psearch_t *search, wchar_t *query);
FUNCTION
psearch_new_query adds query to search. search must have been created with psearch_new. query will not be copied so do not modify it or free it before the search is completed.
INPUTS
- search : Search context where to add the query.
- query : Query string.
SEE ALSO
patricia_search, psearch_t, psearch_new, psearch
trish2/psearch [ Functions ]
NAME
psearch
SYNOPSIS
#include <patricia_seach.h> void psearch(psearch_t *search);
FUNCTION
psearch searches a PATRICIA tree according to the parameters contained in search.
To perform a search, you must:
- create a context with psearch_new
- add the queries with psearch_new_query
- call patricia_search
The results are a double link list of psearch_solution_t whose first element is search->used. If first->used is NULL then the search was a failure.
INPUTS
- search : Search context.
SEE ALSO
patricia_search, psearch_solution_t, psearch_t, psearch_new, psearch_new_query