460 |
|
|
461 |
/* This function fetch a wide character, and update cur_mb_len, |
/* This function fetch a wide character, and update cur_mb_len, |
462 |
used only if the current locale is a multibyte environment. */ |
used only if the current locale is a multibyte environment. */ |
463 |
static wchar_t |
static wint_t |
464 |
fetch_wc (char const *eoferr) |
fetch_wc (char const *eoferr) |
465 |
{ |
{ |
466 |
wchar_t wc; |
wchar_t wc; |
469 |
if (eoferr != 0) |
if (eoferr != 0) |
470 |
dfaerror (eoferr); |
dfaerror (eoferr); |
471 |
else |
else |
472 |
return -1; |
return WEOF; |
473 |
} |
} |
474 |
|
|
475 |
cur_mb_len = mbrtowc(&wc, lexptr, lexleft, &mbs); |
cur_mb_len = mbrtowc(&wc, lexptr, lexleft, &mbs); |
505 |
static void |
static void |
506 |
parse_bracket_exp_mb () |
parse_bracket_exp_mb () |
507 |
{ |
{ |
508 |
wchar_t wc, wc1, wc2; |
wint_t wc, wc1, wc2; |
509 |
|
|
510 |
/* Work area to build a mb_char_classes. */ |
/* Work area to build a mb_char_classes. */ |
511 |
struct mb_char_classes *work_mbc; |
struct mb_char_classes *work_mbc; |
542 |
work_mbc->invert = 0; |
work_mbc->invert = 0; |
543 |
do |
do |
544 |
{ |
{ |
545 |
wc1 = -1; /* mark wc1 is not initialized". */ |
wc1 = WEOF; /* mark wc1 is not initialized". */ |
546 |
|
|
547 |
/* Note that if we're looking at some other [:...:] construct, |
/* Note that if we're looking at some other [:...:] construct, |
548 |
we just treat it as a bunch of ordinary characters. We can do |
we just treat it as a bunch of ordinary characters. We can do |
597 |
wt = wctype (str); |
wt = wctype (str); |
598 |
|
|
599 |
if (ch_classes_al == 0) |
if (ch_classes_al == 0) |
600 |
MALLOC(work_mbc->ch_classes, wchar_t, ++ch_classes_al); |
MALLOC(work_mbc->ch_classes, wctype_t, ++ch_classes_al); |
601 |
REALLOC_IF_NECESSARY(work_mbc->ch_classes, wctype_t, |
REALLOC_IF_NECESSARY(work_mbc->ch_classes, wctype_t, |
602 |
ch_classes_al, |
ch_classes_al, |
603 |
work_mbc->nch_classes + 1); |
work_mbc->nch_classes + 1); |
632 |
work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem; |
work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem; |
633 |
} |
} |
634 |
} |
} |
635 |
wc = -1; |
wc = WEOF; |
636 |
} |
} |
637 |
else |
else |
638 |
/* We treat '[' as a normal character here. */ |
/* We treat '[' as a normal character here. */ |
646 |
wc = fetch_wc(("Unbalanced [")); |
wc = fetch_wc(("Unbalanced [")); |
647 |
} |
} |
648 |
|
|
649 |
if (wc1 == -1) |
if (wc1 == WEOF) |
650 |
wc1 = fetch_wc(_("Unbalanced [")); |
wc1 = fetch_wc(_("Unbalanced [")); |
651 |
|
|
652 |
if (wc1 == L'-') |
if (wc1 == L'-') |
676 |
} |
} |
677 |
REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t, |
REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t, |
678 |
range_sts_al, work_mbc->nranges + 1); |
range_sts_al, work_mbc->nranges + 1); |
679 |
work_mbc->range_sts[work_mbc->nranges] = wc; |
work_mbc->range_sts[work_mbc->nranges] = (wchar_t)wc; |
680 |
REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t, |
REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t, |
681 |
range_ends_al, work_mbc->nranges + 1); |
range_ends_al, work_mbc->nranges + 1); |
682 |
work_mbc->range_ends[work_mbc->nranges++] = wc2; |
work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)wc2; |
683 |
} |
} |
684 |
else if (wc != -1) |
else if (wc != WEOF) |
685 |
/* build normal characters. */ |
/* build normal characters. */ |
686 |
{ |
{ |
687 |
REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, |
REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, |
688 |
work_mbc->nchars + 1); |
work_mbc->nchars + 1); |
689 |
work_mbc->chars[work_mbc->nchars++] = wc; |
work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc; |
690 |
} |
} |
691 |
} |
} |
692 |
while ((wc = wc1) != L']'); |
while ((wc = wc1) != L']'); |