#include #include #include #define MAXSYM 128 // size of the alphabet. E.g.: 128 for ASCII code. #define WORD 32 // word size in bits (32 in our case). #define B 1 // B: number of bits per individual state /* Search pat[1..m] in text[1..n] */ int SOsearch(char *text, int n, char *pat, int m ) { register char *end; register unsigned int state, lim; unsigned int T[MAXSYM], i, j; char *start; if( m > WORD ) { printf( "Use pat size <= word size\n" ); return(-1); } for( i=0; i>B); text++; end = text+n+1; /* Search */ state = ~0; /* Initial state */ for( start=text; text < end; text++ ) { state = (state <