From 5fbd64ad4f6f445ff31f3da62dcd208ac2fe81ef Mon Sep 17 00:00:00 2001
From: ph10
Date: Sat, 8 Apr 2017 15:21:39 +0000
Subject: [PATCH] Documentation tidies and code tidies for Windows.
---
RunGrepTest.bat | 6 ++----
doc/html/pcre2api.html | 2 +-
doc/html/pcre2build.html | 2 +-
doc/pcre2.txt | 4 ++--
doc/pcre2api.3 | 2 +-
doc/pcre2build.3 | 2 +-
src/pcre2.h.generic | 1 +
src/pcre2_jit_compile.c | 12 ++++++------
src/pcre2grep.c | 26 +++++++++++++-------------
9 files changed, 28 insertions(+), 29 deletions(-)
diff --git a/RunGrepTest.bat b/RunGrepTest.bat
index 387d0e3..50a9644 100644
--- a/RunGrepTest.bat
+++ b/RunGrepTest.bat
@@ -658,10 +658,8 @@ if %ERRORLEVEL% equ 0 (
echo Testing pcre2grep script callouts
%pcre2grep% "(T)(..(.))(?C'cmd|/c echo|Arg1: [$1] [$2] [$3]|Arg2: ^$|${1}^$| ($4) ($14) ($0)')()" %srcdir%/testdata/grepinputv >testtrygrep
%pcre2grep% "(T)(..(.))()()()()()()()(..)(?C'cmd|/c echo|Arg1: [$11] [${11}]')" %srcdir%/testdata/grepinputv >>testtrygrep
- %pcre2grep% "(T)(?C'|$0:$1')" %srcdir%/testdata/grepinputv >>testtrygrep
- %pcre2grep% --om-separator / "(T)(?C'|$1')" %srcdir%/testdata/grepinputv >>testtrygrep
- :: The above has no newline, which 'diff -ub' ignores, so add one.
- echo />>testtrygrep
+ %pcre2grep% "(T)(?C'|$0:$1$n')" %srcdir%/testdata/grepinputv >>testtrygrep
+ %pcre2grep% "(T)(?C'|$1$n')(*F)" %srcdir%/testdata/grepinputv >>testtrygrep
%cf% %srcdir%\testdata\grepoutputC testtrygrep %cfout%
if ERRORLEVEL 1 exit /b 1
) else (
diff --git a/doc/html/pcre2api.html b/doc/html/pcre2api.html
index ef37ce2..7f424c9 100644
--- a/doc/html/pcre2api.html
+++ b/doc/html/pcre2api.html
@@ -380,7 +380,7 @@ When using multiple libraries in an application, you must take care when
processing any particular pattern to use only functions from a single library.
For example, if you want to run a match using a pattern that was compiled with
pcre2_compile_16(), you must do so with pcre2_match_16(), not
-pcre2_match_8() or pcre2_match_32.
+pcre2_match_8() or pcre2_match_32().
In the function summaries above, and in the rest of this document and other
diff --git a/doc/html/pcre2build.html b/doc/html/pcre2build.html
index 8af58b5..333e4f8 100644
--- a/doc/html/pcre2build.html
+++ b/doc/html/pcre2build.html
@@ -512,7 +512,7 @@ system stack, but if
--disable-stack-for-recursion
was set, memory on the heap was used. From release 10.30 onwards this has
-changed (the stack is no lonter used) and this option now does nothing except
+changed (the stack is no longer used) and this option now does nothing except
give a warning.
SEE ALSO
diff --git a/doc/pcre2.txt b/doc/pcre2.txt
index d91b08b..92b17c7 100644
--- a/doc/pcre2.txt
+++ b/doc/pcre2.txt
@@ -459,7 +459,7 @@ PCRE2 8-BIT, 16-BIT, AND 32-BIT LIBRARIES
when processing any particular pattern to use only functions from a
single library. For example, if you want to run a match using a pat-
tern that was compiled with pcre2_compile_16(), you must do so with
- pcre2_match_16(), not pcre2_match_8() or pcre2_match_32.
+ pcre2_match_16(), not pcre2_match_8() or pcre2_match_32().
In the function summaries above, and in the rest of this document and
other PCRE2 documents, functions and data types are described using
@@ -3683,7 +3683,7 @@ OBSOLETE OPTION
--disable-stack-for-recursion
was set, memory on the heap was used. From release 10.30 onwards this
- has changed (the stack is no lonter used) and this option now does
+ has changed (the stack is no longer used) and this option now does
nothing except give a warning.
diff --git a/doc/pcre2api.3 b/doc/pcre2api.3
index cfafbc1..c34ff3c 100644
--- a/doc/pcre2api.3
+++ b/doc/pcre2api.3
@@ -316,7 +316,7 @@ When using multiple libraries in an application, you must take care when
processing any particular pattern to use only functions from a single library.
For example, if you want to run a match using a pattern that was compiled with
\fBpcre2_compile_16()\fP, you must do so with \fBpcre2_match_16()\fP, not
-\fBpcre2_match_8()\fP or \fBpcre2_match_32\fP.
+\fBpcre2_match_8()\fP or \fBpcre2_match_32()\fP.
.P
In the function summaries above, and in the rest of this document and other
PCRE2 documents, functions and data types are described using their generic
diff --git a/doc/pcre2build.3 b/doc/pcre2build.3
index 8c93d98..dc0e928 100644
--- a/doc/pcre2build.3
+++ b/doc/pcre2build.3
@@ -524,7 +524,7 @@ system stack, but if
--disable-stack-for-recursion
.sp
was set, memory on the heap was used. From release 10.30 onwards this has
-changed (the stack is no lonter used) and this option now does nothing except
+changed (the stack is no longer used) and this option now does nothing except
give a warning.
.
.SH "SEE ALSO"
diff --git a/src/pcre2.h.generic b/src/pcre2.h.generic
index f14fcb2..e699b8a 100644
--- a/src/pcre2.h.generic
+++ b/src/pcre2.h.generic
@@ -101,6 +101,7 @@ others can be added next to them */
#define PCRE2_ANCHORED 0x80000000u
#define PCRE2_NO_UTF_CHECK 0x40000000u
+#define PCRE2_ENDANCHORED 0x20000000u
/* The following option bits can be passed only to pcre2_compile(). However,
they may affect compilation, JIT compilation, and/or interpretive execution.
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
index 777347e..5174ca2 100644
--- a/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -5118,14 +5118,14 @@ jump = CMP(SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
if (sljit_get_register_index (TMP3) < 0)
{
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(STACK_TOP), -3 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(STACK_TOP), -(3 * sizeof(sljit_sw)));
OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
}
else
{
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
- OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(STACK_TOP), -3 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
+ OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(STACK_TOP), -(3 * sizeof(sljit_sw)));
OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, TMP1, 0);
GET_LOCAL_BASE(TMP1, 0, 0);
@@ -5143,12 +5143,12 @@ OP1(SLJIT_NEG, TMP2, 0, TMP2, 0);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
if (sljit_get_register_index (TMP3) < 0)
{
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
}
else
{
- OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, TMP3, 0);
}
diff --git a/src/pcre2grep.c b/src/pcre2grep.c
index a12086b..f282e9e 100644
--- a/src/pcre2grep.c
+++ b/src/pcre2grep.c
@@ -630,11 +630,24 @@ Unix-style directory scanning can be used (see below). */
#ifdef WIN32
+#ifndef STRICT
+# define STRICT
+#endif
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#include
+
#define iswild(name) (strpbrk(name, "*?") != NULL)
/* Convert ANSI BGR format to RGB used by Windows */
#define BGR_RGB(x) ((x & 1 ? 4 : 0) | (x & 2) | (x & 4 ? 1 : 0))
+static HANDLE hstdout;
+static CONSOLE_SCREEN_BUFFER_INFO csbi;
+static WORD match_colour;
+
static WORD
decode_ANSI_colour(const char *cs)
{
@@ -817,15 +830,6 @@ when it did not exist. David Byron added a patch that moved the #include of
#elif defined WIN32
-#ifndef STRICT
-# define STRICT
-#endif
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-
-#include
-
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
#endif
@@ -940,10 +944,6 @@ return _isatty(_fileno(f));
/************* Print optionally coloured match in Windows **********/
-static HANDLE hstdout;
-static CONSOLE_SCREEN_BUFFER_INFO csbi;
-static WORD match_colour;
-
static void
print_match(const void *buf, int length)
{