123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- #ifndef SLRE_HEADER_DEFINED
- #define SLRE_HEADER_DEFINED
- enum slre_option {
- SLRE_CASE_INSENSITIVE = 1, SLRE_NO_CAPTURE = 2
- };
- enum slre_capture {
- SLRE_STRING, SLRE_INT, SLRE_FLOAT, SLRE_CALLBACK, SLRE_CAPTURED, SLRE_IGNORE
- };
- struct slre_captured {
- const char *ptr;
- int len;
- };
- enum slre_result {
- SLRE_OK = 0,
- SLRE_ERROR_NO_MATCH = 1,
- SLRE_ERROR_JUMP_OFFSET = 2,
- SLRE_ERROR_CODE_TOO_LONG = 3,
- SLRE_ERROR_DATA_TOO_LONG = 4,
- SLRE_ERROR_NO_PAREN = 5,
- SLRE_ERROR_BAD_PAREN = 6,
- SLRE_ERROR_NO_BRACKET = 7,
- SLRE_ERROR_TOO_MANY_PAREN = 8,
- SLRE_ERROR_INT_FAILED = 9,
- SLRE_ERROR_INT_SIZE = 10,
- SLRE_ERROR_FLOAT_SIZE = 11,
- SLRE_ERROR_FLOAT_FAILED = 12,
- SLRE_ERROR_STRING_SIZE = 13,
- SLRE_ERROR_UNKNOWN_TYPE = 14,
- SLRE_ERROR_TEXT_TOO_LONG = 15,
- SLRE_ERROR_NULL_CAPTURED = 16,
- SLRE_ERROR_LAST = 225,
- };
- #ifndef SLRE_CAPURES_MAX
- #define SLRE_CAPURES_MAX 64
- #endif
- typedef int slre_callback(int index, const char * capture, int size, void * data);
- int slre_match(enum slre_option options, const char *regexp,
- const char *buf, int buf_len, ...);
- const char * slre_error(int code);
- #endif
|