/** */ /* file: regex.c */ /* date: 22-Jul-26 */ /* auth: bagel */ /* desc: This is an implementation of regular expressions (regex) based on */ /* tiny-regex-c [1]; which was inspired by an implementation found in */ /* the book 'Beautiful Code' [2]. Unlike tiny-regex-c, dynamic memory */ /* allocation is used to support compiling multiple regular expressions */ /* at once. */ /* **/ /*----------------------------------------------------------------------------*/ /* Function and Type Declarations */ /*----------------------------------------------------------------------------*/ typedef enum { } regex_type_t; typedef struct regex_t { regex_type_t type ; /* CHAR, STAR, etc. */ union { unsigned char ch ; /* the character itsself */ unsigned char *cl ; /* or a pointer to characters in class */ }; } regex_t; /*----------------------------------------------------------------------------*/ /* Function Defintions */ /*----------------------------------------------------------------------------*/ regex_t re_compile(const char *pattern) { static regex_t re_compiled[MAX_REGEXP_OBJECTS] ; static unsigned char ccl_buf[MAX_CHAR_CLASS_LEN] ; int ccl_bufidx; char c; int i, j; i = 0; j = 0; while ( pattern[i] && (j+1 < MAX_REGEXP_OBJECTS) ) { } } bool re_match(const char *pattern,