#ifdef DEBUG #define BUG(s) s #else #define BUG(s) #endif #include #include #include #include #include #include #include #define MAS 512 #define PAT 256 #define BUF 256 #define DP (uint)(sizeof(uint)*8) #define DEX (uint)((MAS+DP-1)/DP) #define strsize(S) (snprintf(NULL,0,"%s",S)) #define P(p) (pet[sdex(p)]) #define PT(p) (P(p).r) #define PC(p) (P(p).c) #define PB(p) (P(p).b[PC(p)]) #define PE(p) (P(p).e) #define Fin(b) (fread(b,sizeof(b[0]),sizeof(b),stdin)) typedef unsigned int uint; typedef unsigned char uchar; typedef unsigned long ulong; typedef struct { uchar r; /* 0 inactive 1,2,3 active PET states : 1 new search 2,3 continue search : 2 joined strings 3 begin long-search : 4 :2+ sdex() return next 5 :3+ sdex() return next 6 :3+ at end. (without pattern-matching) :1+ */ uchar c; /* 0,ff current position here */ uchar e; /* 0,ff end (char b[]) at character n... */ uchar b[PAT]; } Pet;