Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

matching.c File Reference

#include "common.h"
#include "matching.h"
#include "qrp.h"
#include "share.h"
#include "lib/atoms.h"
#include "lib/pattern.h"
#include "lib/misc.h"
#include "lib/utf8.h"
#include "lib/wordvec.h"
#include "lib/walloc.h"
#include "lib/zalloc.h"
#include "if/gnet_property_priv.h"
#include "lib/override.h"

Data Structures

struct  st_entry
struct  st_bin
struct  _search_table

Defines

#define WOVEC_DFLT   10
 Default size of word-vectors.
#define MASK_LETTER(x)   (1 << (x))
 bits 0 to 25
#define MASK_DIGIT   0x80000000
#define ST_MIN_BIN_SIZE   4

Functions

void destroy_entry (struct st_entry *entry)
void bin_initialize (struct st_bin *bin, gint size)
 Initialize a bin.
st_binbin_allocate (void)
 Allocate a bin.
void bin_destroy (struct st_bin *bin)
 Destroy a bin.
void bin_insert_item (struct st_bin *bin, struct st_entry *entry)
 Inserts an item into a bin.
void bin_compact (struct st_bin *bin)
 Makes a bin take as little memory as needed.
void setup_map (void)
void st_initialize (search_table_t *table)
 Initialize permanent data in search table.
search_table_tst_alloc (void)
 Allocates a new search_table_t.
void st_free (search_table_t **ptr)
void st_create (search_table_t *table)
 Recreate variable parts of the search table.
void st_destroy (search_table_t *table)
 Destroy a search table.
guint32 mask_hash (const gchar *s)
 Compute character mask "hash", using one bit per letter of the alphabet, plus one for any digit.
gint st_key (search_table_t *table, const gchar k[2])
 Get key of two-char pair.
gboolean st_insert_item (search_table_t *table, const gchar *s, gpointer data)
 Insert an item into the search_table one-char strings are silently ignored.
void st_compact (search_table_t *table)
 Minimize space consumption.
gboolean entry_match (const gchar *text, size_t tlen, cpattern_t **pw, word_vec_t *wovec, size_t wn)
 Apply pattern matching on text, matching at the *beginning* of words.
void st_search (search_table_t *table, const gchar *search_term, st_search_callback callback, gpointer ctx, gint max_res, query_hashvec_t *qhv)
 Do an actual search.

Variables

guchar map [(guchar)-1]


Define Documentation

#define MASK_DIGIT   0x80000000
 

#define MASK_LETTER  )     (1 << (x))
 

bits 0 to 25

#define ST_MIN_BIN_SIZE   4
 

#define WOVEC_DFLT   10
 

Default size of word-vectors.


Function Documentation

struct st_bin* bin_allocate void   )  [static]
 

Allocate a bin.

void bin_compact struct st_bin bin  )  [static]
 

Makes a bin take as little memory as needed.

void bin_destroy struct st_bin bin  )  [static]
 

Destroy a bin.

Note:
Do NOT destroy the st_entry's, since they may be shared.

void bin_initialize struct st_bin bin,
gint  size
[static]
 

Initialize a bin.

void bin_insert_item struct st_bin bin,
struct st_entry entry
[static]
 

Inserts an item into a bin.

void destroy_entry struct st_entry entry  )  [static]
 

gboolean entry_match const gchar *  text,
size_t  tlen,
cpattern_t **  pw,
word_vec_t wovec,
size_t  wn
[static]
 

Apply pattern matching on text, matching at the *beginning* of words.

Patterns are lazily compiled as needed, using pattern_compile_fast().

guint32 mask_hash const gchar *  s  )  [static]
 

Compute character mask "hash", using one bit per letter of the alphabet, plus one for any digit.

void setup_map void   )  [static]
 

search_table_t* st_alloc void   ) 
 

Allocates a new search_table_t.

Use st_free() to free it.

void st_compact search_table_t table  ) 
 

Minimize space consumption.

void st_create search_table_t table  ) 
 

Recreate variable parts of the search table.

void st_destroy search_table_t table  ) 
 

Destroy a search table.

void st_free search_table_t **  ptr  ) 
 

void st_initialize search_table_t table  ) 
 

Initialize permanent data in search table.

gboolean st_insert_item search_table_t table,
const gchar *  s,
gpointer  data
 

Insert an item into the search_table one-char strings are silently ignored.

Returns:
TRUE if the item was inserted; FALSE otherwise.

gint st_key search_table_t table,
const gchar  k[2]
[inline, static]
 

Get key of two-char pair.

void st_search search_table_t table,
const gchar *  search_term,
st_search_callback  callback,
gpointer  ctx,
gint  max_res,
query_hashvec_t qhv
 

Do an actual search.


Variable Documentation

guchar map[(guchar)-1] [static]
 


Generated on Sat Jun 30 17:53:28 2007 for gtk-gnutella by  doxygen 1.3.9.1