/* * * sregexpbase.h -- C include file for sregexp.library * * Copyright (C) 1991, Jon Spencer. * * Created: April 20,1991 * */ #ifndef LIBRARIES_SREGEXPBASE_H #define LIBRARIES_SREGEXPBASE_H #ifndef EXEC_TYPE_H #include #endif #ifndef EXEC_LISTS_H #include #endif #ifndef EXEC_LIBRARIES_H #include #endif #ifndef LIBRARIES_DOS_H #include #endif /* * * Library base structure, all of these fields are private, and * should not be accessed. * */ struct SregExpBase { struct Library LibNode; struct Library *SysBase; struct Library *DOSBase; BPTR Segment; }; #define SREGEXPNAME "sregexp.library" /* * * Here are the defines for the structures used and returned by * the various sreg functions. They should probably not be * accessed for there contents, unless you have really good * reason... * */ struct SregExp { char sre_Type,sre_Flag; SHORT sre_MinLen; union { char onechar; char *setchar; char *string; LONG number; } sre_Data; struct SregExp * sre_List[]; }; /* This is an internal structure for a singly linked list of sregexp's */ struct SregList { struct SregExp *srl_sreg; struct SregList *srl_next; }; /* various types of wildcard pattern elements. Goes in struct SregExp.type field */ #define SRP_SETCHAR 1 #define SRP_ANYCHAR 2 #define SRP_ONECHAR 3 #define SRP_STRING 4 #define SRP_NULL 5 #define SRP_OR 6 #define SRP_SUM 7 /* various flags to mark special properties of patterns. Goes in struct SregExp.flag */ #define SRF_NOT (1<<0) #define SRF_REPEAT (1<<1) #define SRF_FIXLEN (1<<2) #define SRF_JUSTDIRS (1<<6) /* special flag used in path matching */ #define SRF_RECURSE (1<<7) /* dito. */ /* defines for the wildcard characters */ #define CHR_REPEAT '#' #define CHR_NOT '~' #define CHR_OPENBRACE '(' #define CHR_CLOSEBRACE ')' #define CHR_OPENSET '[' #define CHR_CLOSESET ']' #define CHR_ANYCHAR '?' #define CHR_NULL '%' #define CHR_OR '|' #define CHR_ESCAPE '\'' #define CHR_RANGE '-' #define CHR_STAR '*' /* These are the structures used for the path matching routines. */ struct SpathInfo { struct SpathNode * spi_Head; struct SpathNode * spi_Tail; struct SpathNode * spi_TailPred; struct SregList * spi_SregList; }; /* Note: because of the fileinfoblock, this whole structure MUST be longword aligned. */ struct SpathNode { struct SpathNode * spn_Succ; struct SpathNode * spn_Pred; struct FileInfoBlock spn_FIB; BPTR spn_Lock; struct SregList * spn_SregList; char * spn_NodeName; short int spn_Flags; }; /* flags used in spn_Flags, which is really library private */ #define SPF_DECEND (1<<0) /* Should recursively search, when we get the chance. */ #define SPF_DONEONCE (1<<1) /* Already done it, don't do again */ #define SPF_NEXTPARENT (1<<2) /* Next one is lock on parentdir */ /* These are the possible error returns sent by NextFile and BuildPath */ #define SPE_ALL_DONE -1 /* no more matching files */ #define SPE_ERROR -2 /* some error occured, see IoErr() */ #define SPE_BUFF_FULL -3 /* you didn't give me enough room! */ #define SPE_SIGBREAK -4 /* A control signal came through. */ /* Some defines for what kind of events we match to. */ #define SP_DIRS_ONLY 1 #define SP_BOTH 0 #define SP_FILES_ONLY -1 #endif