/* Copyright (C) 2003, 2004 Dave Bayer. Subject to the terms and conditions of the MIT License. */ /*. NCHARS */ #define NCHARS 256 /*. filterRules */ typedef struct filterRules { char *fromStr, *toStr; unsigned fromState, toState, mark; unsigned fromLen, toLen; struct filterRules *next; } filterRules; /*. filterMark */ typedef struct filterMark { unsigned mark, index; struct filterMark *next; } filterMark; /*. filterTable */ typedef filterRules *filterTable[NCHARS]; /*. filterState */ typedef struct filterState { filterTable *table; unsigned state; unsigned (*filt)( char **ps, char **pt, unsigned state ); } filterState; /* function prototypes */ void markFree( void *data ); void initFilterTable( filterTable *table, filterRules *rules, unsigned nstates, BOOL clear ); void stateFilter( line *buf1, line *buf2, void *data ); #ifdef TESTCODE void filterTest( void ); #endif