(1) uint32_t for substring number args; (2) correct PRIV(memctl_malloc)

definition for Windows; (3) remove unwanted PCRE2_EXP_DATA_DEFN; (4) 
documentation updates.
This commit is contained in:
Philip.Hazel 2014-12-01 16:14:53 +00:00
parent bb3b7927f3
commit a119d6f974
16 changed files with 93 additions and 98 deletions

View File

@ -10,7 +10,7 @@ dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre2_major, [10])
m4_define(pcre2_minor, [00])
m4_define(pcre2_prerelease, [-RC1])
m4_define(pcre2_prerelease, [-RC2])
m4_define(pcre2_date, [2014-11-28])
# NOTE: The CMakeLists.txt file searches for the above variables in the first

View File

@ -27,19 +27,19 @@ DESCRIPTION
<P>
This function returns information about a compiled pattern. Its arguments are:
<pre>
<i>code</i> Compiled regular expression
<i>what</i> What information is required
<i>where</i> Where to put the information
<i>code</i> Pointer to a compiled regular expression
<i>what</i> What information is required
<i>where</i> Where to put the information
</pre>
If <i>where</i> is NULL, the function returns the amount of memory needed for
the requested information, in bytes. The following information is available:
The recognized values for the <i>what</i> argument, and the information they
request are as follows:
<pre>
PCRE2_INFO_ALLOPTIONS Final options after compiling
PCRE2_INFO_ARGOPTIONS Options passed to <b>pcre2_compile()</b>
PCRE2_INFO_BACKREFMAX Number of highest back reference
PCRE2_INFO_BSR What \R matches
0 all Unicode line endings
1 CR, LF, or CRLF only
PCRE2_INFO_BSR What \R matches:
PCRE2_BSR_UNICODE: Unicode line endings
PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only
PCRE2_INFO_CAPTURECOUNT Number of capturing subpatterns
PCRE2_INFO_FIRSTBITMAP Bitmap of first code units, or NULL
PCRE2_INFO_FIRSTCODEUNIT First code unit when type is 1
@ -58,7 +58,7 @@ the requested information, in bytes. The following information is available:
PCRE2_INFO_MATCHEMPTY 1 if the pattern can match an
empty string, 0 otherwise
PCRE2_INFO_MATCHLIMIT Match limit if set,
otherwise PCRE2_RROR_UNSET
otherwise PCRE2_ERROR_UNSET
PCRE2_INFO_MAXLOOKBEHIND Length (in characters) of the longest
lookbehind assertion
PCRE2_INFO_MINLENGTH Lower bound length of matching strings
@ -66,17 +66,20 @@ the requested information, in bytes. The following information is available:
PCRE2_INFO_NAMECOUNT Number of named subpatterns
PCRE2_INFO_NAMETABLE Pointer to name table
PCRE2_CONFIG_NEWLINE Code for the newline sequence:
1 for CR
2 for LF
3 for CRLF
4 for ANY
5 for ANYCRLF
PCRE2_NEWLINE_CR
PCRE2_NEWLINE_LF
PCRE2_NEWLINE_CRLF
PCRE2_NEWLINE_ANY
PCRE2_NEWLINE_ANYCRLF
PCRE2_INFO_RECURSIONLIMIT Recursion limit if set,
otherwise PCRE2_ERROR_UNSET
PCRE2_INFO_SIZE Size of compiled pattern
</pre>
The <i>where</i> argument must point to an unsigned 32-bit integer (uint32_t
variable), except for the following <i>what</i> values:
If <i>where</i> is NULL, the function returns the amount of memory needed for
the requested information, in bytes. Otherwise, the <i>where</i> argument must
point to an unsigned 32-bit integer (uint32_t variable), except for the
following <i>what</i> values, when it must point to a variable of the type
shown:
<pre>
PCRE2_INFO_FIRSTBITMAP const uint8_t *
PCRE2_INFO_JITSIZE size_t

View File

@ -20,7 +20,7 @@ SYNOPSIS
</P>
<P>
<b>int pcre2_substring_copy_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
<b> uint32_t <i>number</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
<b> PCRE2_SIZE *<i>bufflen</i>);</b>
</P>
<br><b>

View File

