IDZEBRA
2.2.7
|
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <dfa.h>
#include "dict-p.h"
Go to the source code of this file.
Data Structures | |
struct | MatchContext |
Macros | |
#define | WORD_BITS 32 |
#define | MAX_LENGTH 1024 |
#define | INLINE |
Typedefs | |
typedef unsigned | MatchWord |
Functions | |
static INLINE void | set_bit (MatchContext *mc, MatchWord *m, int ch, int state) |
static INLINE MatchWord | get_bit (MatchContext *mc, MatchWord *m, int ch, int state) |
static MatchContext * | mk_MatchContext (struct DFA *dfa, int range) |
static void | rm_MatchContext (MatchContext **mc) |
static void | mask_shift (MatchContext *mc, MatchWord *Rdst, MatchWord *Rsrc, struct DFA *dfa, int ch) |
static void | shift (MatchContext *mc, MatchWord *Rdst, MatchWord *Rsrc, struct DFA *dfa) |
static void | or (MatchContext *mc, MatchWord *Rdst, MatchWord *Rsrc1, MatchWord *Rsrc2) |
static INLINE int | move (MatchContext *mc, MatchWord *Rj1, MatchWord *Rj, Dict_char ch, struct DFA *dfa, MatchWord *Rtmp, int range) |
static int | grep (Dict dict, Dict_ptr ptr, MatchContext *mc, MatchWord *Rj, int pos, void *client, int(*userfunc)(char *, const char *, void *), Dict_char *prefix, struct DFA *dfa, int *max_pos, int init_pos) |
int | dict_lookup_grep (Dict dict, const char *pattern, int range, void *client, int *max_pos, int init_pos, int(*userfunc)(char *name, const char *info, void *client)) |
regular expression search with error correction More... | |
void | dict_grep_cmap (Dict dict, void *vp, const char **(*cmap)(void *vp, const char **from, int len)) |
install character mapping handler for dict_lookup_grep More... | |
#define INLINE |
Definition at line 54 of file lookgrep.c.
#define MAX_LENGTH 1024 |
Definition at line 35 of file lookgrep.c.
#define WORD_BITS 32 |
Definition at line 34 of file lookgrep.c.
typedef unsigned MatchWord |
Definition at line 33 of file lookgrep.c.
void dict_grep_cmap | ( | Dict | dict, |
void * | vp, | ||
const char **(*)(void *vp, const char **from, int len) | cmap | ||
) |
install character mapping handler for dict_lookup_grep
dict | dictionary handle |
vp | client data to be passed to cmap function handler |
cmap | function be called for each character |
This function must be called prior to using dict_grep_lookup. If vp is NULL, no character mapping takes place for dict_lookup_grep.
Definition at line 445 of file lookgrep.c.
References dict, Dict_struct::grep_cmap, and Dict_struct::grep_cmap_data.
Referenced by rpn_char_map_prepare(), and rpn_search_xpath().
int dict_lookup_grep | ( | Dict | dict, |
const char * | p, | ||
int | range, | ||
void * | client, | ||
int * | max_pos, | ||
int | init_pos, | ||
int(*)(char *name, const char *info, void *client) | f | ||
) |
regular expression search with error correction
dict | dictionary handle |
p | regular expression string-z |
range | number of allowed errors(extra/substituted/missing char) |
client | client data pointer to be passed to match function f |
max_pos | on return holds maximum number of chars that match (prefix) |
init_pos | number of leading non-error corrected chars. |
f | function be called for each match |
0 | Operation complete. Function f returned zero value always |
>0 | Operation incomplete. Function f returned a non-zero value |
-1 | error (such as bad regular expression) |
The function f is called for each match. If function f returns non-zero value the grep operation is stopped and the returned non-zero value is also returned by dict_lookup_ec.
Definition at line 374 of file lookgrep.c.
References debug_dfa_followpos, debug_dfa_tran, debug_dfa_trav, dfa_anyset_includes_nl(), dfa_delete(), dfa_init(), dfa_mkstate(), dfa_parse(), dfa_set_cmap(), dfa_verbose, dict, MatchContext::fact, get_bit(), grep(), Dict_struct::grep_cmap, Dict_struct::grep_cmap_data, Dict_struct::head, init_pos(), MAX_LENGTH, mk_MatchContext(), MatchContext::n, DFA::no_states, MatchContext::range, rm_MatchContext(), Dict_head::root, set_bit(), DFA::states, DFA_tran::to, DFA_state::tran_no, and DFA_state::trans.
Referenced by main(), numeric_relation(), string_term(), and xpath_trunc().
|
static |
Definition at line 64 of file lookgrep.c.
References MatchContext::n, and WORD_BITS.
Referenced by dict_lookup_grep().
|
static |
Definition at line 244 of file lookgrep.c.
References Dict_struct::dbf, dict, dict_bf_readp(), DICT_bsize, DICT_EOS, DICT_nodir, MatchContext::fact, init_pos(), MatchContext::match_mask, move(), MatchContext::n, and MatchContext::range.
Referenced by dict_lookup_grep().
|
static |
Definition at line 96 of file lookgrep.c.
References DFA_tran::ch, MatchContext::n, DFA::no_states, set_bit(), DFA::states, DFA_tran::to, DFA_state::tran_no, DFA_state::trans, and WORD_BITS.
Referenced by move().
|
static |
Definition at line 73 of file lookgrep.c.
References MatchContext::fact, MatchContext::match_mask, MatchContext::n, DFA::no_states, MatchContext::range, DFA_state::rule_no, set_bit(), DFA::states, and WORD_BITS.
Referenced by dict_lookup_grep().
|
static |
Definition at line 215 of file lookgrep.c.
References mask_shift(), MatchContext::n, or(), MatchContext::range, and shift().
Referenced by grep().
|
static |
|
static |
Definition at line 89 of file lookgrep.c.
Referenced by dict_lookup_grep().
|
static |
Definition at line 56 of file lookgrep.c.
References MatchContext::n, and WORD_BITS.
Referenced by dict_lookup_grep(), mask_shift(), mk_MatchContext(), and shift().
|
static |
Definition at line 156 of file lookgrep.c.
References MatchContext::n, DFA::no_states, set_bit(), DFA::states, DFA_tran::to, DFA_state::tran_no, DFA_state::trans, and WORD_BITS.
Referenced by move().