IDZEBRA  2.1.2
Data Structures | Macros | Typedefs | Functions
lookupec.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "dict-p.h"

Go to the source code of this file.

Data Structures

struct  MatchInfo
 

Macros

#define SH(x)   (((x)<<1)+1)
 

Typedefs

typedef unsigned MatchWord
 

Functions

static int lookup_ec (Dict dict, Dict_ptr ptr, MatchInfo *mi, MatchWord *ri_base, int pos, int(*userfunc)(char *), int range, Dict_char *prefix)
 
static MatchInfoprepare_match (Dict_char *pattern)
 
int dict_lookup_ec (Dict dict, char *pattern, int range, int(*userfunc)(char *name))
 lookup item(s) in dictionary with error correction More...
 

Macro Definition Documentation

#define SH (   x)    (((x)<<1)+1)

Definition at line 37 of file lookupec.c.

Referenced by lookup_ec().

Typedef Documentation

typedef unsigned MatchWord

Definition at line 30 of file lookupec.c.

Function Documentation

int dict_lookup_ec ( Dict  dict,
char *  p,
int  range,
int(*)(char *name)  f 
)

lookup item(s) in dictionary with error correction

Parameters
dictdictionary handle
pstring-z with lookup string
rangenumber of allowed errors(extra/substituted/missing char)
ffunction be called for each match (NULL for no call of f)
Return values
0OK
-1error

Function f is called for each item matched.

Definition at line 149 of file lookupec.c.

References dict_strlen(), Dict_struct::head, lookup_ec(), prepare_match(), and Dict_head::root.

static int lookup_ec ( Dict  dict,
Dict_ptr  ptr,
MatchInfo mi,
MatchWord ri_base,
int  pos,
int(*)(char *)  userfunc,
int  range,
Dict_char prefix 
)
static

Definition at line 39 of file lookupec.c.

References Dict_struct::dbf, dict_bf_readp(), DICT_bsize, DICT_EOS, DICT_nodir, MatchInfo::m, MatchInfo::s, and SH.

Referenced by dict_lookup_ec().

static MatchInfo* prepare_match ( Dict_char pattern)
static

Definition at line 133 of file lookupec.c.

References dict_strlen(), MatchInfo::m, and MatchInfo::s.

Referenced by dict_lookup_ec().