@ -20,14 +20,14 @@ SYNOPSIS
</P>
<P>
<b>int pcre2_substring_get_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_UCHAR **<i>bufferptr</i>, PCRE2_SIZE *<i>bufflen</i>);</b>
<b> uint32_t <i>number</i>, PCRE2_UCHAR **<i>bufferptr</i>, PCRE2_SIZE *<i>bufflen</i>);</b>
</P>
<br><b>
DESCRIPTION
</b><br>
<P>
This is a convenience function for extracting a captured substring by number into
newly acquired memory. The arguments are:
This is a convenience function for extracting a captured substring by number
into newly acquired memory. The arguments are:
<pre>
<i>match_data</i> The match data for the match
<i>number</i> Number of the required substring

View File

@ -20,7 +20,7 @@ SYNOPSIS
</P>
<P>
<b>int pcre2_substring_length_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_SIZE *<i>length</i>);</b>
<b> uint32_t <i>number</i>, PCRE2_SIZE *<i>length</i>);</b>
</P>
<br><b>
DESCRIPTION

View File

@ -189,7 +189,7 @@ document for an overview of all the PCRE2 documentation.
<br>
<br>
<b>int pcre2_substring_copy_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
<b> uint32_t <i>number</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
<b> PCRE2_SIZE *<i>bufflen</i>);</b>
<br>
<br>
@ -201,7 +201,7 @@ document for an overview of all the PCRE2 documentation.
<br>
<br>
<b>int pcre2_substring_get_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_UCHAR **<i>bufferptr</i>,</b>
<b> uint32_t <i>number</i>, PCRE2_UCHAR **<i>bufferptr</i>,</b>
<b> PCRE2_SIZE *<i>bufflen</i>);</b>
<br>
<br>
@ -210,7 +210,7 @@ document for an overview of all the PCRE2 documentation.
<br>
<br>
<b>int pcre2_substring_length_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_SIZE *<i>length</i>);</b>
<b> uint32_t <i>number</i>, PCRE2_SIZE *<i>length</i>);</b>
<br>
<br>
<b>int pcre2_substring_nametable_scan(const pcre2_code *<i>code</i>,</b>
@ -2214,16 +2214,16 @@ The internal recursion limit was reached.
<br><a name="SEC28" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
<P>
<b>int pcre2_substring_length_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_SIZE *<i>length</i>);</b>
<b> uint32_t <i>number</i>, PCRE2_SIZE *<i>length</i>);</b>
<br>
<br>
<b>int pcre2_substring_copy_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
<b> uint32_t <i>number</i>, PCRE2_UCHAR *<i>buffer</i>,</b>
<b> PCRE2_SIZE *<i>bufflen</i>);</b>
<br>
<br>
<b>int pcre2_substring_get_bynumber(pcre2_match_data *<i>match_data</i>,</b>
<b> unsigned int <i>number</i>, PCRE2_UCHAR **<i>bufferptr</i>,</b>
<b> uint32_t <i>number</i>, PCRE2_UCHAR **<i>bufferptr</i>,</b>
<b> PCRE2_SIZE *<i>bufflen</i>);</b>
<br>
<br>
@ -2685,7 +2685,7 @@ Cambridge, England.
</P>
<br><a name="SEC37" href="#TOC1">REVISION</a><br>
<P>
Last updated: 27 November 2014
Last updated: 01 December 2014
<br>
Copyright &copy; 1997-2014 University of Cambridge.
<br>

View File

