[Pcre-svn] [856] code/trunk: Documentation updates.

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [856] code/trunk: Documentation updates.
Revision: 856
          http://vcs.pcre.org/viewvc?view=rev&revision=856
Author:   ph10
Date:     2012-01-07 17:02:55 +0000 (Sat, 07 Jan 2012)


Log Message:
-----------
Documentation updates.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/PrepareRelease
    code/trunk/doc/pcre16.3
    code/trunk/doc/pcreapi.3


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-01-06 15:08:49 UTC (rev 855)
+++ code/trunk/ChangeLog    2012-01-07 17:02:55 UTC (rev 856)
@@ -7,8 +7,8 @@
 1.  Renamed "isnumber" as "is_a_number" because in some Mac environments this
     name is defined in ctype.h.


-2.  Fixed a bug in the code for calculating the fixed length of lookbehind
-    assertions.
+2.  Fixed a bug in fixed-length calculation for lookbehinds that would show up
+    only in quite long subpatterns.


 3.  Removed the function pcre_info(), which has been obsolete and deprecated
     since it was replaced by pcre_fullinfo() in February 2000.


Modified: code/trunk/PrepareRelease
===================================================================
--- code/trunk/PrepareRelease    2012-01-06 15:08:49 UTC (rev 855)
+++ code/trunk/PrepareRelease    2012-01-07 17:02:55 UTC (rev 856)
@@ -58,7 +58,7 @@
 End


 echo "Making pcre.txt"
-for file in pcre pcrebuild pcrematching pcreapi pcrecallout pcrecompat \
+for file in pcre pcre16 pcrebuild pcrematching pcreapi pcrecallout pcrecompat \
             pcrepattern pcresyntax pcreunicode pcrejit pcrepartial \
             pcreprecompile pcreperform pcreposix pcrecpp pcresample \
             pcrelimits pcrestack ; do


Modified: code/trunk/doc/pcre16.3
===================================================================
--- code/trunk/doc/pcre16.3    2012-01-06 15:08:49 UTC (rev 855)
+++ code/trunk/doc/pcre16.3    2012-01-07 17:02:55 UTC (rev 856)
@@ -1,11 +1,13 @@
 .TH PCRE 3
 .SH NAME
 PCRE - Perl-compatible regular expressions
+.sp
+.B #include <pcre.h>
+.
+.
 .SH "PCRE 16-BIT API BASIC FUNCTIONS"
 .rs
 .sp
-.B #include <pcre16.h>
-.PP
 .SM
 .B pcre16 *pcre16_compile(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
 .ti +5n
@@ -32,19 +34,7 @@
 .B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
 .ti +5n
 .B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
-.
-.
-.SH "PCRE 16-BIT API AUXILIARY FUNCTIONS"
-.rs
-.sp
-.B pcre16_jit_stack *pcre16_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
 .PP
-.B void pcre16_jit_stack_free(pcre16_jit_stack *\fIstack\fP);
-.PP
-.B void pcre16_assign_jit_stack(pcre16_extra *\fIextra\fP,
-.ti +5n
-.B pcre16_jit_callback \fIcallback\fP, void *\fIdata\fP);
-.PP
 .B int pcre16_dfa_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
 .ti +5n
 .B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
@@ -52,7 +42,11 @@
 .B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
 .ti +5n
 .B int *\fIworkspace\fP, int \fIwscount\fP);
