/* This is used for COMPILING sregexp.library, it should not be included if you just USE the library. See sregexpbase.h */ #include #include #include #include #include #include #include #include "sregexpbase.h" #define TRUE 1 #define FALSE 0 #define MEM_ERROR ERROR_NO_FREE_STORE /* report no mem */ #define ILLEGAL_ERR ERROR_INVALID_COMPONENT_NAME /* bad sregexp */ /* some handy fingersaving macros. */ #define realen(a) (((a)->sre_Flag&(SRF_REPEAT|SRF_NOT))?0:(a)->sre_MinLen) #define isfixed(s) (((s)->sre_Flag&(SRF_REPEAT|SRF_NOT|SRF_FIXLEN))==SRF_FIXLEN) #define matchset(s,c) ((s)->sre_Data.setchar[(c)/8] & 1 << (c)%8) #ifdef __MEMCHECK__ #define getmem(a) checkmem(a,__BASE_FILE__,__LINE__) #define freemem(p,s) freecheck(p,s,__BASE_FILE__,__LINE__) extern void *checkmem(int, char *, int); extern void freecheck(void *, int, char *, int); #else #define getmem(a) AllocMem(a,0) #define freemem(p,s) FreeMem(p,s) #endif static struct SregExp * parsesub(char **, char); static struct SregExp * makesum(struct SregList *, int); static struct SregExp * makeor(struct SregList *, int); static struct SregExp * parseone(char **, char); static char onechar(char **, char); static struct SregExp * makenull(void); static char * makeset(char **); static int matchsum(struct SregExp *[], int, char *, int, int); static void report(int); static struct SpathNode * makespathnode(BPTR, char *, struct SregList *); static void freespathnode(struct SpathNode *); static struct SregList * parsepath(char *); extern struct SregExp * parsesregexp(char *); extern void freesregexp(struct SregExp *); extern int matchsregexp(char *, struct SregExp *, int); extern int matchnsregexp(char *, struct SregExp *, int, int); extern int iswild(char *); extern struct SpathInfo * anchorpath(char *, char *); extern int nextfile(struct SpathInfo *, char *, int, int); extern int buildpath(struct SpathInfo *, char *, int); extern void freespathinfo(struct SpathInfo *);