Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

acsmx.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "acsmx.h"

Go to the source code of this file.

Defines

#define MEMASSERT(p, s)   if(!p){fprintf(stderr,"ACSM-No Memory: %s!\n",s);exit(0);}

Typedefs

typedef _queue QUEUE

Functions

static void queue_init (QUEUE *s)
static void queue_add (QUEUE *s, int state)
static int queue_remove (QUEUE *s)
static int queue_count (QUEUE *s)
static void queue_free (QUEUE *s)
static void init_xlatcase ()
static void ConvertCase (unsigned char *s, int m)
static void ConvertCaseEx (unsigned char *d, unsigned char *s, int m)
static ACSM_PATTERNCopyMatchListEntry (ACSM_PATTERN *px)
static void AddMatchListEntry (ACSM_STRUCT *acsm, int state, ACSM_PATTERN *px)
static void AddPatternStates (ACSM_STRUCT *acsm, ACSM_PATTERN *p)
static void Build_NFA (ACSM_STRUCT *acsm)
static void Convert_NFA_To_DFA (ACSM_STRUCT *acsm)
ACSM_STRUCTacsmNew ()
int acsmAddPattern (ACSM_STRUCT *p, unsigned char *pat, int n, int nocase, int offset, int depth, void *id, int iid)
int acsmCompile (ACSM_STRUCT *acsm)
int acsmSearch (ACSM_STRUCT *acsm, unsigned char *Tx, int n, int(*Match)(void *id, int index, void *data), void *data)
void acsmFree (ACSM_STRUCT *acsm)
int acsmPrintDetailInfo (ACSM_STRUCT *p)
int acsmPrintSummaryInfo (ACSM_STRUCT *acsm)

Variables

static unsigned char xlatcase [256]
static unsigned char Tc [64 *1024]


Define Documentation

#define MEMASSERT p,
 )     if(!p){fprintf(stderr,"ACSM-No Memory: %s!\n",s);exit(0);}
 

Definition at line 64 of file acsmx.c.


Typedef Documentation

typedef struct _queue QUEUE
 


Function Documentation

int acsmAddPattern ACSM_STRUCT p,
unsigned char *  pat,
int  n,
int  nocase,
int  offset,
int  depth,
void *  id,
int  iid
 

Definition at line 470 of file acsmx.c.

References ACSM_STRUCT::acsmPatterns, _acsm_pattern::casepatrn, ConvertCaseEx(), _acsm_pattern::depth, _acsm_pattern::id, _acsm_pattern::iid, MEMASSERT, memcpy, _acsm_pattern::n, _acsm_pattern::next, _acsm_pattern::nocase, _acsm_pattern::offset, and _acsm_pattern::patrn.

Referenced by mpseAddPattern().

int acsmCompile ACSM_STRUCT acsm  ) 
 

Definition at line 496 of file acsmx.c.

References ACSM_FAIL_STATE, ACSM_STRUCT::acsmMaxStates, ACSM_STRUCT::acsmNumStates, ACSM_STRUCT::acsmPatterns, ACSM_STRUCT::acsmStateTable, AddPatternStates(), ALPHABET_SIZE, Build_NFA(), Convert_NFA_To_DFA(), MEMASSERT, memset, _acsm_pattern::n, _acsm_pattern::next, ACSM_STATETABLE::NextState, and NULL.

Referenced by mpsePrepPatterns().

void acsmFree ACSM_STRUCT acsm  ) 
 

Definition at line 617 of file acsmx.c.

References _acsm_pattern::next, and NULL.

Referenced by mpseFree().

ACSM_STRUCT* acsmNew  ) 
 

Definition at line 454 of file acsmx.c.

References init_xlatcase(), MEMASSERT, and memset.

Referenced by mpseNew().

int acsmPrintDetailInfo ACSM_STRUCT p  ) 
 

Definition at line 671 of file acsmx.c.

Referenced by mpsePrintDetail().

int acsmPrintSummaryInfo ACSM_STRUCT acsm  ) 
 

Definition at line 676 of file acsmx.c.

References acsm_summary_s::acsm, ACSM_STRUCT2::acsmAlphabetSize, ACSM_STRUCT2::acsmFormat, ACSM_STRUCT2::acsmFSA, max_memory, acsm_summary_s::num_states, acsm_summary_s::num_transitions, and summary.

Referenced by mpsePrintSummary().

int acsmSearch ACSM_STRUCT acsm,
unsigned char *  Tx,
int  n,
int(*)(void *id, int index, void *data)  Match,
void *  data
 

Definition at line 565 of file acsmx.c.

References ACSM_STRUCT::acsmStateTable, _acsm_pattern::casepatrn, ConvertCaseEx(), _acsm_pattern::id, ACSM_STATETABLE::MatchList, memcmp(), _acsm_pattern::n, _acsm_pattern::next, ACSM_STATETABLE::NextState, _acsm_pattern::nocase, and NULL.

