/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* posix regex record executor
* multiple record sized-buffer interface
*/
#include "reglib.h"
/*
* call regnexec() on records selected by Boyer-Moore
*/
int
regrexec(const regex_t* p, const char* s, size_t len, size_t nmatch, regmatch_t* match, regflags_t flags, int sep, void* handle, regrecord_t record)
{
register unsigned char* buf = (unsigned char*)s;
register unsigned char* beg;
register unsigned char* l;
register unsigned char* r;
register unsigned char* x;
register ssize_t n;
unsigned char* end;
int complete;
int exactlen;
int leftlen;
int rightlen;
int inv;
Bm_mask_t m;
Rex_t* e;
return REG_BADPAT;
for (;;)
{
goto impossible;
do
{
if (!n--)
goto possible;
continue;
if (inv)
{
goto invert;
}
n = 0;
goto done;
while (l > beg)
if (*--l == sep)
{
l++;
break;
}
if ((r - l) < leftlen)
goto spanned;
r++;
goto spanned;
if (complete || (env->rex = ((r - l) > 128) ? e : e->next) && !(n = regnexec(p, (char*)l, r - l, nmatch, match, flags)))
{
if (inv)
{
x = beg;
while (beg < l)
{
while (x < l && *x != sep)
x++;
goto done;
beg = ++x;
}
}
goto done;
{
goto done;
}
beg = r + 1;
}
else if (n != REG_NOMATCH)
goto done;
else
{
goto impossible;
}
}
done:
return n;
}
/*
* 20120528: regoff_t changed from int to ssize_t
*/
#if defined(__EXPORT__)
#define extern __EXPORT__
#endif
#if _map_libc
#endif
extern int
regrexec(const regex_t* p, const char* s, size_t len, size_t nmatch, oldregmatch_t* oldmatch, regflags_t flags, int sep, void* handle, regrecord_t record)
{
if (oldmatch)
{
ssize_t i;
int r;
return -1;
for (i = 0; i < nmatch; i++)
{
}
return r;
}
}