/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* 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 state and alloc
*/
#include "reglib.h"
#if _PACKAGE_ast
#include <ccode.h>
#else
#endif
/*
* state shared by all threads
*/
{
{ -1, -1 },
/*
* escape code table
* the "funny" things get special treatment at ends of BRE
*
* BRE 0:normal 1:escaped 2:escaped-char-class
* ERE 3:normal 4:escaped 5:escaped-char-class
* ARE 6:normal 7:escaped 8:escaped-char-class
* SRE 9:normal 10:escaped 11:escaped-char-class
* KRE 12:normal 13:escaped 14:escaped-char-class
*/
'\\',
'\\', '\\', '\\',
'\\', '\\', '\\',
'\\', '\\', '\\',
'\\', '\\', '\\',
'\\', '\\', '\\',
'^', /* funny */
'^', '^', '^',
'^', '^', '^',
'^', '^', '^',
'.',
'$', /* funny */
'*',
'[',
'|',
'+',
'?',
'(',
'(', '(', '(',
')',
')', ')', ')',
'{',
'{', '{', '{',
'}',
'}', '}', '}',
'}', '}', '}',
'&',
'!',
'@',
'~',
'%',
'<',
'>',
/* backrefs */
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
/* perl */
'A',
'b',
'B',
'd',
'D',
's',
'S',
'w',
'W',
'z',
'Z',
/* C escapes */
'a',
'c',
'C',
'e',
'E',
'f',
'f', '\f', '\f',
'f', '\f', '\f',
'f', '\f', '\f',
'f', '\f', '\f',
'f', '\f', '\f',
'n',
'n', '\n', '\n',
'n', '\n', '\n',
'n', '\n', '\n',
'n', '\n', '\n',
'n', '\n', '\n',
'r',
'r', '\r', '\r',
'r', '\r', '\r',
'r', '\r', '\r',
'r', '\r', '\r',
'r', '\r', '\r',
't',
't', '\t', '\t',
't', '\t', '\t',
't', '\t', '\t',
't', '\t', '\t',
't', '\t', '\t',
'v',
'x',
};
/*
* all allocation/free done here
* interface compatible with vmresize()
*
* malloc(n) alloc(0,n)
* realloc(p,n) alloc(p,n)
* free(p) alloc(p,0)
*/
void*
{
if (disc->re_resizef)
{
return 0;
}
else if (!n)
{
free(p);
return 0;
}
else if (p)
return realloc(p, n);
else
return malloc(n);
}