version 1.11 | | version 1.12 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: re-cmp.c,v 1.11 2005/01/12 08:03:59 mwedel Exp $"; | | * "$Id: re-cmp.c,v 1.12 2005/08/12 08:18:59 ryo_saeba Exp $"; |
*/ | | */ |
| | |
| | |
| | |
| | |
/* P r o t o t y p e s | | /* P r o t o t y p e s |
*/ | | */ |
char *re_cmp(char *, char *); | | const char *re_cmp(const char *, const char *); |
static Boolean re_cmp_step(char *, char *, int, int); | | static Boolean re_cmp_step(const char *, const char *, int, int); |
static void re_init(void); | | static void re_init(void); |
static Boolean re_match_token(uchar, selection *); | | static Boolean re_match_token(uchar, selection *); |
static char *re_get_token(selection *, char *); | | static const char *re_get_token(selection *, const char *); |
#ifdef DEBUG2 | | #ifdef DEBUG2 |
static void re_dump_sel(selection *); | | static void re_dump_sel(selection *); |
#endif | | #endif |
| | |
*/ | | */ |
static Boolean re_init_done = False; | | static Boolean re_init_done = False; |
static selection *re_token[RE_TOKEN_MAX]; | | static selection *re_token[RE_TOKEN_MAX]; |
static char *re_substr[RE_TOKEN_MAX]; | | static const char *re_substr[RE_TOKEN_MAX]; |
static unsigned int re_token_depth; | | static unsigned int re_token_depth; |
| | |
/* E x t e r n a l f u n c t i o n | | /* E x t e r n a l f u n c t i o n |
| | |
* Return values: NULL - no match or error in regexp. | | * Return values: NULL - no match or error in regexp. |
* pointer to beginning of matching string | | * pointer to beginning of matching string |
*/ | | */ |
char * | | const char * |
re_cmp(char *str, char *regexp) { | | re_cmp(const char *str, const char *regexp) { |
char *next_regexp; | | const char *next_regexp; |
Boolean once = False; | | Boolean once = False; |
Boolean matched; | | Boolean matched; |
| | |
| | |
*/ | | */ |
| | |
static Boolean | | static Boolean |
re_cmp_step(char *str, char *regexp, int slot, int matches) { | | re_cmp_step(const char *str, const char *regexp, int slot, int matches) { |
/* str - string to match | | /* str - string to match |
* regexp - pattern | | * regexp - pattern |
* slot - number of the token which under consideration | | * slot - number of the token which under consideration |
* matches - how many times the token has matched | | * matches - how many times the token has matched |
*/ | | */ |
char *next_regexp; | | const char *next_regexp; |
Boolean matched; | | Boolean matched; |
| | |
#ifdef DEBUG | | #ifdef DEBUG |
| | |
* Return values: NULL syntax error | | * Return values: NULL syntax error |
* pointer to first character past token. | | * pointer to first character past token. |
*/ | | */ |
static char * | | static const char * |
re_get_token(selection *sel, char *regexp) { | | re_get_token(selection *sel, const char *regexp) { |
| | |
#ifdef SAFE_CHECKS | | #ifdef SAFE_CHECKS |
# define exit_if_null if (*regexp == 0) return NULL | | # define exit_if_null if (*regexp == 0) return NULL |