home *** CD-ROM | disk | FTP | other *** search
- // Oolite Regular Expression Definitions
-
- #ifndef _REGEXP
- #define _REGEXP 1
-
- #define DllExport __declspec( dllexport )
- typedef long HRESULT;
-
-
- #define NSUBEXP 50
- typedef struct oolregexp {
- char *startp[NSUBEXP];
- char *endp[NSUBEXP];
- char regstart; /* Internal use only. */
- char reganch; /* Internal use only. */
- char *regmust; /* Internal use only. */
- int regmlen; /* Internal use only. */
- char program[1]; /* Unwarranted chumminess with compiler. */
- } oolregexp;
-
- //#define E_UNEXPECTED 0x8000FFFF
- //#define E_OUTOFMEMORY 0x8007000E
- //#define E_INVALIDARG 0x80070057
- //#define S_OK 0
- #define S_FAIL 1
- #define E_REGEXPNOEXP 0x80006001L // The Regular Expression string was NULL
- #define E_REGEXPTOOBIG 0x80006002L // The Regular Expression was too big
- #define E_REGEXPTOOMANYPAREN 0x80006003L // Too many ()'s
- #define E_REGEXPUNMATCHPAREN 0x80006004L // Unmatched ()'s
- #define E_REGEXPSTARPLUSEMPT 0x80006005L // *+ operand could be empty
- #define E_REGEXPNESTED 0x80006006L // nested *?+
- #define E_REGEXPINVALIDBRKRANGE 0x80006007L // invalid [] range
- #define E_REGEXPUNMATCHBRACKET 0x80006008L // unmatched []
- #define E_REGEXPOPFOLLOWSNOTHING 0x80006009L // ?+* follows nothing
- #define E_REGEXPTRAILINGSLASHS 0x8000600AL // trailing backslashes
-
- // Three different C++ API's
-
- // High Level API - calls cached low level API
- extern DllExport HRESULT OolRegExpr(const char* string, const char* pattern, ...);
- extern DllExport HRESULT OolRegIndx(const char* string, const char* pattern, int subRanges[NSUBEXP][2], int numargs, int noCase);
-
- // Low Level API
- extern DllExport HRESULT OolRegCompCache(char *exp, oolregexp* &ret);
- extern DllExport HRESULT OolRegComp(char *exp, oolregexp* &ret);
- extern DllExport HRESULT OolRegExec(oolregexp *prog, char *string, char *start);
- extern DllExport HRESULT OolRegSub(oolregexp *prog, char *source, char *dest);
- extern DllExport HRESULT OolRegRange(oolregexp* re, int index, char **startPtr, char **endPtr);
-
- // internal
- extern void OolSetRegError (HRESULT);
- extern HRESULT OolGetRegError (void);
-
- #endif /* REGEXP */
-