IDZEBRA 2.2.11
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)

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 MatchInfo * prepare_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

Macro Definition Documentation

◆ SH

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

Definition at line 37 of file lookupec.c.

Referenced by lookup_ec().

Function Documentation

◆ dict_lookup_ec()

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

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, dict_strlen(), lookup_ec(), and prepare_match().

◆ lookup_ec()

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

Definition at line 39 of file lookupec.c.

References dict, dict_bf_readp(), DICT_bsize, DICT_EOS, DICT_nodir, lookup_ec(), MatchInfo::m, MatchInfo::s, and SH.

Referenced by dict_lookup_ec(), and lookup_ec().

◆ prepare_match()

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