Crossfire Server, Trunk
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <re-cmp.h>
#include <ctype.h>
#include <global.h>
#include <define.h>
Go to the source code of this file.
Macros | |
#define | exit_if_null |
Functions | |
const char * | re_cmp (const char *, const char *) |
static Boolean | re_cmp_step (const char *, const char *, unsigned, int) |
static const char * | re_get_token (selection *, const char *) |
static void | re_init (void) |
static Boolean | re_match_token (uchar, selection *) |
Variables | |
static Boolean | re_init_done = False |
static const char * | re_substr [RE_TOKEN_MAX] |
static selection * | re_token [RE_TOKEN_MAX] |
static unsigned int | re_token_depth |
Pattern match a string, parsing some of the common RE-metacharacters.
This code is public domain, but I would appreciate to hear of improvements or even the fact that you use it in your program.
Deliberate BUGS:
Author: Kjetil T. Homme (kjeti) May 1993 lho@ ifi.u io.n o
Definition in file re-cmp.c.
#define exit_if_null |
const char * re_cmp | ( | const char * | str, |
const char * | regexp | ||
) |
re-cmp - get regular expression match.
str | string that will be matched against the regexp. |
regexp | regular expression. |
Definition at line 69 of file re-cmp.c.
References Boolean, False, re_cmp(), re_cmp_step(), re_get_token(), re_init(), re_init_done, re_match_token(), re_substr, re_token, re_token_depth, rep_null_or_more, rep_null_or_once, rep_once, rep_once_or_more, make_face_from_files::str, and True.
Referenced by cfapi_system_re_cmp(), matches(), and re_cmp().
|
static |
Tries to match a string with a regexp.
str | string to match |
regexp | pattern |
slot | number of the token which under consideration |
matches | how many times the token has matched |
Definition at line 190 of file re-cmp.c.
References Boolean, False, matches(), re_get_token(), re_match_token(), re_substr, re_token, re_token_depth, rep_null_or_more, rep_null_or_once, rep_once, rep_once_or_more, sel_end, make_face_from_files::str, True, and is_valid_types_gen::type.
Referenced by re_cmp().
|
static |
Get the first regular expression token found in regexp in sel.
[out] | sel | where to store the token. |
regexp | regular expression. |
Definition at line 331 of file re-cmp.c.
References selection::array, Boolean, exit_if_null, False, say::previous, selection::range, rep_null_or_more, rep_null_or_once, rep_once, rep_once_or_more, selection::repeat, sel_any, sel_array, sel_end, sel_not_range, sel_not_single, sel_range, sel_single, selection::single, True, selection::type, selection::u, and uchar.
Referenced by re_cmp(), and re_cmp_step().
|
static |
Init the regular expression structures.
Definition at line 271 of file re-cmp.c.
References fatal(), OUT_OF_MEMORY, re_init_done, re_token, RE_TOKEN_MAX, and True.
Referenced by re_cmp().
Tests if a char matches a token.
c | char to test. |
sel | token to test. |
Definition at line 293 of file re-cmp.c.
References selection::array, c, False, selection::range, sel_any, sel_array, sel_end, sel_not_range, sel_not_single, sel_range, sel_single, selection::single, tolower, True, selection::type, and selection::u.
Referenced by re_cmp(), and re_cmp_step().
|
static |
Definition at line 52 of file re-cmp.c.
Referenced by re_cmp(), and re_cmp_step().
|
static |
Definition at line 51 of file re-cmp.c.
Referenced by re_cmp(), re_cmp_step(), and re_init().
|
static |
Definition at line 53 of file re-cmp.c.
Referenced by re_cmp(), and re_cmp_step().