summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-11-08 17:03:43 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-11-08 17:03:43 +0000
commit234fdebdfcebbbdd1b00d2680a66c736585da759 (patch)
treec3bbff7949721d2841d8566f7231e39e3ffc13bb
parent8cb0e68c73ae1b461191501c1977684c4c408198 (diff)
downloadpcre-234fdebdfcebbbdd1b00d2680a66c736585da759.tar.gz
Some 16/32 bit documentation updates. Also, undocument what happens to invalid
unchecked UTF-8 strings. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1214 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--doc/pcre16.312
-rw-r--r--doc/pcre32.314
-rw-r--r--doc/pcreapi.324
-rw-r--r--doc/pcreunicode.3127
4 files changed, 80 insertions, 97 deletions
diff --git a/doc/pcre16.3 b/doc/pcre16.3
index 5af152c..2a63084 100644
--- a/doc/pcre16.3
+++ b/doc/pcre16.3
@@ -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 @@ library. For example, if you want to study a pattern that was compiled with
.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 @@ of bytes with the C type "char *". In the 16-bit library, strings are passed as
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 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 14 April 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi
diff --git a/doc/pcre32.3 b/doc/pcre32.3
index dc8dd8d..e8b284d 100644
--- a/doc/pcre32.3
+++ b/doc/pcre32.3
@@ -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 @@ study data with \fBpcre32_free_study()\fP.
.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 @@ In the 8-bit library, strings are passed to PCRE library functions as vectors
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 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 24 June 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi
diff --git a/doc/pcreapi.3 b/doc/pcreapi.3
index ddeb3da..e9e397c 100644
--- a/doc/pcreapi.3
+++ b/doc/pcreapi.3
@@ -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 @@ PCRE - Perl-compatible regular expressions
.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 @@ Error numbers -16 to -20, -22, and 30 are not used by \fBpcre_exec()\fP.
.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 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 31 October 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi
diff --git a/doc/pcreunicode.3 b/doc/pcreunicode.3
index f927cb7..79b31bd 100644
--- a/doc/pcreunicode.3
+++ b/doc/pcreunicode.3
@@ -1,16 +1,13 @@
-.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
@@ -23,37 +20,26 @@ support, and, in addition, you must call
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 @@ support), the escape sequences \ep{..}, \eP{..}, and \eX can be used.
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 @@ place. From release 7.3 of PCRE, the check is according the rules of RFC 3629,
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 @@ detailed reason code if the caller has provided memory in which to do this.
.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 @@ to the relevant functions. Values other than those in the surrogate range
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 @@ therefore want to skip these checks in order to improve performance. If you set
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 @@ When you set the PCRE_UTF32 flag, the strings of 32-bit data units that are
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 @@ In some situations, you may already know that your strings are valid, and
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 @@ multi-unit characters (see the description of \eC in the
\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 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 25 September 2012
+Last updated: 08 November 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi