IDZEBRA  2.1.2
Data Structures | Macros | Functions | Variables
mod_grs_regx.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <yaz/tpath.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 DFAlexSpecDFA (void)
 
static void actionListDel (struct lexRuleAction **rap)
 
static struct lexContextlexContextCreate (const char *name)
 
static void lexContextDestroy (struct lexContext *p)
 
static struct lexSpeclexSpecCreate (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_nodelexRoot (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_nodegrs_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 []
 

Macro Definition Documentation

#define F_WIN_EOF   2000000000

Definition at line 44 of file mod_grs_regx.c.

Referenced by execAction(), f_win_advance(), lexNode(), and tryMatch().

#define F_WIN_READ   1

Definition at line 45 of file mod_grs_regx.c.

#define REGX_BEGIN   3

Definition at line 50 of file mod_grs_regx.c.

Referenced by actionListMk(), readOneSpec(), and readParseToken().

#define REGX_BODY   2

Definition at line 49 of file mod_grs_regx.c.

Referenced by actionListMk(), and readParseToken().

#define REGX_CODE   5

Definition at line 52 of file mod_grs_regx.c.

Referenced by actionListDel(), actionListMk(), execAction(), readOneSpec(), and readParseToken().

#define REGX_CONTEXT   6

Definition at line 53 of file mod_grs_regx.c.

Referenced by readOneSpec(), and readParseToken().

#define REGX_DEBUG   0

Definition at line 42 of file mod_grs_regx.c.

Referenced by grs_read_regx().

#define REGX_END   4

Definition at line 51 of file mod_grs_regx.c.

Referenced by actionListMk(), execAction(), readOneSpec(), and readParseToken().

#define REGX_EOF   0

Definition at line 47 of file mod_grs_regx.c.

#define REGX_INIT   7

Definition at line 54 of file mod_grs_regx.c.

Referenced by actionListMk(), readOneSpec(), and readParseToken().

#define REGX_PATTERN   1

Definition at line 48 of file mod_grs_regx.c.

Referenced by actionListDel(), actionListMk(), execAction(), readOneSpec(), and readParseToken().

Function Documentation

static void actionListDel ( struct lexRuleAction **  rap)
static
static int actionListMk ( struct lexSpec spec,
const char *  s,
struct lexRuleAction **  ap 
)
static
static int execAction ( struct lexSpec spec,
struct lexRuleAction ap,
int  start_ptr,
int *  pptr 
)
static
static void execCode ( struct lexSpec spec,
struct regxCode code 
)
static
static void execData ( struct lexSpec spec,
const char *  ebuf,
int  elen,
int  formatted_text,
const char *  attribute_str,
int  attribute_len 
)
static
static void execDataP ( struct lexSpec spec,
const char *  ebuf,
int  elen,
int  formatted_text 
)
static

Definition at line 773 of file mod_grs_regx.c.

References execData().

Referenced by lexNode().

static int execRule ( struct lexSpec spec,
struct lexContext context,
int  ruleNo,
int  start_ptr,
int *  pptr 
)
static

Definition at line 1690 of file mod_grs_regx.c.

References lexRuleInfo::actionList, execAction(), and lexContext::fastRule.

Referenced by lexNode().

static int execTok ( struct lexSpec spec,
const char **  src,
const char **  tokBuf,
int *  tokLen 
)
static

Definition at line 1006 of file mod_grs_regx.c.

References lexSpec::arg_end, lexSpec::arg_no, lexSpec::arg_start, and f_win_get().

Referenced by execCode().

static int extract_regx ( void *  clientData,
struct recExtractCtrl ctrl 
)
static

Definition at line 1933 of file mod_grs_regx.c.

References grs_read_regx(), and zebra_grs_extract().

static int f_win_advance ( struct lexSpec spec,
int *  pos 
)
static

Definition at line 183 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 char* f_win_get ( struct lexSpec spec,
off_t  start_pos,
off_t  end_pos,
int *  size 
)
static
ZEBRA_RES grs_config ( void *  clientData,
Res  res,
const char *  args 
)

Definition at line 1887 of file mod_grs_regx.c.

References lexSpecs::type, and ZEBRA_OK.

void grs_destroy ( void *  clientData)

Definition at line 1868 of file mod_grs_regx.c.

References lexSpecDestroy(), and lexSpecs::spec.

void* grs_init ( Res  res,
RecType  recType 
)

Definition at line 1878 of file mod_grs_regx.c.

References lexSpecs::spec, and lexSpecs::type.

data1_node* grs_read_regx ( struct grs_read_info p)
static struct lexContext* lexContextCreate ( const char *  name)
static
static void lexContextDestroy ( struct lexContext p)
static
int lexNode ( struct lexSpec spec,
int *  ptr 
)
static data1_node* lexRoot ( struct lexSpec spec,
off_t  offset,
const char *  context_name 
)
static
static struct lexSpec* lexSpecCreate ( const char *  name,
data1_handle  dh 
)
static
static void lexSpecDestroy ( struct lexSpec **  pp)
static
static struct DFA* lexSpecDFA ( void  )
static

Definition at line 233 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)
int readOneSpec ( struct lexSpec spec,
const char *  s 
)
static int readParseToken ( const char **  cpp,
int *  len 
)
static

Definition at line 367 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 void regxCodeDel ( struct regxCode **  pp)
static

Definition at line 202 of file mod_grs_regx.c.

References regxCode::str.

Referenced by actionListDel().

static void regxCodeMk ( struct regxCode **  pp,
const char *  buf,
int  len 
)
static

Definition at line 217 of file mod_grs_regx.c.

References regxCode::str.

Referenced by actionListMk().

static char* regxStrz ( const char *  src,
int  len,
char *  str 
)
static
static int retrieve_regx ( void *  clientData,
struct recRetrieveCtrl ctrl 
)
static

Definition at line 1938 of file mod_grs_regx.c.

References grs_read_regx(), and zebra_grs_retrieve().

static void tagBegin ( struct lexSpec spec,
const char *  tag,
int  len 
)
static
static void tagDataRelease ( struct lexSpec spec)
static
static void tagEnd ( struct lexSpec spec,
int  min_level,
const char *  tag,
int  len 
)
static
static void tagStrip ( const char **  tag,
int *  len 
)
static

Definition at line 869 of file mod_grs_regx.c.

Referenced by tagBegin(), and tagEnd().

static int tryMatch ( struct lexSpec spec,
int *  pptr,
int *  mptr,
struct DFA dfa,
int  greedy 
)
static
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

Variable Documentation

RecType idzebra_filter[]
Initial value:
= {
0,
}
static struct recType regx_type

Definition at line 2031 of file mod_grs_regx.c.

struct recType regx_type
static
Initial value:
= {
0,
"grs.regx",
}
static int retrieve_regx(void *clientData, struct recRetrieveCtrl *ctrl)
void * grs_init(Res res, RecType recType)
ZEBRA_RES grs_config(void *clientData, Res res, const char *args)
void grs_destroy(void *clientData)
static int extract_regx(void *clientData, struct recExtractCtrl *ctrl)

Definition at line 1943 of file mod_grs_regx.c.