@ -283,7 +283,7 @@ PCRE2 NATIVE API STRING EXTRACTION FUNCTIONS
PCRE2_SPTR name, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen);
int pcre2_substring_copy_bynumber(pcre2_match_data *match_data,
unsigned int number, PCRE2_UCHAR *buffer,
uint32_t number, PCRE2_UCHAR *buffer,
PCRE2_SIZE *bufflen);
void pcre2_substring_free(PCRE2_UCHAR *buffer);
@ -292,14 +292,14 @@ PCRE2 NATIVE API STRING EXTRACTION FUNCTIONS
PCRE2_SPTR name, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen);
int pcre2_substring_get_bynumber(pcre2_match_data *match_data,
unsigned int number, PCRE2_UCHAR **bufferptr,
uint32_t number, PCRE2_UCHAR **bufferptr,
PCRE2_SIZE *bufflen);
int pcre2_substring_length_byname(pcre2_match_data *match_data,
PCRE2_SPTR name, PCRE2_SIZE *length);
int pcre2_substring_length_bynumber(pcre2_match_data *match_data,
unsigned int number, PCRE2_SIZE *length);
uint32_t number, PCRE2_SIZE *length);
int pcre2_substring_nametable_scan(const pcre2_code *code,
PCRE2_SPTR name, PCRE2_SPTR *first, PCRE2_SPTR *last);
@ -2189,14 +2189,14 @@ ERROR RETURNS FROM pcre2_match()
EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
int pcre2_substring_length_bynumber(pcre2_match_data *match_data,
unsigned int number, PCRE2_SIZE *length);
uint32_t number, PCRE2_SIZE *length);
int pcre2_substring_copy_bynumber(pcre2_match_data *match_data,
unsigned int number, PCRE2_UCHAR *buffer,
uint32_t number, PCRE2_UCHAR *buffer,
PCRE2_SIZE *bufflen);
int pcre2_substring_get_bynumber(pcre2_match_data *match_data,
unsigned int number, PCRE2_UCHAR **bufferptr,
uint32_t number, PCRE2_UCHAR **bufferptr,
PCRE2_SIZE *bufflen);
void pcre2_substring_free(PCRE2_UCHAR *buffer);
@ -2624,7 +2624,7 @@ AUTHOR
REVISION
Last updated: 27 November 2014
Last updated: 01 December 2014
Copyright (c) 1997-2014 University of Cambridge.
------------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
.TH PCRE2_PATTERN_INFO 3 "21 October 2014" "PCRE2 10.00"
.TH PCRE2_PATTERN_INFO 3 "01 December 2014" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH SYNOPSIS
@ -15,19 +15,19 @@ PCRE2 - Perl-compatible regular expressions (revised API)
.sp
This function returns information about a compiled pattern. Its arguments are:
.sp
\fIcode\fP Compiled regular expression
\fIwhat\fP What information is required
\fIwhere\fP Where to put the information
\fIcode\fP Pointer to a compiled regular expression
\fIwhat\fP What information is required
\fIwhere\fP Where to put the information
.sp
If \fIwhere\fP is NULL, the function returns the amount of memory needed for
the requested information, in bytes. The following information is available:
The recognized values for the \fIwhat\fP argument, and the information they
request are as follows:
.sp
PCRE2_INFO_ALLOPTIONS Final options after compiling
PCRE2_INFO_ARGOPTIONS Options passed to \fBpcre2_compile()\fP
PCRE2_INFO_BACKREFMAX Number of highest back reference
PCRE2_INFO_BSR What \eR matches
0 all Unicode line endings
1 CR, LF, or CRLF only
PCRE2_INFO_BSR What \eR matches:
PCRE2_BSR_UNICODE: Unicode line endings
PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only
PCRE2_INFO_CAPTURECOUNT Number of capturing subpatterns
PCRE2_INFO_FIRSTBITMAP Bitmap of first code units, or NULL
PCRE2_INFO_FIRSTCODEUNIT First code unit when type is 1
@ -46,7 +46,7 @@ the requested information, in bytes. The following information is available:
PCRE2_INFO_MATCHEMPTY 1 if the pattern can match an
empty string, 0 otherwise
PCRE2_INFO_MATCHLIMIT Match limit if set,
otherwise PCRE2_RROR_UNSET
otherwise PCRE2_ERROR_UNSET
PCRE2_INFO_MAXLOOKBEHIND Length (in characters) of the longest
lookbehind assertion
PCRE2_INFO_MINLENGTH Lower bound length of matching strings
@ -54,17 +54,20 @@ the requested information, in bytes. The following information is available:
PCRE2_INFO_NAMECOUNT Number of named subpatterns
PCRE2_INFO_NAMETABLE Pointer to name table
PCRE2_CONFIG_NEWLINE Code for the newline sequence:
1 for CR
2 for LF
3 for CRLF
4 for ANY
5 for ANYCRLF
PCRE2_NEWLINE_CR
PCRE2_NEWLINE_LF
PCRE2_NEWLINE_CRLF
PCRE2_NEWLINE_ANY
PCRE2_NEWLINE_ANYCRLF
PCRE2_INFO_RECURSIONLIMIT Recursion limit if set,
otherwise PCRE2_ERROR_UNSET
PCRE2_INFO_SIZE Size of compiled pattern
.sp
The \fIwhere\fP argument must point to an unsigned 32-bit integer (uint32_t
variable), except for the following \fIwhat\fP values:
If \fIwhere\fP is NULL, the function returns the amount of memory needed for
the requested information, in bytes. Otherwise, the \fIwhere\fP argument must
point to an unsigned 32-bit integer (uint32_t variable), except for the
following \fIwhat\fP values, when it must point to a variable of the type
shown:
.sp
PCRE2_INFO_FIRSTBITMAP const uint8_t *
PCRE2_INFO_JITSIZE size_t

