| regex.h | | regex.h | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| | | | |
| #ifndef HAVE_REG_ERRCODE_T | | #ifndef HAVE_REG_ERRCODE_T | |
| typedef int reg_errcode_t; | | typedef int reg_errcode_t; | |
| #endif /* !HAVE_REG_ERRCODE_T */ | | #endif /* !HAVE_REG_ERRCODE_T */ | |
| | | | |
| #if !defined(REG_NOSPEC) && !defined(REG_LITERAL) | | #if !defined(REG_NOSPEC) && !defined(REG_LITERAL) | |
| #define REG_LITERAL 0x1000 | | #define REG_LITERAL 0x1000 | |
| #endif | | #endif | |
| | | | |
| /* Extra regcomp() flags. */ | | /* Extra regcomp() flags. */ | |
|
| | | #ifndef REG_BASIC | |
| #define REG_BASIC 0 | | #define REG_BASIC 0 | |
|
| | | #endif /* !REG_BASIC */ | |
| #define REG_RIGHT_ASSOC (REG_LITERAL << 1) | | #define REG_RIGHT_ASSOC (REG_LITERAL << 1) | |
| #define REG_UNGREEDY (REG_RIGHT_ASSOC << 1) | | #define REG_UNGREEDY (REG_RIGHT_ASSOC << 1) | |
| | | | |
| /* Extra regexec() flags. */ | | /* Extra regexec() flags. */ | |
| #define REG_APPROX_MATCHER 0x1000 | | #define REG_APPROX_MATCHER 0x1000 | |
| #define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1) | | #define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1) | |
| | | | |
| #else /* !TRE_USE_SYSTEM_REGEX_H */ | | #else /* !TRE_USE_SYSTEM_REGEX_H */ | |
| | | | |
| /* If the we're not using system regex.h, we need to define the | | /* If the we're not using system regex.h, we need to define the | |
| | | | |
| skipping to change at line 126 | | skipping to change at line 128 | |
| #define REG_NOTBOL 1 | | #define REG_NOTBOL 1 | |
| #define REG_NOTEOL (REG_NOTBOL << 1) | | #define REG_NOTEOL (REG_NOTBOL << 1) | |
| | | | |
| /* Extra regexec() flags. */ | | /* Extra regexec() flags. */ | |
| #define REG_APPROX_MATCHER (REG_NOTEOL << 1) | | #define REG_APPROX_MATCHER (REG_NOTEOL << 1) | |
| #define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1) | | #define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1) | |
| | | | |
| #endif /* !TRE_USE_SYSTEM_REGEX_H */ | | #endif /* !TRE_USE_SYSTEM_REGEX_H */ | |
| | | | |
| /* REG_NOSPEC and REG_LITERAL mean the same thing. */ | | /* REG_NOSPEC and REG_LITERAL mean the same thing. */ | |
|
| #ifdef REG_LITERAL | | #if defined(REG_LITERAL) && !defined(REG_NOSPEC) | |
| #define REG_NOSPEC REG_LITERAL | | #define REG_NOSPEC REG_LITERAL | |
|
| #elif defined(REG_NOSPEC) | | #elif defined(REG_NOSPEC) && !defined(REG_LITERAL) | |
| #define REG_LITERAL REG_NOSPEC | | #define REG_LITERAL REG_NOSPEC | |
| #endif /* defined(REG_NOSPEC) */ | | #endif /* defined(REG_NOSPEC) */ | |
| | | | |
| /* The maximum number of iterations in a bound expression. */ | | /* The maximum number of iterations in a bound expression. */ | |
| #undef RE_DUP_MAX | | #undef RE_DUP_MAX | |
| #define RE_DUP_MAX 255 | | #define RE_DUP_MAX 255 | |
| | | | |
| /* The POSIX.2 regexp functions */ | | /* The POSIX.2 regexp functions */ | |
|
| int regcomp(regex_t *preg, const char *regex, int cflags); | | extern int | |
| int regexec(const regex_t *preg, const char *string, size_t nmatch, | | regcomp(regex_t *preg, const char *regex, int cflags); | |
| regmatch_t pmatch[], int eflags); | | | |
| size_t regerror(int errcode, const regex_t *preg, char *errbuf, | | extern int | |
| size_t errbuf_size); | | regexec(const regex_t *preg, const char *string, size_t nmatch, | |
| void regfree(regex_t *preg); | | regmatch_t pmatch[], int eflags); | |
| | | | |
| | | extern size_t | |
| | | regerror(int errcode, const regex_t *preg, char *errbuf, | |
| | | size_t errbuf_size); | |
| | | | |
| | | extern void | |
| | | regfree(regex_t *preg); | |
| | | | |
| #ifdef TRE_WCHAR | | #ifdef TRE_WCHAR | |
| #ifdef HAVE_WCHAR_H | | #ifdef HAVE_WCHAR_H | |
| #include <wchar.h> | | #include <wchar.h> | |
| #endif /* HAVE_WCHAR_H */ | | #endif /* HAVE_WCHAR_H */ | |
| | | | |
| /* Wide character versions (not in POSIX.2). */ | | /* Wide character versions (not in POSIX.2). */ | |
|
| int regwcomp(regex_t *preg, const wchar_t *regex, int cflags); | | extern int | |
| int regwexec(const regex_t *preg, const wchar_t *string, size_t nmatch, | | regwcomp(regex_t *preg, const wchar_t *regex, int cflags); | |
| regmatch_t pmatch[], int eflags); | | | |
| | | extern int | |
| | | regwexec(const regex_t *preg, const wchar_t *string, | |
| | | size_t nmatch, regmatch_t pmatch[], int eflags); | |
| #endif /* TRE_WCHAR */ | | #endif /* TRE_WCHAR */ | |
| | | | |
| /* Versions with a maximum length argument and therefore the capability to | | /* Versions with a maximum length argument and therefore the capability to | |
| handle null characters in the middle of the strings (not in POSIX.2). */ | | handle null characters in the middle of the strings (not in POSIX.2). */ | |
|
| int regncomp(regex_t *preg, const char *regex, size_t len, int cflags); | | extern int | |
| int regnexec(const regex_t *preg, const char *string, size_t len, | | regncomp(regex_t *preg, const char *regex, size_t len, int cflags); | |
| size_t nmatch, regmatch_t pmatch[], int eflags); | | | |
| | | extern int | |
| | | regnexec(const regex_t *preg, const char *string, size_t len, | |
| | | size_t nmatch, regmatch_t pmatch[], int eflags); | |
| | | | |
| #ifdef TRE_WCHAR | | #ifdef TRE_WCHAR | |
|
| int regwncomp(regex_t *preg, const wchar_t *regex, size_t len, int cflags); | | extern int | |
| int regwnexec(const regex_t *preg, const wchar_t *string, size_t len, | | regwncomp(regex_t *preg, const wchar_t *regex, size_t len, int cflags); | |
| size_t nmatch, regmatch_t pmatch[], int eflags); | | | |
| | | extern int | |
| | | regwnexec(const regex_t *preg, const wchar_t *string, size_t len, | |
| | | size_t nmatch, regmatch_t pmatch[], int eflags); | |
| #endif /* TRE_WCHAR */ | | #endif /* TRE_WCHAR */ | |
| | | | |
| #ifdef TRE_APPROX | | #ifdef TRE_APPROX | |
| | | | |
| /* Approximate matching parameter struct. */ | | /* Approximate matching parameter struct. */ | |
| typedef struct { | | typedef struct { | |
| int cost_ins; /* Default cost of an inserted character. */ | | int cost_ins; /* Default cost of an inserted character. */ | |
| int cost_del; /* Default cost of a deleted character. */ | | int cost_del; /* Default cost of a deleted character. */ | |
| int cost_subst; /* Default cost of a substituted character. */ | | int cost_subst; /* Default cost of a substituted character. */ | |
| int max_cost; /* Maximum allowed cost of a match. */ | | int max_cost; /* Maximum allowed cost of a match. */ | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 211 | |
| typedef struct { | | typedef struct { | |
| size_t nmatch; /* Length of pmatch[] array. */ | | size_t nmatch; /* Length of pmatch[] array. */ | |
| regmatch_t *pmatch; /* Submatch data. */ | | regmatch_t *pmatch; /* Submatch data. */ | |
| int cost; /* Cost of the match. */ | | int cost; /* Cost of the match. */ | |
| int num_ins; /* Number of inserts in the match. */ | | int num_ins; /* Number of inserts in the match. */ | |
| int num_del; /* Number of deletes in the match. */ | | int num_del; /* Number of deletes in the match. */ | |
| int num_subst; /* Number of substitutes in the match. */ | | int num_subst; /* Number of substitutes in the match. */ | |
| } regamatch_t; | | } regamatch_t; | |
| | | | |
| /* Approximate matching functions. */ | | /* Approximate matching functions. */ | |
|
| int regaexec(const regex_t *preg, const char *string, | | extern int | |
| regamatch_t *match, regaparams_t params, int eflags); | | regaexec(const regex_t *preg, const char *string, | |
| int reganexec(const regex_t *preg, const char *string, size_t len, | | regamatch_t *match, regaparams_t params, int eflags); | |
| regamatch_t *match, regaparams_t params, int eflags); | | | |
| | | extern int | |
| | | reganexec(const regex_t *preg, const char *string, size_t len, | |
| | | regamatch_t *match, regaparams_t params, int eflags); | |
| #ifdef TRE_WCHAR | | #ifdef TRE_WCHAR | |
| /* Wide character approximate matching. */ | | /* Wide character approximate matching. */ | |
|
| int regawexec(const regex_t *preg, const wchar_t *string, | | extern int | |
| regamatch_t *match, regaparams_t params, int eflags); | | regawexec(const regex_t *preg, const wchar_t *string, | |
| int regawnexec(const regex_t *preg, const wchar_t *string, size_t len, | | regamatch_t *match, regaparams_t params, int eflags); | |
| regamatch_t *match, regaparams_t params, int eflags); | | | |
| | | extern int | |
| | | regawnexec(const regex_t *preg, const wchar_t *string, size_t len, | |
| | | regamatch_t *match, regaparams_t params, int eflags); | |
| #endif /* TRE_WCHAR */ | | #endif /* TRE_WCHAR */ | |
| | | | |
| /* Sets the parameters to default values. */ | | /* Sets the parameters to default values. */ | |
|
| void regaparams_default(regaparams_t *params); | | extern void | |
| | | regaparams_default(regaparams_t *params); | |
| #endif /* TRE_APPROX */ | | #endif /* TRE_APPROX */ | |
| | | | |
| #ifdef TRE_WCHAR | | #ifdef TRE_WCHAR | |
| typedef wchar_t tre_char_t; | | typedef wchar_t tre_char_t; | |
| #else /* !TRE_WCHAR */ | | #else /* !TRE_WCHAR */ | |
| typedef unsigned char tre_char_t; | | typedef unsigned char tre_char_t; | |
| #endif /* !TRE_WCHAR */ | | #endif /* !TRE_WCHAR */ | |
| | | | |
| typedef struct { | | typedef struct { | |
| int (*get_next_char)(tre_char_t *c, unsigned int *pos_add, void *context)
; | | int (*get_next_char)(tre_char_t *c, unsigned int *pos_add, void *context)
; | |
| void (*rewind)(size_t pos, void *context); | | void (*rewind)(size_t pos, void *context); | |
| int (*compare)(size_t pos1, size_t pos2, size_t len, void *context); | | int (*compare)(size_t pos1, size_t pos2, size_t len, void *context); | |
| void *context; | | void *context; | |
| } tre_str_source; | | } tre_str_source; | |
| | | | |
|
| int reguexec(const regex_t *preg, const tre_str_source *string, | | extern int | |
| size_t nmatch, regmatch_t pmatch[], int eflags); | | reguexec(const regex_t *preg, const tre_str_source *string, | |
| | | size_t nmatch, regmatch_t pmatch[], int eflags); | |
| | | | |
| /* Returns the version string. The returned string is static. */ | | /* Returns the version string. The returned string is static. */ | |
|
| char *tre_version(void); | | extern char * | |
| | | tre_version(void); | |
| | | | |
| /* Returns the value for a config parameter. The type to which `result' | | /* Returns the value for a config parameter. The type to which `result' | |
| must point to depends of the value of `query', see documentation for | | must point to depends of the value of `query', see documentation for | |
| more details. */ | | more details. */ | |
|
| int tre_config(int query, void *result); | | extern int | |
| | | tre_config(int query, void *result); | |
| | | | |
| enum { | | enum { | |
| TRE_CONFIG_APPROX, | | TRE_CONFIG_APPROX, | |
| TRE_CONFIG_WCHAR, | | TRE_CONFIG_WCHAR, | |
| TRE_CONFIG_MULTIBYTE, | | TRE_CONFIG_MULTIBYTE, | |
| TRE_CONFIG_SYSTEM_ABI, | | TRE_CONFIG_SYSTEM_ABI, | |
| TRE_CONFIG_VERSION | | TRE_CONFIG_VERSION | |
| }; | | }; | |
| | | | |
| /* Returns 1 if the compiled pattern has back references, 0 if not. */ | | /* Returns 1 if the compiled pattern has back references, 0 if not. */ | |
|
| int tre_have_backrefs(const regex_t *preg); | | extern int | |
| | | tre_have_backrefs(const regex_t *preg); | |
| | | | |
| /* Returns 1 if the compiled pattern uses approximate matching features, | | /* Returns 1 if the compiled pattern uses approximate matching features, | |
| 0 if not. */ | | 0 if not. */ | |
|
| int tre_have_approx(const regex_t *preg); | | extern int | |
| | | tre_have_approx(const regex_t *preg); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| #endif /* TRE_REGEX_H */ | | #endif /* TRE_REGEX_H */ | |
| | | | |
| /* EOF */ | | /* EOF */ | |
| | | | |
End of changes. 16 change blocks. |
| 32 lines changed or deleted | | 63 lines changed or added | |
|