4458 register CHAR_T *pto = end;
4459 register CHAR_T *pfrom = end - num;
4461 while (pfrom >= loc)
4468 wcs_compile_range (range_start_char, p_ptr, pend,
translate,
syntax, b,
4470 CHAR_T range_start_char;
4471 const CHAR_T **p_ptr, *pend;
4472 CHAR_T *char_set, *b;
4476 const CHAR_T *p = *p_ptr;
4477 CHAR_T range_start, range_end;
4481 uint32_t start_val, end_val;
4487 nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
4490 const char *collseq = (
const char *) _NL_CURRENT(LC_COLLATE,
4491 _NL_COLLATE_COLLSEQWC);
4492 const unsigned char *extra = (
const unsigned char *)
4493 _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
4495 if (range_start_char < -1)
4500 wextra = (int32_t*)(extra + char_set[-range_start_char]);
4501 start_val = wextra[1 + *wextra];
4504 start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char));
4506 end_val = collseq_table_lookup (collseq, TRANSLATE (p[0]));
4514 insert_space(2, b - char_set[5] - 2, b - 1);
4515 *(b - char_set[5] - 2) = (
wchar_t)start_val;
4516 *(b - char_set[5] - 1) = (
wchar_t)end_val;
4522 range_start = (range_start_char >= 0)? TRANSLATE (range_start_char):
4524 range_end = TRANSLATE (p[0]);
4531 insert_space(2, b - char_set[5] - 2, b - 1);
4532 *(b - char_set[5] - 2) = range_start;
4533 *(b - char_set[5] - 1) = range_end;
4555 byte_compile_range (range_start_char, p_ptr, pend, translate, syntax, b)
4556 unsigned
int range_start_char;
4557 const char **p_ptr, *pend;
4563 const char *p = *p_ptr;
4566 const unsigned char *collseq;
4567 unsigned int start_colseq;
4568 unsigned int end_colseq;
4584 collseq = (
const unsigned char *) _NL_CURRENT (LC_COLLATE,
4585 _NL_COLLATE_COLLSEQMB);
4587 start_colseq = collseq[(
unsigned char) TRANSLATE (range_start_char)];
4588 end_colseq = collseq[(
unsigned char) TRANSLATE (p[0])];
4589 for (this_char = 0; this_char <= (
unsigned char) -1; ++this_char)
4591 unsigned int this_colseq = collseq[(
unsigned char) TRANSLATE (this_char)];
4593 if (start_colseq <= this_colseq && this_colseq <= end_colseq)
4595 SET_LIST_BIT (TRANSLATE (this_char));
4603 range_start_char = TRANSLATE (range_start_char);
4609 end_char = ((unsigned)TRANSLATE(p[0]) & ((1 <<
BYTEWIDTH) - 1));
4611 for (this_char = range_start_char; this_char <= end_char; ++this_char)
4613 SET_LIST_BIT (TRANSLATE (this_char));
4639 static unsigned char truncate_wchar (CHAR_T c);
4641 static unsigned char
4645 unsigned char buf[MB_CUR_MAX];
4648 memset (&state,
'\0',
sizeof (state));
4650 retval = __wcrtomb (buf, c, &state);
4652 retval = wcrtomb (buf, c, &state);
4654 return retval > 0 ? buf[0] : (
unsigned char) c;
4659 PREFIX(re_compile_fastmap) (
bufp)
4663 #ifdef MATCH_MAY_ALLOCATE
4664 PREFIX(fail_stack_type) fail_stack;
4666 #ifndef REGEX_MALLOC
4679 register UCHAR_T *pend = pattern +
bufp->
used;
4686 fail_stack_elt_t *failure_stack_ptr;
4693 boolean path_can_be_null =
true;
4696 boolean succeed_n_p =
false;
4698 assert (fastmap !=
NULL && p !=
NULL);
4707 if (p == pend || *p ==
succeed)
4710 if (!FAIL_STACK_EMPTY ())
4715 path_can_be_null =
true;
4717 p = fail_stack.stack[--fail_stack.avail].pointer;
4746 fastmap[truncate_wchar(p[1])] = 1;
4770 for (j = *p++ *
BYTEWIDTH - 1; j >= 0; j--)
4778 for (j = *p * BYTEWIDTH; j < (1 <<
BYTEWIDTH); j++)
4781 for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
4782 if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
4803 int fastmap_newline = fastmap[
'\n'];
4811 fastmap[
'\n'] = fastmap_newline;
4826 if (
SYNTAX (j) == (
enum syntaxcode) k)
4834 if (
SYNTAX (j) != (
enum syntaxcode) k)
4869 EXTRACT_NUMBER_AND_INCR (j, p);
4884 EXTRACT_NUMBER_AND_INCR (j, p);
4888 if (!FAIL_STACK_EMPTY ()
4889 && fail_stack.stack[fail_stack.avail - 1].pointer == p)
4897 handle_on_failure_jump:
4898 EXTRACT_NUMBER_AND_INCR (j, p);
4909 if (!PUSH_PATTERN_OP (p + j, fail_stack))
4911 RESET_FAIL_STACK ();
4920 EXTRACT_NUMBER_AND_INCR (k, p);
4921 succeed_n_p =
false;
4929 p += OFFSET_ADDRESS_SIZE;
4932 EXTRACT_NUMBER_AND_INCR (k, p);
4935 p -= 2 * OFFSET_ADDRESS_SIZE;
4937 goto handle_on_failure_jump;
4943 p += 2 * OFFSET_ADDRESS_SIZE;
4963 path_can_be_null =
false;
4972 RESET_FAIL_STACK ();
4979 re_compile_fastmap (
bufp)
4983 if (MB_CUR_MAX != 1)
4984 return wcs_re_compile_fastmap(bufp);
4987 return byte_re_compile_fastmap(bufp);
#define SWITCH_ENUM_CAST(x)
void struct re_pattern_buffer * bufp
unsigned long int reg_syntax_t
reg_syntax_t reg_syntax_t syntax
#define RE_TRANSLATE_TYPE
unsigned fastmap_accurate
#define RE_NO_EMPTY_RANGES
const char *const char * pattern