View File

@ -1,4 +1,4 @@
.TH PCRE2_SUBSTRING_COPY_BYNUMBER 3 "21 October 2014" "PCRE2 10.00"
.TH PCRE2_SUBSTRING_COPY_BYNUMBER 3 "01 December 2014" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH SYNOPSIS
@ -8,7 +8,7 @@ PCRE2 - Perl-compatible regular expressions (revised API)
.PP
.nf
.B int pcre2_substring_copy_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP,"
.B " uint32_t \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP,"
.B " PCRE2_SIZE *\fIbufflen\fP);"
.fi
.

View File

@ -1,4 +1,4 @@
.TH PCRE2_SUBSTRING_GET_BYNUMBER 3 "21 October 2014" "PCRE2 10.00"
.TH PCRE2_SUBSTRING_GET_BYNUMBER 3 "01 December 2014" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH SYNOPSIS
@ -8,14 +8,14 @@ PCRE2 - Perl-compatible regular expressions (revised API)
.PP
.nf
.B int pcre2_substring_get_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP, PCRE2_SIZE *\fIbufflen\fP);"
.B " uint32_t \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP, PCRE2_SIZE *\fIbufflen\fP);"
.fi
.
.SH DESCRIPTION
.rs
.sp
This is a convenience function for extracting a captured substring by number into
newly acquired memory. The arguments are:
This is a convenience function for extracting a captured substring by number
into newly acquired memory. The arguments are:
.sp
\fImatch_data\fP The match data for the match
\fInumber\fP Number of the required substring

View File

@ -1,4 +1,4 @@
.TH PCRE2_SUBSTRING_LENGTH_BYNUMBER 3 "21 October 2014" "PCRE2 10.00"
.TH PCRE2_SUBSTRING_LENGTH_BYNUMBER 3 "01 December 2014" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH SYNOPSIS
@ -8,7 +8,7 @@ PCRE2 - Perl-compatible regular expressions (revised API)
.PP
.nf
.B int pcre2_substring_length_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_SIZE *\fIlength\fP);"
.B " uint32_t \fInumber\fP, PCRE2_SIZE *\fIlength\fP);"
.fi
.
.SH DESCRIPTION

View File

