IDZEBRA  2.1.2
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

#define INFBUF_SIZE   16384

Definition at line 47 of file grepper.c.

Referenced by go().

#define INLINE

Definition at line 49 of file grepper.c.

#define WORD_BITS   32

Definition at line 39 of file grepper.c.

Referenced by get_bit(), mask_shift(), mk_MatchContext(), reset_bit(), set_bit(), and shift().

Typedef Documentation

typedef unsigned MatchWord

Definition at line 38 of file grepper.c.

Function Documentation

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

static int go ( MatchContext mc,
struct DFA dfa,
FILE *  inf 
)
static
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().

int main ( int  argc,
char **  argv 
)
static void mask_shift ( MatchContext mc,
MatchWord Rdst,
MatchWord Rsrc,
struct DFA dfa,
int  ch 
)
static
static MatchContext* mk_MatchContext ( struct DFA dfa,
int  range 
)
static
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().

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

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

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

Variable Documentation

char* prog

Definition at line 35 of file grepper.c.

Referenced by main().

int show_line = 0
static

Definition at line 36 of file grepper.c.

Referenced by go(), and main().