Main Page | Modules | Alphabetical List | Data Structures | 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/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"

Defines

#define WOVEC_DFLT   10 /**< Default size of word-vectors */
 Default size of word-vectors.

#define MASK_LETTER(x)   (1 << (x)) /**< bits 0 to 25 */
 bits 0 to 25

#define MASK_DIGIT   0x80000000
#define ST_MIN_BIN_SIZE   4

Functions

 RCSID ("$Id:matching.c, v 1.15 2005/10/26 11:54:56 cbiere Exp $")
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.

size_t match_map_string (char_map_t map, gchar *string)
 Apply a char map to a string, inplace.

void st_initialize (search_table_t *table, char_map_t map)
 Initialize permanent data in search table.

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, gchar k[2])
 Get key of two-char pair.

void st_insert_item (search_table_t *table, const gchar *s, struct shared_file *sf)
 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 (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, gchar *search, void(*callback)(gpointer, shared_file_t *), gpointer ctx, gint max_res, query_hashvec_t *qhv)
 Do an actual search.


Define Documentation

#define MASK_DIGIT   0x80000000
 

#define MASK_LETTER  )     (1 << (x)) /**< bits 0 to 25 */
 

bits 0 to 25

#define ST_MIN_BIN_SIZE   4
 

#define WOVEC_DFLT   10 /**< Default size of word-vectors */
 

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 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.

size_t match_map_string char_map_t  map,
gchar *  string
 

Apply a char map to a string, inplace.

Returns:
length of string.

RCSID "$Id:matching.  c,
v 1.15 2005/10/26 11:54:56 cbiere Exp $" 
 

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_initialize search_table_t table,
char_map_t  map
 

Initialize permanent data in search table.

void st_insert_item search_table_t table,
const gchar *  s,
struct shared_file sf
 

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

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

Get key of two-char pair.

void st_search search_table_t table,
gchar *  search,
void(*  callback)(gpointer, shared_file_t *),
gpointer  ctx,
gint  max_res,
query_hashvec_t qhv
 

Do an actual search.


Generated on Sun Feb 12 10:50:04 2006 for Gtk-Gnutella by doxygen 1.3.6