Revision: 1214
http://vcs.pcre.org/viewvc?view=rev&revision=1214
Author: ph10
Date: 2012-11-08 17:03:43 +0000 (Thu, 08 Nov 2012)
Log Message:
-----------
Some 16/32 bit documentation updates. Also, undocument what happens to invalid
unchecked UTF-8 strings.
Modified Paths:
--------------
code/trunk/doc/pcre16.3
code/trunk/doc/pcre32.3
code/trunk/doc/pcreapi.3
code/trunk/doc/pcreunicode.3
Modified: code/trunk/doc/pcre16.3
===================================================================
--- code/trunk/doc/pcre16.3 2012-11-07 17:29:40 UTC (rev 1213)
+++ code/trunk/doc/pcre16.3 2012-11-08 17:03:43 UTC (rev 1214)
@@ -1,4 +1,4 @@
-.TH PCRE 3 "14 April 2012" "PCRE 8.31"
+.TH PCRE 3 "08 November 2012" "PCRE 8.32"
.SH NAME
PCRE - Perl-compatible regular expressions
.sp
@@ -170,7 +170,7 @@
.rs
.sp
There is only one header file, \fBpcre.h\fP. It contains prototypes for all the
-functions in both libraries, as well as definitions of flags, structures, error
+functions in all libraries, as well as definitions of flags, structures, error
codes, etc.
.
.
@@ -190,9 +190,9 @@
vectors of unsigned 16-bit quantities. The macro PCRE_UCHAR16 specifies an
appropriate data type, and PCRE_SPTR16 is defined as "const PCRE_UCHAR16 *". In
very many environments, "short int" is a 16-bit data type. When PCRE is built,
-it defines PCRE_UCHAR16 as "short int", but checks that it really is a 16-bit
-data type. If it is not, the build fails with an error message telling the
-maintainer to modify the definition appropriately.
+it defines PCRE_UCHAR16 as "unsigned short int", but checks that it really is a
+16-bit data type. If it is not, the build fails with an error message telling
+the maintainer to modify the definition appropriately.
.
.
.SH "STRUCTURE TYPES"
@@ -385,6 +385,6 @@
.rs
.sp
.nf
-Last updated: 14 April 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi
Modified: code/trunk/doc/pcre32.3
===================================================================
--- code/trunk/doc/pcre32.3 2012-11-07 17:29:40 UTC (rev 1213)
+++ code/trunk/doc/pcre32.3 2012-11-08 17:03:43 UTC (rev 1214)
@@ -1,4 +1,4 @@
-.TH PCRE 3 "24 June 2012" "PCRE 8.31"
+.TH PCRE 3 "08 November 2012" "PCRE 8.32"
.SH NAME
PCRE - Perl-compatible regular expressions
.sp
@@ -170,7 +170,7 @@
.rs
.sp
There is only one header file, \fBpcre.h\fP. It contains prototypes for all the
-functions in both libraries, as well as definitions of flags, structures, error
+functions in all libraries, as well as definitions of flags, structures, error
codes, etc.
.
.
@@ -189,10 +189,10 @@
of bytes with the C type "char *". In the 32-bit library, strings are passed as
vectors of unsigned 32-bit quantities. The macro PCRE_UCHAR32 specifies an
appropriate data type, and PCRE_SPTR32 is defined as "const PCRE_UCHAR32 *". In
-very many environments, "unsigned int" is a 32-bit data type. When PCRE is built,
-it defines PCRE_UCHAR32 as "unsigned int", but checks that it really is a 32-bit
-data type. If it is not, the build fails with an error message telling the
-maintainer to modify the definition appropriately.
+very many environments, "unsigned int" is a 32-bit data type. When PCRE is
+built, it defines PCRE_UCHAR32 as "unsigned int", but checks that it really is
+a 32-bit data type. If it is not, the build fails with an error message telling
+the maintainer to modify the definition appropriately.
.
.
.SH "STRUCTURE TYPES"
@@ -384,6 +384,6 @@
.rs
.sp
.nf
-Last updated: 24 June 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi
Modified: code/trunk/doc/pcreapi.3
===================================================================
--- code/trunk/doc/pcreapi.3 2012-11-07 17:29:40 UTC (rev 1213)
+++ code/trunk/doc/pcreapi.3 2012-11-08 17:03:43 UTC (rev 1214)
@@ -1,4 +1,4 @@
-.TH PCREAPI 3 "31 October 2012" "PCRE 8.32"
+.TH PCREAPI 3 "08 November 2012" "PCRE 8.32"
.SH NAME
PCRE - Perl-compatible regular expressions
.sp
@@ -142,15 +142,15 @@
.B int (*pcre_callout)(pcre_callout_block *);
.
.
-.SH "PCRE 8-BIT, 16-BIT AND 32-BIT LIBRARIES"
+.SH "PCRE 8-BIT, 16-BIT, AND 32-BIT LIBRARIES"
.rs
.sp
-From release 8.30, PCRE can be compiled as a library for handling 16-bit
-character strings as well as, or instead of, the original library that handles
-8-bit character strings. From release 8.32, PCRE can also be compiled as a
-library for handling 32-bit character strings. To avoid too much complication,
-this document describes the 8-bit versions of the functions, with only
-occasional references to the 16-bit and 32-bit libraries.
+As well as support for 8-bit character strings, PCRE also supports 16-bit
+strings (from release 8.30) and 32-bit strings (from release 8.32), by means of
+two additional libraries. They can be built as well as, or instead of, the
+8-bit library. To avoid too much complication, this document describes the
+8-bit versions of the functions, with only occasional references to the 16-bit
+and 32-bit libraries.
.P
The 16-bit and 32-bit functions operate in the same way as their 8-bit
counterparts; they just use different data types for their arguments and
@@ -2267,15 +2267,15 @@
.rs
.sp
This section applies only to the 8-bit library. The corresponding information
-for the 16-bit library is given in the
+for the 16-bit and 32-bit libraries is given in the
.\" HREF
\fBpcre16\fP
.\"
-page. The corresponding information for the 32-bit library is given in the
+and
.\" HREF
\fBpcre32\fP
.\"
-page.
+pages.
.P
When \fBpcre_exec()\fP returns either PCRE_ERROR_BADUTF8 or
PCRE_ERROR_SHORTUTF8, and the size of the output vector (\fIovecsize\fP) is at
@@ -2818,6 +2818,6 @@
.rs
.sp
.nf
-Last updated: 31 October 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi
Modified: code/trunk/doc/pcreunicode.3
===================================================================
--- code/trunk/doc/pcreunicode.3 2012-11-07 17:29:40 UTC (rev 1213)
+++ code/trunk/doc/pcreunicode.3 2012-11-08 17:03:43 UTC (rev 1214)
@@ -1,17 +1,14 @@
-.TH PCREUNICODE 3 "25 September 2012" "PCRE 8.32"
+.TH PCREUNICODE 3 "08 November 2012" "PCRE 8.32"
.SH NAME
PCRE - Perl-compatible regular expressions
-.SH "UTF-8, UTF-16, AND UNICODE PROPERTY SUPPORT"
+.SH "UTF-8, UTF-16, UTF-32, AND UNICODE PROPERTY SUPPORT"
.rs
.sp
-From Release 8.30, in addition to its previous UTF-8 support, PCRE also
-supports UTF-16 by means of a separate 16-bit library. This can be built as
-well as, or instead of, the 8-bit library.
-.P
-From Release 8.32, in addition to its previous UTF-8 and UTF-16 support,
-PCRE also supports UTF-32 by means of a separate 32-bit library. This can be
-built as well as, or instead of, the 8-bit and 16-bit libraries.
+As well as UTF-8 support, PCRE also supports UTF-16 (from release 8.30) and
+UTF-32 (from release 8.32), by means of two additional libraries. They can be
+built as well as, or instead of, the 8-bit library.
.
+.
.SH "UTF-8 SUPPORT"
.rs
.sp
@@ -23,37 +20,26 @@
with the PCRE_UTF8 option flag, or the pattern must start with the sequence
(*UTF8). When either of these is the case, both the pattern and any subject
strings that are matched against it are treated as UTF-8 strings instead of
-strings of 1-byte characters.
+strings of individual 1-byte characters.
.
.
-.SH "UTF-16 SUPPORT"
+.SH "UTF-16 AND UTF-32 SUPPORT"
.rs
.sp
-In order process UTF-16 strings, you must build PCRE's 16-bit library with UTF
-support, and, in addition, you must call
-.\" HTML <a href="pcre_compile.html">
-.\" </a>
+In order process UTF-16 or UTF-32 strings, you must build PCRE's 16-bit or
+32-bit library with UTF support, and, in addition, you must call
+.\" HREF
\fBpcre16_compile()\fP
.\"
-with the PCRE_UTF16 option flag, or the pattern must start with the sequence
-(*UTF16). When either of these is the case, both the pattern and any subject
-strings that are matched against it are treated as UTF-16 strings instead of
-strings of 16-bit characters.
-.
-.
-.SH "UTF-32 SUPPORT"
-.rs
-.sp
-In order process UTF-32 strings, you must build PCRE's 32-bit library with UTF
-support, and, in addition, you must call
-.\" HTML <a href="pcre_compile.html">
-.\" </a>
+or
+.\" HREF
\fBpcre32_compile()\fP
.\"
-with the PCRE_UTF32 option flag, or the pattern must start with the sequence
-(*UTF32). When either of these is the case, both the pattern and any subject
-strings that are matched against it are treated as UTF-32 strings instead of
-strings of 32-bit characters.
+with the PCRE_UTF16 or PCRE_UTF32 option flag, as appropriate. Alternatively,
+the pattern must start with the sequence (*UTF16) or (*UTF32). When UTF mode is
+set, both the pattern and any subject strings that are matched against it are
+treated as UTF-16 or UTF-32 strings instead of strings of individual 16-bit or
+32-bit characters.
.
.
.SH "UTF SUPPORT OVERHEAD"
@@ -72,10 +58,14 @@
The available properties that can be tested are limited to the general
category properties such as Lu for an upper case letter or Nd for a decimal
number, the Unicode script names such as Arabic or Han, and the derived
-properties Any and L&. A full list is given in the
+properties Any and L&. Full lists is given in the
.\" HREF
\fBpcrepattern\fP
.\"
+and
+.\" HREF
+\fBpcresyntax\fP
+.\"
documentation. Only the short names for properties are supported. For example,
\ep{L} matches a letter. Its Perl synonym, \ep{Letter}, is not supported.
Furthermore, in Perl, many properties may optionally be prefixed by "Is", for
@@ -93,15 +83,16 @@
which are themselves derived from the Unicode specification. Earlier releases
of PCRE followed the rules of RFC 2279, which allows the full range of 31-bit
values (0 to 0x7FFFFFFF). The current check allows only values in the range U+0
-to U+10FFFF, excluding the surrogate area, and the non-characters.
+to U+10FFFF, excluding the surrogate area and the non-characters.
.P
-Excluded code points are the "Surrogate Area" of Unicode. They are reserved
-for use by UTF-16, where they are used in pairs to encode codepoints with
-values greater than 0xFFFF. The code points that are encoded by UTF-16 pairs
-are available independently in the UTF-8 encoding. (In other words, the whole
-surrogate thing is a fudge for UTF-16 which unfortunately messes up UTF-8.)
+Characters in the "Surrogate Area" of Unicode are reserved for use by UTF-16,
+where they are used in pairs to encode codepoints with values greater than
+0xFFFF. The code points that are encoded by UTF-16 pairs are available
+independently in the UTF-8 and UTF-32 encodings. (In other words, the whole
+surrogate thing is a fudge for UTF-16 which unfortunately messes up UTF-8 and
+UTF-32.)
.P
-Also excluded are the "Non-Characters" code points, which are U+FDD0 to U+FDEF
+Also excluded are the "Non-Character" code points, which are U+FDD0 to U+FDEF
and the last two code points in each plane, U+??FFFE and U+??FFFF.
.P
If an invalid UTF-8 string is passed to PCRE, an error return is given. At
@@ -112,28 +103,18 @@
.P
In some situations, you may already know that your strings are valid, and
therefore want to skip these checks in order to improve performance, for
-example in the case of a long subject string that is being scanned repeatedly
-with different patterns. If you set the PCRE_NO_UTF8_CHECK flag at compile time
-or at run time, PCRE assumes that the pattern or subject it is given
-(respectively) contains only valid UTF-8 codes. In this case, it does not
-diagnose an invalid UTF-8 string.
+example in the case of a long subject string that is being scanned repeatedly.
+If you set the PCRE_NO_UTF8_CHECK flag at compile time or at run time, PCRE
+assumes that the pattern or subject it is given (respectively) contains only
+valid UTF-8 codes. In this case, it does not diagnose an invalid UTF-8 string.
.P
-If you pass an invalid UTF-8 string when PCRE_NO_UTF8_CHECK is set, what
-happens depends on why the string is invalid. If the string conforms to the
-"old" definition of UTF-8 (RFC 2279), it is processed as a string of characters
-in the range 0 to 0x7FFFFFFF by \fBpcre_dfa_exec()\fP and the interpreted
-version of \fBpcre_exec()\fP. In other words, apart from the initial validity
-test, these functions (when in UTF-8 mode) handle strings according to the more
-liberal rules of RFC 2279. However, the just-in-time (JIT) optimization for
-\fBpcre_exec()\fP supports only RFC 3629. If you are using JIT optimization, or
-if the string does not even conform to RFC 2279, the result is undefined. Your
-program may crash.
+Note that passing PCRE_NO_UTF8_CHECK to \fBpcre_compile()\fP just disables the
+check for the pattern; it does not also apply to subject strings. If you want
+to disable the check for a subject string you must pass this option to
+\fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP.
.P
-If you want to process strings of values in the full range 0 to 0x7FFFFFFF,
-encoded in a UTF-8-like manner as per the old RFC, you can set
-PCRE_NO_UTF8_CHECK to bypass the more restrictive test. However, in this
-situation, you will have to apply your own validity check, and avoid the use of
-JIT optimization.
+If you pass an invalid UTF-8 string when PCRE_NO_UTF8_CHECK is set, the result
+is undefined and your program may crash.
.
.
.\" HTML <a name="utf16strings"></a>
@@ -146,7 +127,7 @@
U+D800 to U+DFFF are independent code points. Values in the surrogate range
must be used in pairs in the correct manner.
.P
-Excluded are the "Non-Characters" code points, which are U+FDD0 to U+FDEF
+Excluded are the "Non-Character" code points, which are U+FDD0 to U+FDEF
and the last two code points in each plane, U+??FFFE and U+??FFFF.
.P
If an invalid UTF-16 string is passed to PCRE, an error return is given. At
@@ -160,6 +141,7 @@
the PCRE_NO_UTF16_CHECK flag at compile time or at run time, PCRE assumes that
the pattern or subject it is given (respectively) contains only valid UTF-16
sequences. In this case, it does not diagnose an invalid UTF-16 string.
+However, if an invalid string is passed, the result is undefined.
.
.
.\" HTML <a name="utf32strings"></a>
@@ -170,7 +152,7 @@
passed as patterns and subjects are (by default) checked for validity on entry
to the relevant functions. This check allows only values in the range U+0
to U+10FFFF, excluding the surrogate area U+D800 to U+DFFF, and the
-"Non-Characters" code points, which are U+FDD0 to U+FDEF and the last two
+"Non-Character" code points, which are U+FDD0 to U+FDEF and the last two
characters in each plane, U+??FFFE and U+??FFFF.
.P
If an invalid UTF-32 string is passed to PCRE, an error return is given. At
@@ -183,17 +165,18 @@
therefore want to skip these checks in order to improve performance. If you set
the PCRE_NO_UTF32_CHECK flag at compile time or at run time, PCRE assumes that
the pattern or subject it is given (respectively) contains only valid UTF-32
-sequences. In this case, it does not diagnose an invalid UTF-32 string.
+sequences. In this case, it does not diagnose an invalid UTF-32 string.
+However, if an invalid string is passed, the result is undefined.
.
.
.SS "General comments about UTF modes"
.rs
.sp
-1. Codepoints less than 256 can be specified by either braced or unbraced
-hexadecimal escape sequences (for example, \ex{b3} or \exb3). Larger values
-have to use braced sequences.
+1. Codepoints less than 256 can be specified in patterns by either braced or
+unbraced hexadecimal escape sequences (for example, \ex{b3} or \exb3). Larger
+values have to use braced sequences.
.P
-2. Octal numbers up to \e777 are recognized, and in UTF-8 mode, they match
+2. Octal numbers up to \e777 are recognized, and in UTF-8 mode they match
two-byte characters for values greater than \e177.
.P
3. Repeat quantifiers apply to complete UTF characters, not to individual
@@ -210,10 +193,10 @@
\fBpcrepattern\fP
.\"
documentation). The use of \eC is not supported in the alternative matching
-function \fBpcre[16|32]_dfa_exec()\fP, nor is it supported in UTF mode by the JIT
-optimization of \fBpcre[16|32]_exec()\fP. If JIT optimization is requested for a
-UTF pattern that contains \eC, it will not succeed, and so the matching will
-be carried out by the normal interpretive function.
+function \fBpcre[16|32]_dfa_exec()\fP, nor is it supported in UTF mode by the
+JIT optimization of \fBpcre[16|32]_exec()\fP. If JIT optimization is requested
+for a UTF pattern that contains \eC, it will not succeed, and so the matching
+will be carried out by the normal interpretive function.
.P
6. The character escapes \eb, \eB, \ed, \eD, \es, \eS, \ew, and \eW correctly
test characters of any code value, but, by default, the characters that PCRE
@@ -266,6 +249,6 @@
.rs
.sp
.nf
-Last updated: 25 September 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi