IDZEBRA  2.2.7
Data Structures | Macros | Typedefs | Functions | Variables
grepper.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <idzebra/util.h>
#include <yaz/yaz-util.h>
#include <dfa.h>
#include "imalloc.h"

Go to the source code of this file.

Data Structures

struct  MatchContext
 

Macros

#define WORD_BITS   32
 
#define INFBUF_SIZE   16384
 
#define INLINE
 

Typedefs

typedef unsigned MatchWord
 

Functions

static INLINE void set_bit (MatchContext *mc, MatchWord *m, int ch, int state)
 
static INLINE void reset_bit (MatchContext *mc, MatchWord *m, int ch, int state)
 
static INLINE MatchWord get_bit (MatchContext *mc, MatchWord *m, int ch, int state)
 
static MatchContextmk_MatchContext (struct DFA *dfa, int range)
 
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 int go (MatchContext *mc, struct DFA *dfa, FILE *inf)
 
static int grep_file (struct DFA *dfa, const char *fname, int range)
 
int main (int argc, char **argv)
 

Variables

char * prog
 
static int show_line = 0
 

Macro Definition Documentation

◆ INFBUF_SIZE

#define INFBUF_SIZE   16384

Definition at line 47 of file grepper.c.

◆ INLINE

#define INLINE

Definition at line 49 of file grepper.c.

◆ WORD_BITS

#define WORD_BITS   32

Definition at line 39 of file grepper.c.

Typedef Documentation

◆ MatchWord

typedef unsigned MatchWord

Definition at line 38 of file grepper.c.

Function Documentation

◆ get_bit()

static INLINE MatchWord get_bit ( MatchContext mc,
MatchWord m,
int  ch,
int  state 
)
static

Definition at line 68 of file grepper.c.

References MatchContext::n, and WORD_BITS.

Referenced by go().

◆ go()

static int go ( MatchContext mc,
struct DFA dfa,
FILE *  inf 
)
static

◆ grep_file()

static int grep_file ( struct DFA dfa,
const char *  fname,
int  range 
)
static

Definition at line 323 of file grepper.c.

References go(), inf, and mk_MatchContext().

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

◆ mask_shift()

static void mask_shift ( MatchContext mc,
MatchWord Rdst,
MatchWord Rsrc,
struct DFA dfa,
int  ch 
)
static

◆ mk_MatchContext()

static MatchContext* mk_MatchContext ( struct DFA dfa,
int  range 
)
static

◆ or()

static void or ( MatchContext mc,
MatchWord Rdst,
MatchWord Rsrc1,
MatchWord Rsrc2 
)
static

Definition at line 218 of file grepper.c.

References MatchContext::n.

Referenced by go().

◆ reset_bit()

static INLINE void reset_bit ( MatchContext mc,
MatchWord m,
int  ch,
int  state 
)
static

Definition at line 59 of file grepper.c.

References MatchContext::n, and WORD_BITS.

Referenced by go().

◆ set_bit()

static INLINE void set_bit ( MatchContext mc,
MatchWord m,
int  ch,
int  state 
)
static

Definition at line 51 of file grepper.c.

References MatchContext::n, and WORD_BITS.

Referenced by go(), mask_shift(), mk_MatchContext(), and shift().

◆ shift()

static void shift ( MatchContext mc,
MatchWord Rdst,
MatchWord Rsrc,
struct DFA dfa 
)
static

Variable Documentation

◆ prog

char* prog

Definition at line 35 of file grepper.c.

Referenced by main().

◆ show_line

int show_line = 0
static

Definition at line 36 of file grepper.c.

Referenced by go(), and main().