Referenced by mpseSearch().

static void AddMatchListEntry ACSM_STRUCT acsm,
int  state,
ACSM_PATTERN px
[static]
 

Definition at line 272 of file acsmx.c.

References ACSM_STRUCT::acsmStateTable, ACSM_STATETABLE::MatchList, MEMASSERT, memcpy, and _acsm_pattern::next.

Referenced by AddPatternStates().

static void AddPatternStates ACSM_STRUCT acsm,
ACSM_PATTERN p
[static]
 

Definition at line 287 of file acsmx.c.

References ACSM_FAIL_STATE, ACSM_STRUCT::acsmNumStates, ACSM_STRUCT::acsmStateTable, AddMatchListEntry(), _acsm_pattern::n, ACSM_STATETABLE::NextState, and _acsm_pattern::patrn.

Referenced by acsmCompile(), and acsmCompile2().

static void Build_NFA ACSM_STRUCT acsm  )  [static]
 

Definition at line 323 of file acsmx.c.

References ACSM_FAIL_STATE, ACSM_STRUCT::acsmStateTable, ALPHABET_SIZE, CopyMatchListEntry(), ACSM_STATETABLE::FailState, ACSM_STATETABLE::MatchList, _acsm_pattern::next, ACSM_STATETABLE::NextState, NULL, queue_add(), queue_count(), queue_free(), queue_init(), and queue_remove().

Referenced by acsmCompile(), and acsmCompile2().

static void Convert_NFA_To_DFA ACSM_STRUCT acsm  )  [static]
 

Definition at line 406 of file acsmx.c.

References ACSM_FAIL_STATE, ACSM_STRUCT::acsmStateTable, ALPHABET_SIZE, ACSM_STATETABLE::FailState, ACSM_STATETABLE::NextState, queue_add(), queue_count(), queue_free(), queue_init(), and queue_remove().

Referenced by acsmCompile(), and acsmCompile2().

static void ConvertCase unsigned char *  s,
int  m
[inline, static]
 

Definition at line 228 of file acsmx.c.

static void ConvertCaseEx unsigned char *  d,
unsigned char *  s,
int  m
[inline, static]
 

Definition at line 242 of file acsmx.c.

Referenced by acsmAddPattern(), acsmAddPattern2(), acsmSearch(), KTrieNewPattern(), KTrieSearchBC(), and KTrieSearchNoBC().

static ACSM_PATTERN* CopyMatchListEntry ACSM_PATTERN px  )  [static]
 

Definition at line 256 of file acsmx.c.

References MEMASSERT, memcpy, and _acsm_pattern::next.

Referenced by Build_NFA().

static void init_xlatcase  )  [static]
 

Definition at line 214 of file acsmx.c.

Referenced by acsmNew(), acsmNew2(), KTrieNew(), and mwmNew().

static void queue_add QUEUE s,
int  state
[static]
 

Definition at line 134 of file acsmx.c.

References _queue::count, _queue::head, MEMASSERT, and _queue::tail.

Referenced by Build_NFA(), and Convert_NFA_To_DFA().

static int queue_count QUEUE s  )  [static]
 

Definition at line 186 of file acsmx.c.

References _queue::count.

Referenced by Build_NFA(), Convert_NFA_To_DFA(), and queue_free().

static void queue_free QUEUE s  )  [static]
 

Definition at line 196 of file acsmx.c.

References queue_count(), and queue_remove().

Referenced by Build_NFA(), and Convert_NFA_To_DFA().

static void queue_init QUEUE s  )  [static]
 

Definition at line 123 of file acsmx.c.

References _queue::count, _queue::head, and _queue::tail.

Referenced by Build_NFA(), and Convert_NFA_To_DFA().

static int queue_remove QUEUE s  )  [static]
 

Definition at line 161 of file acsmx.c.

References _queue::count, _queue::head, and _queue::tail.

Referenced by Build_NFA(), Convert_NFA_To_DFA(), and queue_free().


Variable Documentation

unsigned char Tc[64 *1024] [static]
 

Definition at line 559 of file acsmx.c.

Referenced by acsmSearchSparseDFA(), and acsmSearchSparseNFA().

unsigned char xlatcase[256] [static]
 

Definition at line 208 of file acsmx.c.

Referenced by acsmSearchSparseDFA(), acsmSearchSparseDFA_Banded(), acsmSearchSparseDFA_Full(), acsmSearchSparseNFA(), ConvCaseToUpper(), ConvCaseToUpperEx(), ConvertCaseEx(), and init_xlatcase().


Generated on Sun May 14 14:51:26 2006 by  doxygen 1.4.2