-.PP
+.
+.
+.SH "PCRE 16-BIT API STRING EXTRACTION FUNCTIONS"
+.rs
+.sp
 .B int pcre16_copy_named_substring(const pcre16 *\fIcode\fP,
 .ti +5n
 .B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
@@ -96,7 +90,19 @@
 .B void pcre16_free_substring(PCRE_SPTR16 \fIstringptr\fP);
 .PP
 .B void pcre16_free_substring_list(PCRE_SPTR16 *\fIstringptr\fP);
+.
+.
+.SH "PCRE 16-BIT API AUXILIARY FUNCTIONS"
+.rs
+.sp
+.B pcre16_jit_stack *pcre16_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
 .PP
+.B void pcre16_jit_stack_free(pcre16_jit_stack *\fIstack\fP);
+.PP
+.B void pcre16_assign_jit_stack(pcre16_extra *\fIextra\fP,
+.ti +5n
+.B pcre16_jit_callback \fIcallback\fP, void *\fIdata\fP);
+.PP
 .B const unsigned char *pcre16_maketables(void);
 .PP
 .B int pcre16_fullinfo(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
@@ -108,6 +114,10 @@
 .B int pcre16_config(int \fIwhat\fP, void *\fIwhere\fP);
 .PP
 .B const char *pcre16_version(void);
+.PP
+.B int pcre16_pattern_to_host_byte_order(pcre16 *\fIcode\fP,
+.ti +5n
+.B pcre16_extra *\fIextra\fP, const unsigned char *\fItables\fP);
 .
 .
 .SH "PCRE 16-BIT API INDIRECTED FUNCTIONS"
@@ -209,8 +219,9 @@
 other 16-bit functions expect the strings they are passed to be in host byte 
 order. 
 .P
-The \fIlength\fP argument specifies the number of 16-bit data units in the
-input string; a negative value specifies a zero-terminated string.
+The \fIlength\fP argument of \fBpcre16_utf16_to_host_byte_order()\fP specifies
+the number of 16-bit data units in the input string; a negative value specifies
+a zero-terminated string.
 .P
 If \fIbyte_order\fP is NULL, it is assumed that the string starts off in host 
 byte order. This may be changed by byte-order marks (BOMs) anywhere in the
@@ -359,6 +370,6 @@
 .rs
 .sp
 .nf
-Last updated: 06 January 2012
+Last updated: 07 January 2012
 Copyright (c) 1997-2012 University of Cambridge.
 .fi


Modified: code/trunk/doc/pcreapi.3
===================================================================
--- code/trunk/doc/pcreapi.3    2012-01-06 15:08:49 UTC (rev 855)
+++ code/trunk/doc/pcreapi.3    2012-01-07 17:02:55 UTC (rev 856)
@@ -1,11 +1,13 @@
 .TH PCREAPI 3
 .SH NAME
 PCRE - Perl-compatible regular expressions
+.sp
+.B #include <pcre.h>
+.
+.
 .SH "PCRE NATIVE API BASIC FUNCTIONS"
 .rs
 .sp
-.B #include <pcre.h>
-.PP
 .SM
 .B pcre *pcre_compile(const char *\fIpattern\fP, int \fIoptions\fP,
 .ti +5n
@@ -32,19 +34,7 @@
 .B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
 .ti +5n
 .B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
-.
-.
-.SH "PCRE NATIVE API AUXILIARY FUNCTIONS"
-.rs
-.sp
-.B pcre_jit_stack *pcre_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
 .PP
-.B void pcre_jit_stack_free(pcre_jit_stack *\fIstack\fP);
-.PP
-.B void pcre_assign_jit_stack(pcre_extra *\fIextra\fP,
-.ti +5n
-.B pcre_jit_callback \fIcallback\fP, void *\fIdata\fP);
-.PP
 .B int pcre_dfa_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
@@ -52,7 +42,11 @@
 .B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
 .ti +5n
 .B int *\fIworkspace\fP, int \fIwscount\fP);
-.PP
+.
+.
+.SH "PCRE NATIVE API STRING EXTRACTION FUNCTIONS"
+.rs
+.sp
 .B int pcre_copy_named_substring(const pcre *\fIcode\fP,
 .ti +5n
 .B const char *\fIsubject\fP, int *\fIovector\fP,
@@ -96,21 +90,34 @@
 .B void pcre_free_substring(const char *\fIstringptr\fP);
 .PP
 .B void pcre_free_substring_list(const char **\fIstringptr\fP);
+.
+.
+.SH "PCRE NATIVE API AUXILIARY FUNCTIONS"
+.rs
+.sp
+.B pcre_jit_stack *pcre_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
 .PP
+.B void pcre_jit_stack_free(pcre_jit_stack *\fIstack\fP);
+.PP
+.B void pcre_assign_jit_stack(pcre_extra *\fIextra\fP,
+.ti +5n
+.B pcre_jit_callback \fIcallback\fP, void *\fIdata\fP);
+.PP
 .B const unsigned char *pcre_maketables(void);
 .PP
 .B int pcre_fullinfo(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
 .ti +5n
 .B int \fIwhat\fP, void *\fIwhere\fP);
 .PP
-.B int pcre_info(const pcre *\fIcode\fP, int *\fIoptptr\fP, int
-.B *\fIfirstcharptr\fP);
-.PP
 .B int pcre_refcount(pcre *\fIcode\fP, int \fIadjust\fP);
 .PP
 .B int pcre_config(int \fIwhat\fP, void *\fIwhere\fP);
 .PP
-.B char *pcre_version(void);
+.B const char *pcre_version(void);
+.PP
+.B int pcre_pattern_to_host_byte_order(pcre *\fIcode\fP,
+.ti +5n
+.B pcre_extra *\fIextra\fP, const unsigned char *\fItables\fP);
 .
 .
 .SH "PCRE NATIVE API INDIRECTED FUNCTIONS"
@@ -127,29 +134,57 @@
 .B int (*pcre_callout)(pcre_callout_block *);
 .
 .
+.SH "PCRE 8-BIT AND 16-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. To avoid too much complication, this document
+describes the 8-bit versions of the functions, with only occasional references
+to the 16-bit library.
+.P
+The 16-bit functions operate in the same way as their 8-bit counterparts; they
+just use different data types for their arguments and results, and their names
+start with \fBpcre16_\fP instead of \fBpcre_\fP. For every option that has UTF8
+in its name (for example, PCRE_UTF8), there is a corresponding 16-bit name with
+UTF8 replaced by UTF16. This facility is in fact just cosmetic; the 16-bit
+option names define the same bit values. 
+.P
+References to bytes and UTF-8 in this document should be read as references to
+16-bit data quantities and UTF-16 when using the 16-bit library, unless
+specified otherwise. More details of the specific differences for the 16-bit
+library are given in the
+.\" HREF
+\fBpcre16\fP
+.\"
+page. 
+.
+.
 .SH "PCRE API OVERVIEW"
 .rs
 .sp
 PCRE has its own native API, which is described in this document. There are
-also some wrapper functions that correspond to the POSIX regular expression
-API, but they do not give access to all the functionality. They are described
-in the
+also some wrapper functions (for the 8-bit library only) that correspond to the
+POSIX regular expression API, but they do not give access to all the
+functionality. They are described in the
 .\" HREF
 \fBpcreposix\fP
 .\"
 documentation. Both of these APIs define a set of C function calls. A C++
-wrapper is also distributed with PCRE. It is documented in the
+wrapper (again for the 8-bit library only) is also distributed with PCRE. It is
+documented in the
 .\" HREF
 \fBpcrecpp\fP
 .\"
 page.
 .P
 The native API C function prototypes are defined in the header file
-\fBpcre.h\fP, and on Unix systems the library itself is called \fBlibpcre\fP.
-It can normally be accessed by adding \fB-lpcre\fP to the command for linking
-an application that uses PCRE. The header file defines the macros PCRE_MAJOR
-and PCRE_MINOR to contain the major and minor release numbers for the library.
-Applications can use these to include support for different releases of PCRE.
+\fBpcre.h\fP, and on Unix-like systems the (8-bit) library itself is called
+\fBlibpcre\fP. It can normally be accessed by adding \fB-lpcre\fP to the
+command for linking an application that uses PCRE. The header file defines the
+macros PCRE_MAJOR and PCRE_MINOR to contain the major and minor release numbers
+for the library. Applications can use these to include support for different
+releases of PCRE.
 .P
 In a Windows environment, if you want to statically link an application program
 against a non-dll \fBpcre.a\fP file, you must define PCRE_STATIC before
@@ -218,10 +253,8 @@
 internal tables that are generated when PCRE is built are used.
 .P
 The function \fBpcre_fullinfo()\fP is used to find out information about a
-compiled pattern; \fBpcre_info()\fP is an obsolete version that returns only
-some of the available information, but is retained for backwards compatibility.
-The function \fBpcre_version()\fP returns a pointer to a string containing the
-version of PCRE and its date of release.
+compiled pattern. The function \fBpcre_version()\fP returns a pointer to a
+string containing the version of PCRE and its date of release.
 .P
 The function \fBpcre_refcount()\fP maintains a reference count in a data block
 containing a compiled pattern. This is provided for the benefit of
@@ -332,9 +365,10 @@
 .\" HREF
 \fBpcreprecompile\fP
 .\"
-documentation. However, compiling a regular expression with one version of PCRE
-for use with a different version is not guaranteed to work and may cause
-crashes.
+documentation, which includes a description of the
+\fBpcre_pattern_to_host_byte_order()\fP function. However, compiling a regular
+expression with one version of PCRE for use with a different version is not
+guaranteed to work and may cause crashes.
 .
 .
 .SH "CHECKING BUILD-TIME OPTIONS"
@@ -351,13 +385,23 @@
 .P
 The first argument for \fBpcre_config()\fP is an integer, specifying which
 information is required; the second argument is a pointer to a variable into
-which the information is placed. The following information is available:
+which the information is placed. The returned value is zero on success, or the
+negative error code PCRE_ERROR_BADOPTION if the value in the first argument is
+not recognized. The following information is available:
 .sp
   PCRE_CONFIG_UTF8
 .sp
 The output is an integer that is set to one if UTF-8 support is available;
-otherwise it is set to zero.
+otherwise it is set to zero. If this option is given to the 16-bit version of 
+this function, \fBpcre16_config()\fP, the result is PCRE_ERROR_BADOPTION.
 .sp
+  PCRE_CONFIG_UTF16
+.sp
+The output is an integer that is set to one if UTF-16 support is available;
+otherwise it is set to zero. This value should normally be given to the 16-bit
+version of this function, \fBpcre16_config()\fP. If it is given to the 8-bit
+version of this function, the result is PCRE_ERROR_BADOPTION.
+.sp
   PCRE_CONFIG_UNICODE_PROPERTIES
 .sp
 The output is an integer that is set to one if support for Unicode character
@@ -387,10 +431,12 @@
   PCRE_CONFIG_LINK_SIZE
 .sp
 The output is an integer that contains the number of bytes used for internal
-linkage in compiled regular expressions. The value is 2, 3, or 4. Larger values
-allow larger regular expressions to be compiled, at the expense of slower
-matching. The default value of 2 is sufficient for all but the most massive
-patterns, since it allows the compiled pattern to be up to 64K in size.
+linkage in compiled regular expressions. For the 8-bit library, the value can
+be 2, 3, or 4. For the 16-bit library, the value is either 2 or 4 and is still
+a number of bytes. The default value of 2 is sufficient for all but the most
+massive patterns, since it allows the compiled pattern to be up to 64K in size.
+Larger values allow larger regular expressions to be compiled, at the expense
+of slower matching.
 .sp
   PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
 .sp
@@ -484,12 +530,12 @@
 byte that was being processed when the error was discovered is placed in the
 variable pointed to by \fIerroffset\fP, which must not be NULL (if it is, an
 immediate error is given). However, for an invalid UTF-8 string, the offset is
-that of the first byte of the failing character. Also, some errors are not
-detected until checks are carried out when the whole pattern has been scanned;
-in these cases the offset passed back is the length of the pattern.
+that of the first byte of the failing character.
 .P
-Note that the offset is in bytes, not characters, even in UTF-8 mode. It may
-sometimes point into the middle of a UTF-8 character.
+Some errors are not detected until the whole pattern has been scanned; in these
+cases, the offset passed back is the length of the pattern. Note that the
+offset is in bytes, not characters, even in UTF-8 mode. It may sometimes point
+into the middle of a UTF-8 character.
 .P
 If \fBpcre_compile2()\fP is used instead of \fBpcre_compile()\fP, and the
 \fIerrorcodeptr\fP argument is not NULL, a non-zero error code number is
@@ -689,8 +735,8 @@
 that any Unicode newline sequence should be recognized. The Unicode newline
 sequences are the three just mentioned, plus the single characters VT (vertical
 tab, U+000B), FF (formfeed, U+000C), NEL (next line, U+0085), LS (line
-separator, U+2028), and PS (paragraph separator, U+2029). The last two are
-recognized only in UTF-8 mode.
+separator, U+2028), and PS (paragraph separator, U+2029). For the 8-bit 
+library, the last two are recognized only in UTF-8 mode.
 .P
 The newline setting in the options word uses three bits that are treated
 as a number, giving eight possibilities. Currently only six are used (default
@@ -755,10 +801,10 @@
   PCRE_UTF8
 .sp
 This option causes PCRE to regard both the pattern and the subject as strings
-of UTF-8 characters instead of single-byte character strings. However, it is
-available only when PCRE is built to include UTF-8 support. If not, the use
-of this option provokes an error. Details of how this option changes the
-behaviour of PCRE are given in the
+of UTF-8 characters instead of single-byte strings. However, it is available
+only when PCRE is built to include UTF support. If not, the use of this option
+provokes an error. Details of how this option changes the behaviour of PCRE are
+given in the
 .\" HREF
 \fBpcreunicode\fP
 .\"
@@ -766,23 +812,23 @@
 .sp
   PCRE_NO_UTF8_CHECK
 .sp
-When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
-automatically checked. There is a discussion about the
-.\" HTML <a href="pcre.html#utf8strings">
+When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 
+string is automatically checked. There is a discussion about the
+.\" HTML <a href="pcreunicode.html#utf8strings">
 .\" </a>
-validity of UTF-8 strings
+validity of UTF-8 strings 
 .\"
-in the main
+in the
 .\" HREF
-\fBpcre\fP
+\fBpcreunicode\fP
 .\"
-page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_compile()\fP
-returns an error. If you already know that your pattern is valid, and you want
-to skip this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK
-option. When it is set, the effect of passing an invalid UTF-8 string as a
-pattern is undefined. It may cause your program to crash. Note that this option
-can also be passed to \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, to suppress
-the UTF-8 validity checking of subject strings.
+page. If an invalid UTF-8 sequence is found, \fBpcre_compile()\fP returns an
+error. If you already know that your pattern is valid, and you want to skip
+this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK option.
+When it is set, the effect of passing an invalid UTF-8 string as a pattern is
+undefined. It may cause your program to crash. Note that this option can also
+be passed to \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, to suppress the
+validity checking of subject strings.
 .
 .
 .SH "COMPILATION ERROR CODES"
@@ -790,8 +836,9 @@
 .sp
 The following table lists the error codes than may be returned by
 \fBpcre_compile2()\fP, along with the error messages that may be returned by
-both compiling functions. As PCRE has developed, some error codes have fallen
-out of use. To avoid confusion, they have not been re-used.
+both compiling functions. Note that error messages are always 8-bit ASCII 
+strings, even in 16-bit mode. As PCRE has developed, some error codes have
+fallen out of use. To avoid confusion, they have not been re-used.
 .sp
    0  no error
    1  \e at end of pattern
@@ -825,7 +872,7 @@
   29  (?R or (?[+-]digits must be followed by )
   30  unknown POSIX class name
   31  POSIX collating elements are not supported
-  32  this version of PCRE is not compiled with PCRE_UTF8 support
+  32  this version of PCRE is compiled without UTF support
   33  [this code is not in use]
   34  character value in \ex{...} sequence is too large
   35  invalid condition (?(0)
@@ -837,14 +884,14 @@
   41  unrecognized character after (?P
   42  syntax error in subpattern name (missing terminator)
   43  two named subpatterns have the same name
-  44  invalid UTF-8 string
+  44  invalid UTF-8 string (specifically UTF-8)
   45  support for \eP, \ep, and \eX has not been compiled
   46  malformed \eP or \ep sequence
   47  unknown property name after \eP or \ep
   48  subpattern name is too long (maximum 32 characters)
   49  too many named subpatterns (maximum 10000)
   50  [this code is not in use]
-  51  octal value is greater than \e377 (not in UTF-8 mode)
+  51  octal value is greater than \e377 in 8-bit non-UTF-8 mode
   52  internal error: overran compiling workspace
   53  internal error: previously-checked referenced subpattern
         not found
@@ -863,9 +910,15 @@
   65  different names for subpatterns of the same number are
         not allowed
   66  (*MARK) must have an argument
-  67  this version of PCRE is not compiled with PCRE_UCP support
+  67  this version of PCRE is not compiled with Unicode property 
+        support
   68  \ec must be followed by an ASCII character
   69  \ek is not followed by a braced, angle-bracketed, or quoted name
+  70  internal error: unknown opcode in find_fixedlength()
+  71  \eN is not supported in a class
+  72  too many forward references
+  73  disallowed Unicode code point (>= 0xd800 && <= 0xdfff)    
+  74  invalid UTF-16 string (specifically UTF-16)
 .sp
 The numbers 32 and 10000 in errors 48 and 49 are defaults; different values may
 be used if the limits were changed when PCRE was built.
@@ -962,7 +1015,7 @@
 Studying a pattern is also useful for non-anchored patterns that do not have a
 single fixed starting character. A bitmap of possible starting bytes is
 created. This speeds up finding a position in the subject at which to start
-matching.
+matching. (In 16-bit mode, the bitmap is used for 16-bit values less than 256.)
 .P
 These two optimizations apply to both \fBpcre_exec()\fP and
 \fBpcre_dfa_exec()\fP. However, they are not used by \fBpcre_exec()\fP if
@@ -985,14 +1038,15 @@
 .sp
 PCRE handles caseless matching, and determines whether characters are letters,
 digits, or whatever, by reference to a set of tables, indexed by character
-value. When running in UTF-8 mode, this applies only to characters with codes
-less than 128. By default, higher-valued codes never match escapes such as \ew
-or \ed, but they can be tested with \ep if PCRE is built with Unicode character
-property support. Alternatively, the PCRE_UCP option can be set at compile
-time; this causes \ew and friends to use Unicode property support instead of
-built-in tables. The use of locales with Unicode is discouraged. If you are
-handling characters with codes greater than 128, you should either use UTF-8
-and Unicode, or use locales, but not try to mix the two.
+value. When running in UTF-8 mode, this applies only to characters
+with codes less than 128. By default, higher-valued codes never match escapes
+such as \ew or \ed, but they can be tested with \ep if PCRE is built with
+Unicode character property support. Alternatively, the PCRE_UCP option can be
+set at compile time; this causes \ew and friends to use Unicode property
+support instead of built-in tables. The use of locales with Unicode is
+discouraged. If you are handling characters with codes greater than 128, you
+should either use UTF-8 and Unicode, or use locales, but not try to mix the
+two.
 .P
 PCRE contains an internal set of tables that are used when the final argument
 of \fBpcre_compile()\fP is NULL. These are sufficient for many applications.
@@ -1046,8 +1100,8 @@
 .B int \fIwhat\fP, void *\fIwhere\fP);
 .PP
 The \fBpcre_fullinfo()\fP function returns information about a compiled
-pattern. It replaces the obsolete \fBpcre_info()\fP function, which is
-nevertheless retained for backwards compability (and is documented below).
+pattern. It replaces the \fBpcre_info()\fP function, which was removed from the
+library at version 8.30, after more than 10 years of obsolescence.
 .P
 The first argument for \fBpcre_fullinfo()\fP is a pointer to the compiled
 pattern. The second argument is the result of \fBpcre_study()\fP, or NULL if
@@ -1056,14 +1110,18 @@
 to receive the data. The yield of the function is zero for success, or one of
 the following negative numbers:
 .sp
-  PCRE_ERROR_NULL       the argument \fIcode\fP was NULL
-                        the argument \fIwhere\fP was NULL
-  PCRE_ERROR_BADMAGIC   the "magic number" was not found
-  PCRE_ERROR_BADOPTION  the value of \fIwhat\fP was invalid
+  PCRE_ERROR_NULL           the argument \fIcode\fP was NULL
+                            the argument \fIwhere\fP was NULL
+  PCRE_ERROR_BADMAGIC       the "magic number" was not found
+  PCRE_ERROR_BADENDIANNESS  the pattern was compiled with different 
+                            endianness
+  PCRE_ERROR_BADOPTION      the value of \fIwhat\fP was invalid
 .sp
 The "magic number" is placed at the start of each compiled pattern as an simple
-check against passing an arbitrary memory pointer. Here is a typical call of
-\fBpcre_fullinfo()\fP, to obtain the length of the compiled pattern:
+check against passing an arbitrary memory pointer. The endianness error can 
+occur if a compiled pattern is saved and reloaded on a different host. Here is
+a typical call of \fBpcre_fullinfo()\fP, to obtain the length of the compiled
+pattern:
 .sp
   int rc;
   size_t length;
@@ -1097,13 +1155,17 @@
 .sp
   PCRE_INFO_FIRSTBYTE
 .sp
-Return information about the first byte of any matched string, for a
-non-anchored pattern. The fourth argument should point to an \fBint\fP
-variable. (This option used to be called PCRE_INFO_FIRSTCHAR; the old name is
-still recognized for backwards compatibility.)
+Return information about the first data unit of any matched string, for a
+non-anchored pattern. (The name of this option refers to the 8-bit library,
+where data units are bytes.) The fourth argument should point to an \fBint\fP
+variable.
 .P
-If there is a fixed first byte, for example, from a pattern such as
-(cat|cow|coyote), its value is returned. Otherwise, if either
+If there is a fixed first value, for example, the letter "c" from a pattern
+such as (cat|cow|coyote), its value is returned. In the 8-bit library, the 
+value is always less than 256; in the 16-bit library the value can be up to 
+0xffff.
+.P
+If there is no fixed first value, and if either
 .sp
 (a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
 starts with "^", or
@@ -1118,7 +1180,7 @@
   PCRE_INFO_FIRSTTABLE
 .sp
 If the pattern was studied, and this resulted in the construction of a 256-bit
-table indicating a fixed set of bytes for the first byte in any matching
+table indicating a fixed set of values for the first data unit in any matching
 string, a pointer to the table is returned. Otherwise NULL is returned. The
 fourth argument should point to an \fBunsigned char *\fP variable.
 .sp
@@ -1155,11 +1217,11 @@
 .sp
   PCRE_INFO_LASTLITERAL
 .sp
-Return the value of the rightmost literal byte that must exist in any matched
-string, other than at its start, if such a byte has been recorded. The fourth
-argument should point to an \fBint\fP variable. If there is no such byte, -1 is
-returned. For anchored patterns, a last literal byte is recorded only if it
-follows something of variable length. For example, for the pattern
+Return the value of the rightmost literal data unit that must exist in any
+matched string, other than at its start, if such a value has been recorded. The
+fourth argument should point to an \fBint\fP variable. If there is no such
+value, -1 is returned. For anchored patterns, a last literal value is recorded
+only if it follows something of variable length. For example, for the pattern
 /^a\ed+z\ed+/ the returned value is "z", but for /^a\edz\ed/ the returned value
 is -1.
 .sp
@@ -1167,8 +1229,8 @@
 .sp
 If the pattern was studied and a minimum length for matching subject strings
 was computed, its value is returned. Otherwise the returned value is -1. The
-value is a number of characters, not bytes (this may be relevant in UTF-8
-mode). The fourth argument should point to an \fBint\fP variable. A
+value is a number of characters, which in UTF-8 mode may be different from the
+number of bytes. The fourth argument should point to an \fBint\fP variable. A
 non-negative value is a lower bound to the length of any matching string. There
 may not be any strings of that length that do actually match, but every string
 that does match is at least that long.
@@ -1191,9 +1253,11 @@
 the number of entries, and PCRE_INFO_NAMEENTRYSIZE gives the size of each
 entry; both of these return an \fBint\fP value. The entry size depends on the
 length of the longest name. PCRE_INFO_NAMETABLE returns a pointer to the first
-entry of the table (a pointer to \fBchar\fP). The first two bytes of each entry
-are the number of the capturing parenthesis, most significant byte first. The
-rest of the entry is the corresponding name, zero terminated.
+entry of the table. This is a pointer to \fBchar\fP in the 8-bit library, where
+the first two bytes of each entry are the number of the capturing parenthesis,
+most significant byte first. In the 16-bit library, the pointer points to
+16-bit data units, the first of which contains the parenthesis number. The rest
+of the entry is the corresponding name, zero terminated.
 .P
 The names are in alphabetical order. Duplicate names may appear if (?| is used
 to create multiple groups with the same number, as described in the
@@ -1212,8 +1276,8 @@
 necessarily the case because later subpatterns may have lower numbers.
 .P
 As a simple example of the name/number table, consider the following pattern
-(assume PCRE_EXTENDED is set, so white space - including newlines - is
-ignored):
+after compilation by the 8-bit library (assume PCRE_EXTENDED is set, so white
+space - including newlines - is ignored):
 .sp
 .\" JOIN
   (?<date> (?<year>(\ed\ed)?\ed\ed) -
@@ -1268,21 +1332,22 @@
 .sp
   PCRE_INFO_SIZE
 .sp
-Return the size of the compiled pattern. The fourth argument should point to a
-\fBsize_t\fP variable. This value does not include the size of the \fBpcre\fP
-structure that is returned by \fBpcre_compile()\fP. The value that is passed as
-the argument to \fBpcre_malloc()\fP when \fBpcre_compile()\fP is getting memory
-in which to place the compiled data is the value returned by this option plus
-the size of the \fBpcre\fP structure. Studying a compiled pattern, with or
-without JIT, does not alter the value returned by this option.
+Return the size of the compiled pattern in bytes (for both libraries). The
+fourth argument should point to a \fBsize_t\fP variable. This value does not
+include the size of the \fBpcre\fP structure that is returned by
+\fBpcre_compile()\fP. The value that is passed as the argument to
+\fBpcre_malloc()\fP when \fBpcre_compile()\fP is getting memory in which to
+place the compiled data is the value returned by this option plus the size of
+the \fBpcre\fP structure. Studying a compiled pattern, with or without JIT,
+does not alter the value returned by this option.
 .sp
   PCRE_INFO_STUDYSIZE
 .sp
-Return the size of the data block pointed to by the \fIstudy_data\fP field in a
-\fBpcre_extra\fP block. If \fBpcre_extra\fP is NULL, or there is no study data,
-zero is returned. The fourth argument should point to a \fBsize_t\fP variable.
-The \fIstudy_data\fP field is set by \fBpcre_study()\fP to record information
-that will speed up matching (see the section entitled
+Return the size in bytes of the data block pointed to by the \fIstudy_data\fP
+field in a \fBpcre_extra\fP block. If \fBpcre_extra\fP is NULL, or there is no
+study data, zero is returned. The fourth argument should point to a
+\fBsize_t\fP variable. The \fIstudy_data\fP field is set by \fBpcre_study()\fP
+to record information that will speed up matching (see the section entitled
 .\" HTML <a href="#studyingapattern">
 .\" </a>
 "Studying a pattern"
@@ -1295,30 +1360,6 @@
 documentation for details).
 .
 .
-.SH "OBSOLETE INFO FUNCTION"
-.rs
-.sp
-.B int pcre_info(const pcre *\fIcode\fP, int *\fIoptptr\fP, int
-.B *\fIfirstcharptr\fP);
-.PP
-The \fBpcre_info()\fP function is now obsolete because its interface is too
-restrictive to return all the available data about a compiled pattern. New
-programs should use \fBpcre_fullinfo()\fP instead. The yield of
-\fBpcre_info()\fP is the number of capturing subpatterns, or one of the
-following negative numbers:
-.sp
-  PCRE_ERROR_NULL       the argument \fIcode\fP was NULL
-  PCRE_ERROR_BADMAGIC   the "magic number" was not found
-.sp
-If the \fIoptptr\fP argument is not NULL, a copy of the options with which the
-pattern was compiled is placed in the integer it points to (see
-PCRE_INFO_OPTIONS above).
-.P
-If the pattern is not anchored and the \fIfirstcharptr\fP argument is not NULL,
-it is used to pass back information about the first character of any matched
-string (see PCRE_INFO_FIRSTBYTE above).
-.
-.
 .SH "REFERENCE COUNTS"
 .rs
 .sp
@@ -1411,6 +1452,9 @@
   const unsigned char *\fItables\fP;
   unsigned char **\fImark\fP;
 .sp
+In the 16-bit version of this structure, the \fImark\fP field has type 
+"PCRE_SCHAR16 **".
+.P
 The \fIflags\fP field is a bitmap that specifies which of the other fields
 are set. The flag bits are:
 .sp
@@ -1495,13 +1539,13 @@
 documentation for a discussion of saving compiled patterns for later use.
 .P
 If PCRE_EXTRA_MARK is set in the \fIflags\fP field, the \fImark\fP field must
-be set to point to a \fBchar *\fP variable. If the pattern contains any
+be set to point to a suitable variable. If the pattern contains any
 backtracking control verbs such as (*MARK:NAME), and the execution ends up with
 a name to pass back, a pointer to the name string (zero terminated) is placed
 in the variable pointed to by the \fImark\fP field. The names are within the
 compiled pattern; if you wish to retain such a name you must copy it before
 freeing the memory of a compiled pattern. If there is no name to pass back, the
-variable pointed to by the \fImark\fP field set to NULL. For details of the
+variable pointed to by the \fImark\fP field is set to NULL. For details of the
 backtracking control verbs, see the section entitled
 .\" HTML <a href="pcrepattern#backtrackcontrol">
 .\" </a>
@@ -1684,20 +1728,15 @@
 The value of \fIstartoffset\fP is also checked to ensure that it points to the
 start of a UTF-8 character. There is a discussion about the validity of UTF-8
 strings in the
-.\" HTML <a href="pcre.html#utf8strings">
-.\" </a>
-section on UTF-8 support
-.\"
-in the main
 .\" HREF
-\fBpcre\fP
+\fBpcreunicode\fP
 .\"
-page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_exec()\fP returns
-the error PCRE_ERROR_BADUTF8 or, if PCRE_PARTIAL_HARD is set and the problem is
-a truncated UTF-8 character at the end of the subject, PCRE_ERROR_SHORTUTF8. In
-both cases, information about the precise nature of the error may also be
-returned (see the descriptions of these errors in the section entitled \fIError
-return values from\fP \fBpcre_exec()\fP
+page. If an invalid sequence of bytes is found, \fBpcre_exec()\fP returns the
+error PCRE_ERROR_BADUTF8 or, if PCRE_PARTIAL_HARD is set and the problem is a
+truncated character at the end of the subject, PCRE_ERROR_SHORTUTF8. In both
+cases, information about the precise nature of the error may also be returned
+(see the descriptions of these errors in the section entitled \fIError return
+values from\fP \fBpcre_exec()\fP
 .\" HTML <a href="#errorlist">
 .\" </a>
 below).
@@ -1711,9 +1750,9 @@
 calling \fBpcre_exec()\fP. You might want to do this for the second and
 subsequent calls to \fBpcre_exec()\fP if you are making repeated calls to find
 all the matches in a single subject string. However, you should be sure that
-the value of \fIstartoffset\fP points to the start of a UTF-8 character (or the
-end of the subject). When PCRE_NO_UTF8_CHECK is set, the effect of passing an
-invalid UTF-8 string as a subject or an invalid value of \fIstartoffset\fP is
+the value of \fIstartoffset\fP points to the start of a character (or the end
+of the subject). When PCRE_NO_UTF8_CHECK is set, the effect of passing an
+invalid string as a subject or an invalid value of \fIstartoffset\fP is
 undefined. Your program may crash.
 .sp
   PCRE_PARTIAL_HARD
@@ -1748,7 +1787,7 @@
 .rs
 .sp
 The subject string is passed to \fBpcre_exec()\fP as a pointer in
-\fIsubject\fP, a length (in bytes) in \fIlength\fP, and a starting byte offset
+\fIsubject\fP, a length in bytes in \fIlength\fP, and a starting byte offset
 in \fIstartoffset\fP. If this is negative or greater than the length of the
 subject, \fBpcre_exec()\fP returns PCRE_ERROR_BADOFFSET. When the starting
 offset is zero, the search for a match starts at the beginning of the subject,
@@ -2043,6 +2082,18 @@
 \fBpcrejit\fP
 .\"
 documentation for more details.
+.sp
+  PCRE_ERROR_BADMODE (-28)
+.sp
+This error is given if a pattern that was compiled by the 8-bit library is 
+passed to a 16-bit library function, or vice versa.
+.sp
+  PCRE_ERROR_BADENDIANNESS (-29)
+.sp      
+This error is given if a pattern that was compiled and saved is reloaded on a 
+host with different endianness. The utility function 
+\fBpcre_pattern_to_host_byte_order()\fP can be used to convert such a pattern 
+so that it runs on the new host.
 .P
 Error numbers -16 to -20 and -22 are not used by \fBpcre_exec()\fP.
 .
@@ -2051,6 +2102,13 @@
 .SS "Reason codes for invalid UTF-8 strings"
 .rs
 .sp
+This section applies only to the 8-bit library. The corresponding information 
+for the 16-bit library is given in the
+.\" HREF
+\fBpcre16\fP
+.\"
+page.
+.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
 least 2, the offset of the start of the invalid UTF-8 character is placed in
@@ -2534,7 +2592,7 @@
 .SH "SEE ALSO"
 .rs
 .sp
-\fBpcrebuild\fP(3), \fBpcrecallout\fP(3), \fBpcrecpp(3)\fP(3),
+\fBpcre16\fP(3), \fBpcrebuild\fP(3), \fBpcrecallout\fP(3), \fBpcrecpp(3)\fP(3),
 \fBpcrematching\fP(3), \fBpcrepartial\fP(3), \fBpcreposix\fP(3),
 \fBpcreprecompile\fP(3), \fBpcresample\fP(3), \fBpcrestack\fP(3).
 .
@@ -2553,6 +2611,6 @@
 .rs
 .sp
 .nf
-Last updated: 02 December 2011
-Copyright (c) 1997-2011 University of Cambridge.
+Last updated: 07 January 2012
+Copyright (c) 1997-2012 University of Cambridge.
 .fi