Documentation update.

This commit is contained in:
Philip.Hazel 2018-09-19 16:37:59 +00:00
parent 992e1fad44
commit dc201313a6
3 changed files with 159 additions and 119 deletions

View File

@ -42,18 +42,18 @@ the 16-bit library, which processes strings of 16-bit values, and one for the
32-bit library, which processes strings of 32-bit values. There are no C++
wrappers.
The distribution does contain a set of C wrapper functions for the 8-bit
library that are based on the POSIX regular expression API (see the pcre2posix
man page). These can be found in a library called libpcre2-posix. Note that
this just provides a POSIX calling interface to PCRE2; the regular expressions
themselves still follow Perl syntax and semantics. The POSIX API is restricted,
and does not give full access to all of PCRE2's facilities.
In addition, the distribution contains a set of C wrapper functions for the
8-bit library that are based on the POSIX regular expression API (see the
pcre2posix man page). These are built into a library called libpcre2-posix.
Note that this just provides a POSIX calling interface to PCRE2; the regular
expressions themselves still follow Perl syntax and semantics. The POSIX API is
restricted, and does not give full access to all of PCRE2's facilities.
The header file for the POSIX-style functions is called pcre2posix.h. The
official POSIX name is regex.h, but I did not want to risk possible problems
with existing files of that name by distributing it that way. To use PCRE2 with
an existing program that uses the POSIX API, pcre2posix.h will have to be
renamed or pointed at by a link.
renamed or pointed at by a link (or the program modified, of course).
If you are using the POSIX interface to PCRE2 and there is already a POSIX
regex library installed on your system, as well as worrying about the regex.h
@ -61,12 +61,11 @@ header file (as mentioned above), you must also take care when linking programs
to ensure that they link with PCRE2's libpcre2-posix library. Otherwise they
may pick up the POSIX functions of the same name from the other library.
One way of avoiding this confusion is to compile PCRE2 with the addition of
-Dregcomp=PCRE2regcomp (and similarly for the other POSIX functions) to the
compiler flags (CFLAGS if you are using "configure" -- see below). This has the
effect of renaming the functions so that the names no longer clash. Of course,
you have to do the same thing for your applications, or write them using the
new names.
To help with this issue, the libpcre2-posix library provides alternative names
for the POSIX functions. These are the POSIX names, prefixed with "pcre2_", for
example, pcre2_regcomp(). If an application can be compiled to use the
alternative names (for example by the use of -Dregcomp=pcre2_regcomp etc.) it
can be sure of linking with the PCRE2 functions.
Documentation for PCRE2
@ -888,4 +887,4 @@ The distribution should contain the files listed below.
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
Last updated: 17 June 2018
Last updated: 19 September 2018

View File

@ -32,15 +32,30 @@ please consult the man page, in case the conversion went wrong.
<b> int <i>cflags</i>);</b>
<br>
<br>
<b>int pcre2_regcomp(regex_t *<i>preg</i>, const char *<i>pattern</i>,</b>
<b> int <i>cflags</i>);</b>
<br>
<br>
<b>int regexec(const regex_t *<i>preg</i>, const char *<i>string</i>,</b>
<b> size_t <i>nmatch</i>, regmatch_t <i>pmatch</i>[], int <i>eflags</i>);</b>
<br>
<br>
<b>int pcre2_regexec(const regex_t *<i>preg</i>, const char *<i>string</i>,</b>
<b> size_t <i>nmatch</i>, regmatch_t <i>pmatch</i>[], int <i>eflags</i>);</b>
<br>
<br>
<b>size_t regerror(int <i>errcode</i>, const regex_t *<i>preg</i>,</b>
<b> char *<i>errbuf</i>, size_t <i>errbuf_size</i>);</b>
<br>
<br>
<b>size_t pcre2_regerror(int <i>errcode</i>, const regex_t *<i>preg</i>,</b>
<b> char *<i>errbuf</i>, size_t <i>errbuf_size</i>);</b>
<br>
<br>
<b>void regfree(regex_t *<i>preg</i>);</b>
<br>
<br>
<b>void pcre2_regfree(regex_t *<i>preg</i>);</b>
</P>
<br><a name="SEC2" href="#TOC1">DESCRIPTION</a><br>
<P>
@ -60,6 +75,14 @@ command for linking an application that uses them. Because the POSIX functions
call the native ones, it is also necessary to add <b>-lpcre2-8</b>.
</P>
<P>
When another POSIX regex library is also installed, there is the possibility of
linking an application with the wrong library. To help avoid this issue, the
PCRE2 POSIX library provides alternative names for the functions, all starting
with "pcre2_". If an application uses these names, possible ambiguity is
avoided. In the following description, however, the standard POSIX function
names are used.
</P>
<P>
Those POSIX option bits that can reasonably be mapped to PCRE2 native options
have been implemented. In addition, the option REG_EXTENDED is defined with the
value zero. This has no effect, but since programs that are written to the
@ -322,9 +345,9 @@ Cambridge, England.
</P>
<br><a name="SEC9" href="#TOC1">REVISION</a><br>
<P>
Last updated: 15 June 2017
Last updated: 19 September 2018
<br>
Copyright &copy; 1997-2017 University of Cambridge.
Copyright &copy; 1997-2018 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE2 index page</a>.

View File

@ -9419,14 +9419,25 @@ SYNOPSIS
int regcomp(regex_t *preg, const char *pattern,
int cflags);
int pcre2_regcomp(regex_t *preg, const char *pattern,
int cflags);
int regexec(const regex_t *preg, const char *string,
size_t nmatch, regmatch_t pmatch[], int eflags);
int pcre2_regexec(const regex_t *preg, const char *string,
size_t nmatch, regmatch_t pmatch[], int eflags);
size_t regerror(int errcode, const regex_t *preg,
char *errbuf, size_t errbuf_size);
size_t pcre2_regerror(int errcode, const regex_t *preg,
char *errbuf, size_t errbuf_size);
void regfree(regex_t *preg);
void pcre2_regfree(regex_t *preg);
DESCRIPTION
@ -9444,6 +9455,13 @@ DESCRIPTION
POSIX functions call the native ones, it is also necessary to add
-lpcre2-8.
When another POSIX regex library is also installed, there is the possi-
bility of linking an application with the wrong library. To help avoid
this issue, the PCRE2 POSIX library provides alternative names for the
functions, all starting with "pcre2_". If an application uses these
names, possible ambiguity is avoided. In the following description,
however, the standard POSIX function names are used.
Those POSIX option bits that can reasonably be mapped to PCRE2 native
options have been implemented. In addition, the option REG_EXTENDED is
defined with the value zero. This has no effect, but since programs
@ -9707,8 +9725,8 @@ AUTHOR
REVISION
Last updated: 15 June 2017
Copyright (c) 1997-2017 University of Cambridge.
Last updated: 19 September 2018
Copyright (c) 1997-2018 University of Cambridge.
------------------------------------------------------------------------------