TABLE OF CONTENTS


trish2/patricia_search [ Modules ]

[ Top ] [ 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

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

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 ]

[ Top ] [ 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

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 ]

[ Top ] [ 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

SEE ALSO

patricia_search, psearch_t, psearch


trish2/psearch_free [ Functions ]

[ Top ] [ 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

SEE ALSO

patricia_search, psearch_t, psearch_new


trish2/psearch_new_query [ Functions ]

[ Top ] [ 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

SEE ALSO

patricia_search, psearch_t, psearch_new, psearch


trish2/psearch [ Functions ]

[ Top ] [ 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:

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

SEE ALSO

patricia_search, psearch_solution_t, psearch_t, psearch_new, psearch_new_query