diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-12-26 22:42:54 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-12-26 22:42:54 +0200 |
commit | 9229cd0e900ab31d1049eda623f2756670109399 (patch) | |
tree | 812d4d98373313a258e553b9abe16c68f36fb8c2 | |
parent | d586094c7c4a9a412a7633a32d2b92a8e1cfea1c (diff) | |
download | egawk-9229cd0e900ab31d1049eda623f2756670109399.tar.gz egawk-9229cd0e900ab31d1049eda623f2756670109399.tar.bz2 egawk-9229cd0e900ab31d1049eda623f2756670109399.zip |
Finish RRI changes per points from Paolo Bonzini.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | dfa.c | 11 | ||||
-rw-r--r-- | regexec.c | 12 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 10 | ||||
-rw-r--r-- | test/Makefile.in | 10 | ||||
-rw-r--r-- | test/rri1.awk | 1 | ||||
-rw-r--r-- | test/rri1.in | 1 | ||||
-rw-r--r-- | test/rri1.ok | 0 |
9 files changed, 41 insertions, 19 deletions
@@ -1,3 +1,13 @@ +2011-12-26 Arnold D. Robbins <arnold@skeeve.com> + + Finish Rational Range Interpretation (!) + + * dfa.c (match_mb_charset): Compare wide characters directly + instead of using wcscoll(). + * regexec.c (check_node_accept_byte): Ditto. + + Thanks to Paolo Bonzini for pointing these out. + 2011-12-06 John Haque <j.eh@mchsi.com> * debug.c (source_find): Fix misplaced call to efree. @@ -2887,7 +2887,6 @@ match_mb_charset (struct dfa *d, int s, position pos, int idx) with which this operator match. */ int op_len; /* Length of the operator. */ char buffer[128]; - wchar_t wcbuf[6]; /* Pointer to the structure to which we are currently refering. */ struct mb_char_classes *work_mbc; @@ -2964,17 +2963,11 @@ match_mb_charset (struct dfa *d, int s, position pos, int idx) } } - wcbuf[0] = wc; - wcbuf[1] = wcbuf[3] = wcbuf[5] = '\0'; - /* match with a range? */ for (i = 0; i<work_mbc->nranges; i++) { - wcbuf[2] = work_mbc->range_sts[i]; - wcbuf[4] = work_mbc->range_ends[i]; - - if (wcscoll(wcbuf, wcbuf+2) >= 0 && - wcscoll(wcbuf+4, wcbuf) >= 0) + if (work_mbc->range_sts[i] <= wc && + wc <= work_mbc->range_ends[i]) goto charset_matched; } @@ -3963,18 +3963,10 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx, # endif /* _LIBC */ { /* match with range expression? */ -#if __GNUC__ >= 2 - wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'}; -#else - wchar_t cmp_buf[] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; - cmp_buf[2] = wc; -#endif for (i = 0; i < cset->nranges; ++i) { - cmp_buf[0] = cset->range_starts[i]; - cmp_buf[4] = cset->range_ends[i]; - if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 - && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) + if (cset->range_starts[i] <= wc + && wc <= cset->range_ends[i]) { match_len = char_len; goto check_node_accept_bytes_match; diff --git a/test/ChangeLog b/test/ChangeLog index 1ceb5b35..711d8b20 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2011-12-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (rri1): New test. + * rri1.awk, rri1.in, rri1.ok: New files. + 2011-12-06 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am: Rationalize the $(CMP) lines wherever possible. diff --git a/test/Makefile.am b/test/Makefile.am index aae30518..f7d50b28 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -625,6 +625,9 @@ EXTRA_DIST = \ resplit.awk \ resplit.in \ resplit.ok \ + rri1.awk \ + rri1.in \ + rri1.ok \ rs.awk \ rs.in \ rs.ok \ @@ -803,6 +806,7 @@ BASIC_TESTS = \ paramres paramtyp parse1 parsefld parseme pcntplus posix2008sub \ prdupval prec printf0 printf1 prmarscl prmreuse prt1eval prtoeval \ rand range1 rebt8b1 redfilnm regeq regrange reindops reparse resplit \ + rri1 \ rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4 \ rstest5 rswhite scalar sclforin sclifin sortempty splitargv \ splitarr splitdef splitvar splitwht strcat1 strnum1 strtod subamp \ @@ -1433,6 +1437,12 @@ exit: @-AWK="$(AWKPROG)" $(srcdir)/$@.sh > _$@ 2>&1 @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rri1:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 800c55d8..05946f32 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -809,6 +809,9 @@ EXTRA_DIST = \ resplit.awk \ resplit.in \ resplit.ok \ + rri1.awk \ + rri1.in \ + rri1.ok \ rs.awk \ rs.in \ rs.ok \ @@ -987,6 +990,7 @@ BASIC_TESTS = \ paramres paramtyp parse1 parsefld parseme pcntplus posix2008sub \ prdupval prec printf0 printf1 prmarscl prmreuse prt1eval prtoeval \ rand range1 rebt8b1 redfilnm regeq regrange reindops reparse resplit \ + rri1 \ rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 rstest3 rstest4 \ rstest5 rswhite scalar sclforin sclifin sortempty splitargv \ splitarr splitdef splitvar splitwht strcat1 strnum1 strtod subamp \ @@ -1782,6 +1786,12 @@ exit: @echo $@ @-AWK="$(AWKPROG)" $(srcdir)/$@.sh > _$@ 2>&1 @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rri1:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: diff --git a/test/rri1.awk b/test/rri1.awk new file mode 100644 index 00000000..889dbdcb --- /dev/null +++ b/test/rri1.awk @@ -0,0 +1 @@ +/[d-f]/ diff --git a/test/rri1.in b/test/rri1.in new file mode 100644 index 00000000..28b6b408 --- /dev/null +++ b/test/rri1.in @@ -0,0 +1 @@ +no match: è diff --git a/test/rri1.ok b/test/rri1.ok new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/rri1.ok |