Commit Graph

85 Commits

Author SHA1 Message Date
Stefan Farfeleder
69053d669e Use prototypes for CHIN1() and CHIN(). 2005-09-12 16:02:54 +00:00
Tim J. Robbins
1ee0dbee57 Fix a boundary condition error in slow() and fast() in multibyte locales:
we must allow the character beginning at "p" to be converted to a wide
character for the purposes of EOL processing and word-boundary matching.
2005-08-17 11:37:38 +00:00
Tim J. Robbins
0eac054729 Document the fact that word-boundary matching does not work
properly in multibyte locales.
2005-08-17 11:21:15 +00:00
Tim J. Robbins
0853006ff1 Change OUT from -2 to CHAR_MIN-1, making it impossible for it to
inadvertently match a negative char in the RE being compiled.

This fixes compilation of "\376" (as an ERE) and "\376\376" (as a BRE).

PR:		84740
MFC after:	1 week
2005-08-13 02:30:15 +00:00
Xin LI
b49627d7a7 Remove unused file.
Confirmed by:	tjr [1]

[1] PERFORCE CHANGESET 57044:
	http://perforce.freebsd.org/changeView.cgi?CH=57044
2005-04-25 02:29:03 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Diomidis Spinellis
c7ce9e21f8 Plug memory leak.
PR:		bin/75656
MFC after:	2 weeks
2004-12-30 14:27:57 +00:00
Tim J. Robbins
bd9643b135 Fix computation of the 'n' argument to mbrtowc (through XMBRTOWC) to avoid
reading past 'stop' in various places when converting multibyte characters.
Reading too far caused truncation to not be detected when it should have
been, eventually causing regexec() to loop infinitely in with certain
combinations of patterns and strings in multibyte locales.

PR:		74020
MFC after:	4 weeks
2004-11-21 03:14:32 +00:00
Stefan Farfeleder
4e8c80e977 Directly include <runetype.h> for _CurrentRuneLocale, <_ctype.h> doesn't
include it in all cases.
2004-10-03 15:42:59 +00:00
Tim J. Robbins
33176f1755 Fix two problems with REG_ICASE that were introduced with the addition of
multibyte character support:
- In CHadd(), avoid writing past the end of the character set bitmap when
  the opposite-case counterpart of wide characters with values less than
  NC have values greater than or equal to NC.
- In CHaddtype(), fix a braino that caused alphabetic characters to be
  added to all character classes! (but only with REG_ICASE)

PR:		71367
2004-09-05 08:30:42 +00:00
Tim J. Robbins
2ff3ba336e Update paths to reg*.c and regex2.h. Add a target to build regex.h. 2004-07-19 08:48:17 +00:00
Tim J. Robbins
405033831e Update for removal of cclass.h. Trim some useless targets. Invoke mkh
with "sh mkh" so it works if the script is not executable.
2004-07-19 08:41:11 +00:00
Tim J. Robbins
ec8b0411f1 Update for recent changes to struct re_guts. Disable printing the contents
of OANYOF sets for the moment.
2004-07-19 08:28:53 +00:00
Tim J. Robbins
f420a25887 Remove unused files. 2004-07-19 08:24:21 +00:00
Tim J. Robbins
ee5d8a1b0a Remove an entry from the BUGS section: we have multibyte character
support now.
2004-07-12 11:03:42 +00:00
Tim J. Robbins
e5996857ad Make regular expression matching aware of multibyte characters. The general
idea is that we perform multibyte->wide character conversion while parsing
and compiling, then convert byte sequences to wide characters when they're
needed for comparison and stepping through the string during execution.

As with tr(1), the main complication is to efficiently represent sets of
characters in bracket expressions. The old bitmap representation is replaced
by a bitmap for the first 256 characters combined with a vector of individual
wide characters, a vector of character ranges (for [A-Z] etc.), and a vector
of character classes (for [[:alpha:]] etc.).

