IDZEBRA 2.2.11
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 MatchContext * mk_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.

Referenced by go().

◆ INLINE

#define INLINE

Definition at line 49 of file grepper.c.

Referenced by get_bit(), get_bit(), move(), reset_bit(), set_bit(), and set_bit().

◆ WORD_BITS

#define WORD_BITS   32

Typedef Documentation

◆ MatchWord

typedef unsigned MatchWord

Definition at line 38 of file grepper.c.

Function Documentation

◆ get_bit()

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

Definition at line 68 of file grepper.c.

References INLINE, MatchContext::n, and WORD_BITS.

Referenced by go().

◆ go()

◆ grep_file()

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

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

◆ mk_MatchContext()

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

◆ or()

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

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

Definition at line 59 of file grepper.c.

References INLINE, MatchContext::n, and WORD_BITS.

Referenced by go().

◆ set_bit()

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

Definition at line 51 of file grepper.c.

References INLINE, MatchContext::n, and WORD_BITS.

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

◆ shift()

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.

◆ show_line

int show_line = 0
static

Definition at line 36 of file grepper.c.

Referenced by go(), and main().