IDZEBRA
2.2.7
|
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <yaz/tpath.h>
#include <yaz/snprintf.h>
#include <idzebra/util.h>
#include <dfa.h>
#include <idzebra/recgrs.h>
Go to the source code of this file.
Data Structures | |
struct | regxCode |
struct | lexRuleAction |
struct | lexRuleInfo |
struct | lexRule |
struct | lexContext |
struct | lexConcatBuf |
struct | lexSpec |
struct | lexSpecs |
Macros | |
#define | REGX_DEBUG 0 |
#define | F_WIN_EOF 2000000000 |
#define | F_WIN_READ 1 |
#define | REGX_EOF 0 |
#define | REGX_PATTERN 1 |
#define | REGX_BODY 2 |
#define | REGX_BEGIN 3 |
#define | REGX_END 4 |
#define | REGX_CODE 5 |
#define | REGX_CONTEXT 6 |
#define | REGX_INIT 7 |
Functions | |
static char * | f_win_get (struct lexSpec *spec, off_t start_pos, off_t end_pos, int *size) |
static int | f_win_advance (struct lexSpec *spec, int *pos) |
static void | regxCodeDel (struct regxCode **pp) |
static void | regxCodeMk (struct regxCode **pp, const char *buf, int len) |
static struct DFA * | lexSpecDFA (void) |
static void | actionListDel (struct lexRuleAction **rap) |
static struct lexContext * | lexContextCreate (const char *name) |
static void | lexContextDestroy (struct lexContext *p) |
static struct lexSpec * | lexSpecCreate (const char *name, data1_handle dh) |
static void | lexSpecDestroy (struct lexSpec **pp) |
static int | readParseToken (const char **cpp, int *len) |
static int | actionListMk (struct lexSpec *spec, const char *s, struct lexRuleAction **ap) |
int | readOneSpec (struct lexSpec *spec, const char *s) |
int | readFileSpec (struct lexSpec *spec) |
static void | execData (struct lexSpec *spec, const char *ebuf, int elen, int formatted_text, const char *attribute_str, int attribute_len) |
static void | execDataP (struct lexSpec *spec, const char *ebuf, int elen, int formatted_text) |
static void | tagDataRelease (struct lexSpec *spec) |
static void | variantBegin (struct lexSpec *spec, const char *class_str, int class_len, const char *type_str, int type_len, const char *value_str, int value_len) |
static void | tagStrip (const char **tag, int *len) |
static void | tagBegin (struct lexSpec *spec, const char *tag, int len) |
static void | tagEnd (struct lexSpec *spec, int min_level, const char *tag, int len) |
static int | tryMatch (struct lexSpec *spec, int *pptr, int *mptr, struct DFA *dfa, int greedy) |
static int | execTok (struct lexSpec *spec, const char **src, const char **tokBuf, int *tokLen) |
static char * | regxStrz (const char *src, int len, char *str) |
static void | execCode (struct lexSpec *spec, struct regxCode *code) |
static int | execAction (struct lexSpec *spec, struct lexRuleAction *ap, int start_ptr, int *pptr) |
static int | execRule (struct lexSpec *spec, struct lexContext *context, int ruleNo, int start_ptr, int *pptr) |
int | lexNode (struct lexSpec *spec, int *ptr) |
static data1_node * | lexRoot (struct lexSpec *spec, off_t offset, const char *context_name) |
void | grs_destroy (void *clientData) |
void * | grs_init (Res res, RecType recType) |
ZEBRA_RES | grs_config (void *clientData, Res res, const char *args) |
data1_node * | grs_read_regx (struct grs_read_info *p) |
static int | extract_regx (void *clientData, struct recExtractCtrl *ctrl) |
static int | retrieve_regx (void *clientData, struct recRetrieveCtrl *ctrl) |
Variables | |
static struct recType | regx_type |
RecType | idzebra_filter [] |
#define F_WIN_EOF 2000000000 |
Definition at line 45 of file mod_grs_regx.c.
#define F_WIN_READ 1 |
Definition at line 46 of file mod_grs_regx.c.
#define REGX_BEGIN 3 |
Definition at line 51 of file mod_grs_regx.c.
#define REGX_BODY 2 |
Definition at line 50 of file mod_grs_regx.c.
#define REGX_CODE 5 |
Definition at line 53 of file mod_grs_regx.c.
#define REGX_CONTEXT 6 |
Definition at line 54 of file mod_grs_regx.c.
#define REGX_DEBUG 0 |
Definition at line 43 of file mod_grs_regx.c.
#define REGX_END 4 |
Definition at line 52 of file mod_grs_regx.c.
#define REGX_EOF 0 |
Definition at line 48 of file mod_grs_regx.c.
#define REGX_INIT 7 |
Definition at line 55 of file mod_grs_regx.c.
#define REGX_PATTERN 1 |
Definition at line 49 of file mod_grs_regx.c.
|
static |
Definition at line 245 of file mod_grs_regx.c.
References lexRuleAction::code, dfa_delete(), lexRuleAction::next, lexRuleAction::pattern, REGX_CODE, REGX_PATTERN, regxCodeDel(), lexRuleAction::u, and lexRuleAction::which.
Referenced by lexContextDestroy(), and readOneSpec().
|
static |
Definition at line 443 of file mod_grs_regx.c.
References debug_dfa_tran, dfa_mkstate(), dfa_parse(), lexSpecDFA(), lexRuleAction::next, readParseToken(), REGX_BEGIN, REGX_BODY, REGX_CODE, REGX_END, REGX_INIT, REGX_PATTERN, regxCodeMk(), and lexRuleAction::which.
Referenced by readOneSpec().
|
static |
Definition at line 1614 of file mod_grs_regx.c.
References lexSpec::arg_end, lexSpec::arg_no, lexSpec::arg_start, lexRuleAction::code, execCode(), F_WIN_EOF, lexRuleAction::next, lexRuleAction::pattern, lexSpec::ptr, REGX_CODE, REGX_END, REGX_PATTERN, lexSpec::stop_flag, tryMatch(), lexRuleAction::u, and lexRuleAction::which.
Referenced by execRule(), and lexRoot().
Definition at line 1318 of file mod_grs_regx.c.
References lexSpec::arg_no, lexSpec::arg_start, lexSpec::context, lexSpec::context_stack, lexSpec::context_stack_top, lexSpec::d1_level, lexSpec::d1_stack, data1_mk_root(), data1_mk_tag(), lexSpec::dh, execData(), execTok(), lexSpec::m, lexContext::name, lexContext::next, lexSpec::ptr, regxStrz(), lexSpec::stop_flag, regxCode::str, tagBegin(), tagDataRelease(), tagEnd(), and variantBegin().
Referenced by execAction().
|
static |
Definition at line 673 of file mod_grs_regx.c.
References lexConcatBuf::buf, lexSpec::concatBuf, lexSpec::d1_level, lexSpec::d1_stack, data1_node::data, data1_mk_node2(), DATA1I_text, DATA1N_data, DATA1N_tag, lexSpec::dh, data1_node::formatted_text, lexSpec::m, lexConcatBuf::max, data1_xattr::next, data1_node::next, data1_node::parent, data1_node::tag, data1_node::u, and data1_node::which.
Referenced by execCode(), and execDataP().
|
static |
Definition at line 774 of file mod_grs_regx.c.
References execData(), and data1_node::formatted_text.
Referenced by lexNode().
|
static |
Definition at line 1691 of file mod_grs_regx.c.
References lexRuleInfo::actionList, execAction(), lexContext::fastRule, and lexContext::ruleNo.
Referenced by lexNode().
|
static |
Definition at line 1007 of file mod_grs_regx.c.
References lexSpec::arg_end, lexSpec::arg_no, lexSpec::arg_start, and f_win_get().
Referenced by execCode().
|
static |
Definition at line 1934 of file mod_grs_regx.c.
References grs_read_regx(), and zebra_grs_extract().
|
static |
Definition at line 184 of file mod_grs_regx.c.
References lexSpec::f_win_buf, lexSpec::f_win_end, F_WIN_EOF, f_win_get(), and lexSpec::f_win_start.
Referenced by lexNode(), and tryMatch().
|
static |
Definition at line 146 of file mod_grs_regx.c.
References lexSpec::f_win_buf, lexSpec::f_win_end, lexSpec::f_win_rf, lexSpec::f_win_sf, lexSpec::f_win_size, lexSpec::f_win_start, and lexSpec::stream.
Referenced by execTok(), f_win_advance(), and lexNode().
Definition at line 1888 of file mod_grs_regx.c.
References lexSpecs::type, and ZEBRA_OK.
void grs_destroy | ( | void * | clientData | ) |
Definition at line 1869 of file mod_grs_regx.c.
References lexSpecDestroy(), and lexSpecs::spec.
Definition at line 1879 of file mod_grs_regx.c.
References lexSpecs::spec, and lexSpecs::type.
data1_node* grs_read_regx | ( | struct grs_read_info * | p | ) |
Definition at line 1896 of file mod_grs_regx.c.
References grs_read_info::clientData, grs_read_info::dh, ZebraRecStream::endf, lexRoot(), lexSpecCreate(), lexSpecDestroy(), grs_read_info::mem, ZebraRecStream::readf, readFileSpec(), REGX_DEBUG, ZebraRecStream::seekf, lexSpecs::spec, grs_read_info::stream, ZebraRecStream::tellf, and lexSpecs::type.
Referenced by extract_regx().
|
static |
Definition at line 266 of file mod_grs_regx.c.
References lexContext::beginActionList, lexContext::dfa, lexContext::endActionList, lexContext::fastRule, lexContext::initActionList, lexContext::initFlag, lexSpecDFA(), lexContext::name, lexContext::next, lexContext::ruleNo, and lexContext::rules.
Referenced by readOneSpec().
|
static |
Definition at line 283 of file mod_grs_regx.c.
References lexRuleInfo::actionList, actionListDel(), lexContext::beginActionList, lexContext::dfa, dfa_delete(), lexContext::endActionList, lexContext::fastRule, lexRule::info, lexContext::initActionList, lexContext::name, lexRule::next, and lexContext::rules.
Referenced by lexSpecDestroy().
int lexNode | ( | struct lexSpec * | spec, |
int * | ptr | ||
) |
Definition at line 1701 of file mod_grs_regx.c.
References DFA_tran::ch, lexSpec::context_stack, lexSpec::context_stack_top, lexContext::dfa, execDataP(), execRule(), f_win_advance(), lexSpec::f_win_ef, F_WIN_EOF, f_win_get(), DFA_state::rule_nno, DFA_state::rule_no, DFA::states, lexSpec::stream, DFA_tran::to, DFA_state::tran_no, and DFA_state::trans.
Referenced by lexRoot().
|
static |
Definition at line 1825 of file mod_grs_regx.c.
References lexContext::beginActionList, lexSpec::context, lexSpec::context_stack, lexSpec::context_stack_top, lexSpec::d1_level, lexSpec::d1_stack, lexContext::endActionList, execAction(), lexContext::initActionList, lexContext::initFlag, lexNode(), lexContext::name, lexContext::next, lexSpec::stop_flag, and tagDataRelease().
Referenced by grs_read_regx().
|
static |
Definition at line 302 of file mod_grs_regx.c.
References lexConcatBuf::buf, lexSpec::concatBuf, lexSpec::context, lexSpec::context_stack, lexSpec::context_stack_size, lexSpec::d1_level, lexSpec::d1_stack, lexSpec::dh, lexSpec::f_win_buf, lexConcatBuf::max, lexSpec::maxLevel, and lexSpec::name.
Referenced by grs_read_regx().
|
static |
Definition at line 334 of file mod_grs_regx.c.
References lexConcatBuf::buf, lexSpec::concatBuf, lexSpec::context, lexSpec::context_stack, lexSpec::d1_stack, lexSpec::f_win_buf, lexContextDestroy(), lexSpec::maxLevel, lexSpec::name, and lexContext::next.
Referenced by grs_destroy(), and grs_read_regx().
|
static |
Definition at line 234 of file mod_grs_regx.c.
References dfa_init(), dfa_parse_cmap_add(), and dfa_parse_cmap_del().
Referenced by actionListMk(), and lexContextCreate().
int readFileSpec | ( | struct lexSpec * | spec | ) |
Definition at line 572 of file mod_grs_regx.c.
References lexSpec::context, data1_path_fopen(), debug_dfa_followpos, debug_dfa_tran, debug_dfa_trav, lexContext::dfa, dfa_mkstate(), dfa_verbose, lexSpec::dh, lexContext::fastRule, lexRule::info, lexSpec::lineNo, lexSpec::name, lexRule::next, lexContext::next, lexRuleInfo::no, readOneSpec(), lexContext::ruleNo, and lexContext::rules.
Referenced by grs_read_regx().
int readOneSpec | ( | struct lexSpec * | spec, |
const char * | s | ||
) |
Definition at line 505 of file mod_grs_regx.c.
References lexRuleInfo::actionList, actionListDel(), actionListMk(), lexContext::beginActionList, lexSpec::context, lexContext::dfa, dfa_parse(), lexContext::endActionList, lexRule::info, lexContext::initActionList, lexContextCreate(), lexRule::next, lexContext::next, lexRuleInfo::no, readParseToken(), REGX_BEGIN, REGX_CODE, REGX_CONTEXT, REGX_END, REGX_INIT, REGX_PATTERN, lexContext::ruleNo, and lexContext::rules.
Referenced by readFileSpec().
|
static |
Definition at line 368 of file mod_grs_regx.c.
References REGX_BEGIN, REGX_BODY, REGX_CODE, REGX_CONTEXT, REGX_END, REGX_INIT, and REGX_PATTERN.
Referenced by actionListMk(), and readOneSpec().
|
static |
Definition at line 203 of file mod_grs_regx.c.
References regxCode::str.
Referenced by actionListDel().
|
static |
Definition at line 218 of file mod_grs_regx.c.
References regxCode::str.
Referenced by actionListMk().
|
static |
Definition at line 1072 of file mod_grs_regx.c.
Referenced by execCode().
|
static |
Definition at line 1939 of file mod_grs_regx.c.
|
static |
Definition at line 883 of file mod_grs_regx.c.
References lexSpec::d1_level, lexSpec::d1_stack, data1_mk_tag_n(), lexSpec::dh, data1_node::len, lexSpec::m, data1_node::tag, tagDataRelease(), and tagStrip().
Referenced by execCode().
|
static |
Definition at line 780 of file mod_grs_regx.c.
References lexConcatBuf::buf, lexSpec::concatBuf, lexSpec::d1_level, lexSpec::d1_stack, data1_node::data, DATA1_LOCALDATA, DATA1I_text, DATA1N_data, data1_node::lbuf, lexSpec::m, data1_node::u, and data1_node::which.
Referenced by execCode(), lexRoot(), tagBegin(), tagEnd(), and variantBegin().
|
static |
Definition at line 904 of file mod_grs_regx.c.
References lexSpec::d1_level, lexSpec::d1_stack, DATA1N_tag, data1_node::len, data1_node::tag, tagDataRelease(), tagStrip(), data1_node::u, and data1_node::which.
Referenced by execCode().
|
static |
Definition at line 870 of file mod_grs_regx.c.
References data1_node::len, and data1_node::tag.
Referenced by tagBegin(), and tagEnd().
|
static |
Definition at line 927 of file mod_grs_regx.c.
References DFA_tran::ch, f_win_advance(), F_WIN_EOF, DFA_state::rule_nno, DFA_state::rule_no, DFA::states, DFA_tran::to, DFA_state::tran_no, and DFA_state::trans.
Referenced by execAction().
|
static |
Definition at line 799 of file mod_grs_regx.c.
References lexSpec::d1_level, lexSpec::d1_stack, data1_getvartypeby_absyn(), DATA1_LOCALDATA, DATA1_MAX_SYMBOL, data1_mk_node2(), DATA1N_variant, lexSpec::dh, data1_node::lbuf, lexSpec::m, data1_node::parent, data1_node::root, tagDataRelease(), data1_node::u, data1_node::variant, and data1_node::which.
Referenced by execCode().
RecType idzebra_filter[] |
Definition at line 2029 of file mod_grs_regx.c.
|
static |
Definition at line 1939 of file mod_grs_regx.c.