43#define GETC() ((unsigned char)*sp++)
44#define PEEKC() ((unsigned char)*sp)
45#define UNGETC(c) (--sp)
46#define SEDCOMPILE_ERROR(c) { \
50#define ecmp(s1, s2, n) (strncmp(s1, s2, n) == 0)
51#define uletter(c) (isalpha(c) || c == '_')
54static unsigned char bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
77 comperr(commands,
"Range endpoint too large: %s");
81 comperr(commands,
"Bad number: %s");
85 comperr(commands,
"``\\digit'' out of range: %s");
89 comperr(commands,
"Illegal or missing delimiter: %s");
93 comperr(commands,
"No remembered search string: %s");
97 comperr(commands,
"\\( \\) imbalance: %s");
101 comperr(commands,
"Too many \\(: %s");
105 comperr(commands,
"More than 2 numbers given in \\{ \\}: %s");
109 comperr(commands,
"} expected after \\: %s");
113 comperr(commands,
"First number exceeds second in \\{ \\}: %s");
117 comperr(commands,
"[ ] imbalance: %s");
125 comperr(commands,
"Unknown regexp error code %s\n");
145 char *
sp = commands->
cp;
166 if (
c !=
'*' && ((
c !=
'\\') || (
PEEKC() !=
'{')))
203 for (
i = 0;
i < 16;
i++)
207 if ((
c =
GETC()) ==
'^') {
214 if (
c ==
'\0' ||
c ==
'\n')
216 if ((
c & 0200) &&
iflag) {
221 for (
i = 16;
i < 32;
i++)
224 if (
c ==
'-' &&
lc != 0) {
225 if ((
c =
GETC()) ==
']') {
229 if ((
c & 0200) &&
iflag) {
234 for (
i = 16;
i < 32;
i++)
244 }
while ((
c =
GETC()) !=
']');
269 switch (
c =
GETC()) {
296 if (
'0' <=
c &&
c <=
'9')
297 i = 10 *
i +
c -
'0';
300 }
while (((
c =
GETC()) !=
'\\') && (
c !=
','));
307 if ((
c =
GETC()) ==
'\\')
319 else if ((
ep[-1] & 0377) < (
ep[-2] & 0377))
331 if (
c >=
'1' &&
c <=
'9') {
332 if ((
c -=
'1') >= closed)
484 while (vars->
low--) {
490 while (vars->
size--) {
505 while (vars->
low--) {
511 while (vars->
size--) {
557 while (*
lp++ == *
ep);
595 vars->
low = *
str++ & 0377;
596 vars->
size = ((*
str & 0377) == 255)? 20000: (*
str &0377) - vars->
low;
APR general purpose library routines.
apr_vformatter_buff_t * c
apr_int32_t apr_int32_t apr_int32_t err
static unsigned char bittab[]
char * sed_compile(sed_commands_t *commands, sed_comp_args *compargs, char *ep, char *endbuf, int seof)
int sed_step(char *p1, char *p2, int circf, step_vars_storage *vars)
static int _advance(char *, char *, step_vars_storage *)
#define SEDCOMPILE_ERROR(c)
static void getrnge(char *str, step_vars_storage *vars)
static int regerr(sed_commands_t *commands, int err)
static void comperr(sed_commands_t *commands, char *msg)
void command_errf(sed_commands_t *commands, const char *fmt,...) __attribute__((format(printf
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray