/* Modified for use in SILC Runtime Toolkit. I think we have disabled many
features we could use, for the sake of simple API, which we may want to
/* Modified for use in SILC Runtime Toolkit. I think we have disabled many
features we could use, for the sake of simple API, which we may want to
#define RE_CONTEXT_INDEP_OPS 32 /* ^$?*+ are special in all contexts */
#define RE_ANSI_HEX 64 /* ansi sequences (\n etc) and \xhh */
#define RE_NO_GNU_EXTENSIONS 128 /* no gnu extensions */
#define RE_CONTEXT_INDEP_OPS 32 /* ^$?*+ are special in all contexts */
#define RE_ANSI_HEX 64 /* ansi sequences (\n etc) and \xhh */
#define RE_NO_GNU_EXTENSIONS 128 /* no gnu extensions */
/* definitions for some common regexp styles */
#define RE_SYNTAX_AWK (RE_NO_BK_PARENS|RE_NO_BK_VBAR|RE_CONTEXT_INDEP_OPS)
/* definitions for some common regexp styles */
#define RE_SYNTAX_AWK (RE_NO_BK_PARENS|RE_NO_BK_VBAR|RE_CONTEXT_INDEP_OPS)
translation table, or NULL if it is not used. */
int re_match(SilcRegex compiled, char *string, int size, int pos,
translation table, or NULL if it is not used. */
int re_match(SilcRegex compiled, char *string, int size, int pos,
/* This tries to match the regexp against the string. This returns the
length of the matched portion, or -1 if the pattern could not be
matched and -2 if an error (such as failure stack overflow) is
encountered. */
int re_match_2(SilcRegex compiled, char *string1, int size1,
/* This tries to match the regexp against the string. This returns the
length of the matched portion, or -1 if the pattern could not be
matched and -2 if an error (such as failure stack overflow) is
encountered. */
int re_match_2(SilcRegex compiled, char *string1, int size1,
- char *string2, int size2, int pos, regexp_registers_t regs,
- int mstop);
+ char *string2, int size2, int pos, regexp_registers_t regs,
+ int mstop, unsigned int flags);
/* This tries to match the regexp to the concatenation of string1 and
string2. This returns the length of the matched portion, or -1 if the
pattern could not be matched and -2 if an error (such as failure stack
overflow) is encountered. */
int re_search(SilcRegex compiled, char *string, int size, int startpos,
/* This tries to match the regexp to the concatenation of string1 and
string2. This returns the length of the matched portion, or -1 if the
pattern could not be matched and -2 if an error (such as failure stack
overflow) is encountered. */
int re_search(SilcRegex compiled, char *string, int size, int startpos,
/* This rearches for a substring matching the regexp. This returns the first
index at which a match is found. range specifies at how many positions to
try matching; positive values indicate searching forwards, and negative
/* This rearches for a substring matching the regexp. This returns the first
index at which a match is found. range specifies at how many positions to
try matching; positive values indicate searching forwards, and negative
int re_search_2(SilcRegex compiled, char *string1, int size1,
char *string2, int size2, int startpos, int range,
int re_search_2(SilcRegex compiled, char *string1, int size1,
char *string2, int size2, int startpos, int range,
#define INITIAL_FAILURES 128 /* initial # failure points to allocate */
#define MAX_FAILURES 4100 /* max # of failure points before failing */
#define INITIAL_FAILURES 128 /* initial # failure points to allocate */
#define MAX_FAILURES 4100 /* max # of failure points before failing */
-int re_match_2(bufp, string1, size1, string2, size2, pos, regs, mstop)
+int re_match_2(bufp, string1, size1, string2, size2, pos, regs, mstop, flags)
SilcRegex bufp;
char *string1, *string2;
int size1, size2, pos, mstop;
regexp_registers_t regs;
SilcRegex bufp;
char *string1, *string2;
int size1, size2, pos, mstop;
regexp_registers_t regs;
{
struct failure_point { char *text, *partend, *code; }
*failure_stack_start, *failure_sp, *failure_stack_end,
{
struct failure_point { char *text, *partend, *code; }
*failure_stack_start, *failure_sp, *failure_stack_end,
goto fail;
case Ceol:
if (text == string2 + size2 ||
(text == string1 + size1 ?
(size2 == 0 || *string2 == '\n') :
goto fail;
case Ceol:
if (text == string2 + size2 ||
(text == string1 + size1 ?
(size2 == 0 || *string2 == '\n') :
-int re_match(bufp, string, size, pos, regs)
+int re_match(bufp, string, size, pos, regs, flags)
- return re_match_2(bufp, string, size, (char *)NULL, 0, pos, regs, size);
+ return re_match_2(bufp, string, size, (char *)NULL, 0, pos, regs, size,
+ flags);
}
int re_search_2(bufp, string1, size1, string2, size2, pos, range, regs,
}
int re_search_2(bufp, string1, size1, string2, size2, pos, range, regs,
SilcRegex bufp;
char *string1, *string2;
int size1, size2, pos, range, mstop;
regexp_registers_t regs;
SilcRegex bufp;
char *string1, *string2;
int size1, size2, pos, range, mstop;
regexp_registers_t regs;
{
char *fastmap, *translate, *text, *partstart, *partend;
int dir, ret;
{
char *fastmap, *translate, *text, *partstart, *partend;
int dir, ret;
- ret = re_match_2(bufp, string1, size1, string2, size2, pos, regs, mstop);
+ ret = re_match_2(bufp, string1, size1, string2, size2, pos, regs, mstop,
+ flags);
-int re_search(bufp, string, size, startpos, range, regs)
+int re_search(bufp, string, size, startpos, range, regs, flags)
{
return re_search_2(bufp, string, size, (char *)NULL, 0,
{
return re_search_2(bufp, string, size, (char *)NULL, 0,
- startpos, range, regs, size);
+ startpos, range, regs, size, flags);
SilcRegexMatch match, SilcRegexFlags flags)
{
struct re_registers regs;
SilcRegexMatch match, SilcRegexFlags flags)
{
struct re_registers regs;
/* Search */
ret = re_search(regexp, (char *)string, string_len, 0, string_len,
/* Search */
ret = re_search(regexp, (char *)string, string_len, 0, string_len,