One other point of interest is that although the Boyer-Moore algorithm had
to be disabled in the general multibyte case, it is still enabled for UTF-8
because of its self-synchronizing nature. This greatly speeds up matching
by reducing the number of multibyte conversions that need to be done.
2004-07-12 07:35:59 +00:00
Tim J. Robbins
67aff1896c Add a new error code, REG_ILLSEQ, to indicate that a regular expression
contains an illegal multibyte character sequence.
2004-07-12 06:07:26 +00:00
Tim J. Robbins
80f363668e Remove incomplete support for multi-character collating elements. Remove
unused character category calculations.
2004-07-11 05:58:31 +00:00
Tim J. Robbins
65b2e19ef7 Document incorrect handling of multibyte characters. 2004-07-06 09:20:51 +00:00
Ruslan Ermilov
1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Jacques Vidrine
e0554a531f Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by:	/sbin/md5
2003-02-16 17:29:11 +00:00
Ruslan Ermilov
2efeeba554 mdoc(7) police: "The .Fa argument.". 2002-12-19 09:40:28 +00:00
Ruslan Ermilov
1fae73b137 mdoc(7) police: "The .Fn function". 2002-12-18 12:45:11 +00:00
Ruslan Ermilov
c51d717f0c libc_r wasn't so tied to libc for 22 months. 2002-11-18 09:50:57 +00:00
Mike Barcroft
4047df8d24 Add restrict type-qualifier. 2002-10-02 07:49:35 +00:00
Philippe Charnier
7fed38d0a0 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
David E. O'Brien
1114a754ed Fix the style of the SCM ID's.
I believe have made all of libc .h's as consistent as possible.
2002-03-22 23:42:05 +00:00
David E. O'Brien
333fc21e3c Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
David E. O'Brien
4b74b09895 Back out last commit (rev 1.2). I thought I caught this file in time
when deP'ing.  But I guess not.
2002-03-22 19:45:43 +00:00
David E. O'Brien
c05ac53b8b Remove __P() usage. 2002-03-21 22:49:10 +00:00
David E. O'Brien
8fb3f3f682 Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
Ruslan Ermilov
0c7f152b7b Fix a typo I made in revision 1.5.
Submitted by:	trevor
2002-01-22 12:38:43 +00:00
Daniel C. Sobral
8e2f75b833 The algorithm that computes the tables used in the BM search algorithm sometimes
access an array beyond it's length. This only happens in the last iteration of
a loop, and the value fetched is not used then, so the bug is a relatively
innocent one. Fix this by not fetching any value on the last iteration of said
loop.

Submitted by:	MKI <mki@mozone.net>
MFC after:	1 week
2001-11-09 10:17:44 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov
57e4378bf6 mdoc(7) police: protect trailing full stops of abbreviations
with a trailing zero-width space: `e.g.\&'.
2001-08-10 13:45:36 +00:00
Ruslan Ermilov
c4d9468ea0 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ruslan Ermilov
4a558355e5 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
Ruslan Ermilov
3fe5c3c9aa mdoc(7) police: fixed the weird construct. 2001-02-09 09:08:53 +00:00
Ruslan Ermilov
794b517fa4 man(7) -> mdoc(7). 2001-01-12 13:35:17 +00:00
Ruslan Ermilov
4263595653 Prepare for mdoc(7)NG. 2000-12-29 14:08:20 +00:00
Ruslan Ermilov
55d8033fb4 Replace a dagger' sign with a double dagger' one.
The former looks ugly on grotty(1) devices.
2000-11-16 11:22:42 +00:00
Ruslan Ermilov
855ac919f1 Convert this from -man to -mdoc. 2000-11-14 16:47:54 +00:00
Brian Feldman
c98c98a822 Actually make it so this Makefile can build grot. 2000-07-10 06:10:47 +00:00
Daniel C. Sobral
beea813ee4 Add a test case for one of the bugs found on the new additions to
regex(3).
2000-07-09 18:14:39 +00:00
Daniel C. Sobral
8ca5c256cb Spencer's regex(3) test code.
Obtained from: BSD/OS
2000-07-09 18:13:35 +00:00
Daniel C. Sobral
8f9e434f46 altoffset() always returned whenever it recursed, because at the end
of the processing of the recursion, "scan" would be pointing to O_CH
(or O_QUEST), which would then be interpreted as being the end character
for altoffset().

We avoid this by properly increasing scan before leaving the switch.

Without this, something like (a?b?)?cc would result in a g->moffset of
1 instead of 2.

I added a case to the soon-to-be-imported regex(3) test code to catch
this error.
2000-07-09 17:45:30 +00:00
Daniel C. Sobral
b6c1a56180 Since g->moffset points to the _maximum_ offset at which the must
string may be found (from the beginning of the pattern), the point
at which must is found minus that offset may actually point to some
place before the start of the text.

In that case, make start = start.

Alternatively, this could be tested for in the preceding if, but it
did not occur to me. :-)

Caught by: regex(3) test code
2000-07-09 17:36:53 +00:00