@ -1,4 +1,4 @@
.TH PCRE2API 3 "27 November 2014" "PCRE2 10.00"
.TH PCRE2API 3 "01 December 2014" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.sp
@ -138,7 +138,7 @@ document for an overview of all the PCRE2 documentation.
.B " PCRE2_SPTR \fIname\fP, PCRE2_UCHAR *\fIbuffer\fP, PCRE2_SIZE *\fIbufflen\fP);"
.sp
.B int pcre2_substring_copy_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP,"
.B " uint32_t \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP,"
.B " PCRE2_SIZE *\fIbufflen\fP);"
.sp
.B void pcre2_substring_free(PCRE2_UCHAR *\fIbuffer\fP);
@ -147,14 +147,14 @@ document for an overview of all the PCRE2 documentation.
.B " PCRE2_SPTR \fIname\fP, PCRE2_UCHAR **\fIbufferptr\fP, PCRE2_SIZE *\fIbufflen\fP);"
.sp
.B int pcre2_substring_get_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP,"
.B " uint32_t \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP,"
.B " PCRE2_SIZE *\fIbufflen\fP);"
.sp
.B int pcre2_substring_length_byname(pcre2_match_data *\fImatch_data\fP,
.B " PCRE2_SPTR \fIname\fP, PCRE2_SIZE *\fIlength\fP);"
.sp
.B int pcre2_substring_length_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_SIZE *\fIlength\fP);"
.B " uint32_t \fInumber\fP, PCRE2_SIZE *\fIlength\fP);"
.sp
.B int pcre2_substring_nametable_scan(const pcre2_code *\fIcode\fP,
.B " PCRE2_SPTR \fIname\fP, PCRE2_SPTR *\fIfirst\fP, PCRE2_SPTR *\fIlast\fP);"
@ -2248,14 +2248,14 @@ The internal recursion limit was reached.
.sp
.nf
.B int pcre2_substring_length_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_SIZE *\fIlength\fP);"
.B " uint32_t \fInumber\fP, PCRE2_SIZE *\fIlength\fP);"
.sp
.B int pcre2_substring_copy_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP,"
.B " uint32_t \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP,"
.B " PCRE2_SIZE *\fIbufflen\fP);"
.sp
.B int pcre2_substring_get_bynumber(pcre2_match_data *\fImatch_data\fP,
.B " unsigned int \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP,"
.B " uint32_t \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP,"
.B " PCRE2_SIZE *\fIbufflen\fP);"
.sp
.B void pcre2_substring_free(PCRE2_UCHAR *\fIbuffer\fP);
@ -2735,6 +2735,6 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 27 November 2014
Last updated: 01 December 2014
Copyright (c) 1997-2014 University of Cambridge.
.fi

View File

@ -434,16 +434,16 @@ PCRE2_EXP_DECL PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *);
PCRE2_EXP_DECL int pcre2_substring_copy_byname(pcre2_match_data *, \
PCRE2_SPTR, PCRE2_UCHAR *, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_copy_bynumber(pcre2_match_data *, \
unsigned int, PCRE2_UCHAR *, PCRE2_SIZE *); \
uint32_t, PCRE2_UCHAR *, PCRE2_SIZE *); \
PCRE2_EXP_DECL void pcre2_substring_free(PCRE2_UCHAR *); \
PCRE2_EXP_DECL int pcre2_substring_get_byname(pcre2_match_data *, \
PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_get_bynumber(pcre2_match_data *, \
unsigned int, PCRE2_UCHAR **, PCRE2_SIZE *); \
uint32_t, PCRE2_UCHAR **, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_length_byname(pcre2_match_data *, \
PCRE2_SPTR, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_length_bynumber(pcre2_match_data *, \
unsigned int, PCRE2_SIZE *); \
uint32_t, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_nametable_scan(const pcre2_code *, \
PCRE2_SPTR, PCRE2_SPTR *, PCRE2_SPTR *); \
PCRE2_EXP_DECL int pcre2_substring_number_from_name(\

View File

@ -82,7 +82,7 @@ Arguments:
Returns: pointer to memory or NULL on failure
*/
PCRE2_EXP_DEFN void *
extern void *
PRIV(memctl_malloc)(size_t size, pcre2_memctl *memctl)
{
pcre2_memctl *newmemctl;

View File

@ -75,38 +75,30 @@ using some MS magic. I found some useful information on this web page:
http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
information there, using __declspec(dllexport) without "extern" we have a
definition; with "extern" we have a declaration. The settings here override the
setting in pcre.h (which is included below); it defines only PCRE2_EXP_DECL,
setting in pcre2.h (which is included below); it defines only PCRE2_EXP_DECL,
which is all that is needed for applications (they just import the symbols). We
use:
PCRE2_EXP_DECL for declarations
PCRE2_EXP_DEFN for definitions of exported functions
PCRE2_EXP_DATA_DEFN for definitions of exported variables
PCRE2_EXP_DECL for declarations
PCRE2_EXP_DEFN for definitions
The reason for the two DEFN macros is that in non-Windows environments, one
does not want to have "extern" before variable definitions because it leads to
compiler warnings. So we distinguish between functions and variables. In
Windows, the two should always be the same.
The reason for wrapping this in #ifndef PCRE2_EXP_DECL is so that pcretest,
The reason for wrapping this in #ifndef PCRE2_EXP_DECL is so that pcre2test,
which is an application, but needs to import this file in order to "peek" at
internals, can #include pcre.h first to get an application's-eye view.
internals, can #include pcre2.h first to get an application's-eye view.
In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon,
special-purpose environments) might want to stick other stuff in front of
exported symbols. That's why, in the non-Windows case, we set PCRE2_EXP_DEFN and
PCRE2_EXP_DATA_DEFN only if they are not already set. */
exported symbols. That's why, in the non-Windows case, we set PCRE2_EXP_DEFN
only if it is not already set. */
#ifndef PCRE2_EXP_DECL
# ifdef _WIN32
# ifndef PCRE2_STATIC
# define PCRE2_EXP_DECL extern __declspec(dllexport)
# define PCRE2_EXP_DEFN __declspec(dllexport)
# define PCRE2_EXP_DATA_DEFN __declspec(dllexport)
# else
# define PCRE2_EXP_DECL extern
# define PCRE2_EXP_DEFN
# define PCRE2_EXP_DATA_DEFN
# endif
# else
# ifdef __cplusplus
@ -117,9 +109,6 @@ PCRE2_EXP_DATA_DEFN only if they are not already set. */
# ifndef PCRE2_EXP_DEFN
# define PCRE2_EXP_DEFN PCRE2_EXP_DECL
# endif
# ifndef PCRE2_EXP_DATA_DEFN
# define PCRE2_EXP_DATA_DEFN
# endif
# endif
#endif
@ -129,7 +118,7 @@ property values. This must follow the setting of PCRE2_EXP_DECL above. */
#include "pcre2.h"
#include "pcre2_ucp.h"
/* When PCRE is compiled as a C++ library, the subject pointer can be replaced
/* When PCRE2 is compiled as a C++ library, the subject pointer can be replaced
with a custom type. This makes it possible, for example, to allow pcre2_match()
to process subject strings that are discontinuous by using a smart pointer
class. It must always be possible to inspect all of the subject string in

View File

@ -79,7 +79,7 @@ int entrysize = pcre2_substring_nametable_scan(match_data->code, stringname,
if (entrysize < 0) return entrysize;
for (entry = first; entry <= last; entry += entrysize)
{
uint16_t n = GET2(entry, 0);
uint32_t n = GET2(entry, 0);
if (n < match_data->oveccount && match_data->ovector[n*2] != PCRE2_UNSET)
return pcre2_substring_copy_bynumber(match_data, n, buffer, sizeptr);
}
@ -109,7 +109,7 @@ Returns: if successful: 0
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_substring_copy_bynumber(pcre2_match_data *match_data,
unsigned int stringnumber, PCRE2_UCHAR *buffer, PCRE2_SIZE *sizeptr)
uint32_t stringnumber, PCRE2_UCHAR *buffer, PCRE2_SIZE *sizeptr)
{
PCRE2_SIZE left, right;
PCRE2_SIZE p = 0;
@ -160,7 +160,7 @@ int entrysize = pcre2_substring_nametable_scan(match_data->code, stringname,
if (entrysize < 0) return entrysize;
for (entry = first; entry <= last; entry += entrysize)
{
uint16_t n = GET2(entry, 0);
uint32_t n = GET2(entry, 0);
if (n < match_data->oveccount && match_data->ovector[n*2] != PCRE2_UNSET)
return pcre2_substring_get_bynumber(match_data, n, stringptr, sizeptr);
}
@ -190,7 +190,7 @@ Returns: if successful: zero
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_substring_get_bynumber(pcre2_match_data *match_data,
unsigned int stringnumber, PCRE2_UCHAR **stringptr, PCRE2_SIZE *sizeptr)
uint32_t stringnumber, PCRE2_UCHAR **stringptr, PCRE2_SIZE *sizeptr)
{
PCRE2_SIZE left, right;
PCRE2_SIZE p = 0;
@ -263,7 +263,7 @@ int entrysize = pcre2_substring_nametable_scan(match_data->code, stringname,
if (entrysize <= 0) return entrysize;
for (entry = first; entry <= last; entry += entrysize)
{
uint16_t n = GET2(entry, 0);
uint32_t n = GET2(entry, 0);
if (n < match_data->oveccount && match_data->ovector[n*2] != PCRE2_UNSET)
return pcre2_substring_length_bynumber(match_data, n, sizeptr);
}
@ -288,7 +288,7 @@ Returns: 0 if successful, else a negative error number
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_substring_length_bynumber(pcre2_match_data *match_data,
unsigned int stringnumber, PCRE2_SIZE *sizeptr)
uint32_t stringnumber, PCRE2_SIZE *sizeptr)
{
if (stringnumber >= match_data->oveccount ||
stringnumber > match_data->code->top_bracket ||