regex.h | regex.h | |||
---|---|---|---|---|
/* | /* | |||
regex.h - POSIX.2 compatible regexp interface | regex.h - POSIX.2 compatible regexp interface | |||
Copyright (C) 2001, 2002 Ville Laurikari <vl@iki.fi>. | Copyright (C) 2001-2003 Ville Laurikari <vl@iki.fi>. | |||
This program is free software; you can redistribute it and/or modify | This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License version 2 (June | it under the terms of the GNU General Public License version 2 (June | |||
1991) as published by the Free Software Foundation. | 1991) as published by the Free Software Foundation. | |||
This program is distributed in the hope that it will be useful, | This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | GNU General Public License for more details. | |||
skipping to change at line 72 | skipping to change at line 72 | |||
int regncomp(regex_t *preg, const char *regex, size_t len, int cflags); | int regncomp(regex_t *preg, const char *regex, size_t len, int cflags); | |||
int regnexec(const regex_t *preg, const char *string, size_t len, | int regnexec(const regex_t *preg, const char *string, size_t len, | |||
size_t nmatch, regmatch_t pmatch[], int eflags); | 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); | int regwncomp(regex_t *preg, const wchar_t *regex, size_t len, int cflags); | |||
int regwnexec(const regex_t *preg, const wchar_t *string, size_t len, | int regwnexec(const regex_t *preg, const wchar_t *string, size_t len, | |||
size_t nmatch, regmatch_t pmatch[], int eflags); | size_t nmatch, regmatch_t pmatch[], int eflags); | |||
#endif /* TRE_WCHAR */ | #endif /* TRE_WCHAR */ | |||
#ifdef TRE_APPROX | #ifdef TRE_APPROX | |||
/* Approximate matching parameter struct. */ | ||||
typedef struct { | ||||
int cost_ins; /* Default cost of an inserted character. */ | ||||
int cost_del; /* Default cost of a deleted character. */ | ||||
int cost_subst; /* Default cost of a substituted character. */ | ||||
int max_cost; /* Maximum allowed cost of a match. */ | ||||
} regaparams_t; | ||||
/* Approximate matching result struct. */ | ||||
typedef struct { | ||||
size_t nmatch; /* Length of pmatch[] array. */ | ||||
regmatch_t *pmatch; /* Submatch data. */ | ||||
int cost; /* Cost of the match. */ | ||||
} regamatch_t; | ||||
/* Approximate matching functions. */ | /* Approximate matching functions. */ | |||
int regaexec(const regex_t *preg, const char *string, size_t nmatch, | int regaexec(const regex_t *preg, const char *string, | |||
regmatch_t pmatch[], int cost_ins, int cost_del, int cost_subst | regamatch_t *match, regaparams_t params, int eflags); | |||
, | int reganexec(const regex_t *preg, const char *string, size_t len, | |||
int max_cost, int eflags); | regamatch_t *match, regaparams_t params, int eflags); | |||
int reganexec(const regex_t *preg, const char *string, size_t len, size_t n | ||||
match, | ||||
regmatch_t pmatch[], int cost_ins, int cost_del, int cost_subs | ||||
t, | ||||
int max_cost, 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, size_t nmatch, | int regawexec(const regex_t *preg, const wchar_t *string, | |||
regmatch_t pmatch[], int cost_ins, int cost_del, int cost_sub | regamatch_t *match, regaparams_t params, int eflags); | |||
st, | ||||
int max_cost, int eflags); | ||||
int regawnexec(const regex_t *preg, const wchar_t *string, size_t len, | int regawnexec(const regex_t *preg, const wchar_t *string, size_t len, | |||
size_t nmatch, regmatch_t pmatch[], int cost_ins, int cost_de | regamatch_t *match, regaparams_t params, int eflags); | |||
l, | ||||
int cost_subst, int max_cost, int eflags); | ||||
#endif /* TRE_WCHAR */ | #endif /* TRE_WCHAR */ | |||
#endif /* TRE_APPROX */ | #endif /* TRE_APPROX */ | |||
typedef enum { | typedef enum { | |||
REG_OK = 0, /* No error. */ | REG_OK = 0, /* No error. */ | |||
/* POSIX regcomp() return error codes. (In the order listed in the | /* POSIX regcomp() return error codes. (In the order listed in the | |||
standard.) */ | standard.) */ | |||
REG_NOMATCH, /* No match. */ | REG_NOMATCH, /* No match. */ | |||
REG_BADPAT, /* Invalid regexp. */ | REG_BADPAT, /* Invalid regexp. */ | |||
REG_ECOLLATE, /* Unknown collating element. */ | REG_ECOLLATE, /* Unknown collating element. */ | |||
End of changes. 5 change blocks. | ||||
17 lines changed or deleted | 24 lines changed or added | |||