[Pcre-svn] [863] code/trunk: 16 bit support for cmake and Ru…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [863] code/trunk: 16 bit support for cmake and RunTest.bat
Revision: 863
          http://vcs.pcre.org/viewvc?view=rev&revision=863
Author:   zherczeg
Date:     2012-01-12 19:19:56 +0000 (Thu, 12 Jan 2012)


Log Message:
-----------
16 bit support for cmake and RunTest.bat

Modified Paths:
--------------
    code/trunk/CMakeLists.txt
    code/trunk/RunTest.bat
    code/trunk/config-cmake.h.in


Modified: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt    2012-01-11 16:07:32 UTC (rev 862)
+++ code/trunk/CMakeLists.txt    2012-01-12 19:19:56 UTC (rev 863)
@@ -52,6 +52,7 @@
 #            RunTest.bat in Win32 (for effortless testing with "make test")
 # 2011-10-04 Sheri Increased minimum required cmake version
 # 2012-01-06 PH removed pcre_info.c and added pcre_string_utils.c
+# 2012-01-10 Zoltan Herczeg added libpcre16 support


PROJECT(PCRE C CXX)

@@ -102,6 +103,10 @@
 SET(BUILD_SHARED_LIBS OFF CACHE BOOL
     "Build shared libraries instead of static ones.")


+OPTION(PCRE_BUILD_PCRE8 "Build 8 bit PCRE library" ON)
+
+OPTION(PCRE_BUILD_PCRE16 "Build 16 bit PCRE library" OFF)
+
OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)

 SET(PCRE_EBCDIC OFF CACHE BOOL
@@ -134,6 +139,9 @@
 SET(PCRE_SUPPORT_PCREGREP_JIT ON CACHE BOOL
     "Enable use of Just-in-time compiling in pcregrep.")


+SET(PCRE_SUPPORT_UTF OFF CACHE BOOL
+    "Enable support for the Unicode Transformation Format (UTF) encoding.")
+
 SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
     "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")


@@ -147,13 +155,6 @@
 OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
 OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)


-IF (PCRE_BUILD_TESTS)
-  IF (NOT PCRE_BUILD_PCREGREP)
-    MESSAGE(STATUS "** Building tests requires pcregrep: PCRE_BUILD_PCREGREP forced ON")
-    SET(PCRE_BUILD_PCREGREP ON)
-  ENDIF(NOT PCRE_BUILD_PCREGREP)
-ENDIF(PCRE_BUILD_TESTS)
-
 IF (MINGW)
   OPTION(NON_STANDARD_LIB_PREFIX
          "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
@@ -216,13 +217,36 @@
         SET(PCRE_STATIC 1)
 ENDIF(NOT BUILD_SHARED_LIBS)


+IF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16)
+        MESSAGE(FATAL_ERROR "Either PCRE_BUILD_PCRE8 or PCRE_BUILD_PCRE16 must be enabled")
+ENDIF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16)
+
+IF(PCRE_BUILD_PCRE8)
+        SET(SUPPORT_PCRE8 1)
+ENDIF(PCRE_BUILD_PCRE8)
+
+IF(PCRE_BUILD_PCRE16)
+        SET(SUPPORT_PCRE16 1)
+ENDIF(PCRE_BUILD_PCRE16)
+
+IF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
+        MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the C++ library support")
+        SET(PCRE_BUILD_PCRECPP OFF)
+ENDIF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
+
+IF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
+        MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the pcregrep program")
+        SET(PCRE_BUILD_PCREGREP OFF)
+ENDIF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
+
 IF(PCRE_SUPPORT_BSR_ANYCRLF)
         SET(BSR_ANYCRLF 1)
 ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)


-IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
-        SET(SUPPORT_UTF8 1)
-ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
+IF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
+        SET(SUPPORT_UTF 1)
+        SET(PCRE_SUPPORT_UTF ON)
+ENDIF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)


 IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
         SET(SUPPORT_UCP 1)
@@ -333,6 +357,7 @@


SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)

+IF(PCRE_BUILD_PCRE8)
SET(PCRE_SOURCES
${PROJECT_BINARY_DIR}/pcre_byte_order.c
pcre_chartables.c
@@ -357,11 +382,40 @@
pcre_xclass.c
)

-
SET(PCREPOSIX_HEADERS pcreposix.h)

SET(PCREPOSIX_SOURCES pcreposix.c)

+ENDIF(PCRE_BUILD_PCRE8)
+
+IF(PCRE_BUILD_PCRE16)
+SET(PCRE16_SOURCES
+ ${PROJECT_BINARY_DIR}/pcre16_byte_order.c
+ pcre16_byte_order.c
+ pcre16_chartables.c
+ pcre16_compile.c
+ pcre16_config.c
+ pcre16_dfa_exec.c
+ pcre16_exec.c
+ pcre16_fullinfo.c
+ pcre16_get.c
+ pcre16_globals.c
+ pcre16_jit_compile.c
+ pcre16_maketables.c
+ pcre16_newline.c
+ pcre16_ord2utf16.c
+ pcre16_refcount.c
+ pcre16_string_utils.c
+ pcre16_study.c
+ pcre16_tables.c
+ pcre16_ucd.c
+ pcre16_utf16_utils.c
+ pcre16_valid_utf16.c
+ pcre16_version.c
+ pcre16_xclass.c
+)
+ENDIF(PCRE_BUILD_PCRE16)
+
IF(MINGW AND NOT PCRE_STATIC)
IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre.o
@@ -417,11 +471,13 @@

 # Libraries
 # pcre
+IF(PCRE_BUILD_PCRE8)
 ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
 SET(targets ${targets} pcre)
 ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
 SET(targets ${targets} pcreposix)
 TARGET_LINK_LIBRARIES(pcreposix pcre)
+
 IF(MINGW AND NOT PCRE_STATIC)
   IF(NON_STANDARD_LIB_PREFIX)
     SET_TARGET_PROPERTIES(pcre pcreposix
@@ -436,12 +492,33 @@
   ENDIF(NON_STANDARD_LIB_SUFFIX)
 ENDIF(MINGW AND NOT PCRE_STATIC)


+ENDIF(PCRE_BUILD_PCRE8)

+IF(PCRE_BUILD_PCRE16)
+ADD_LIBRARY(pcre16 ${PCRE_HEADERS} ${PCRE16_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+SET(targets ${targets} pcre16)
+
+IF(MINGW AND NOT PCRE_STATIC)
+  IF(NON_STANDARD_LIB_PREFIX)
+    SET_TARGET_PROPERTIES(pcre16
+                        PROPERTIES PREFIX ""
+    )
+  ENDIF(NON_STANDARD_LIB_PREFIX)
+
+  IF(NON_STANDARD_LIB_SUFFIX)
+    SET_TARGET_PROPERTIES(pcre16
+                        PROPERTIES SUFFIX "-0.dll"
+    )
+  ENDIF(NON_STANDARD_LIB_SUFFIX)
+ENDIF(MINGW AND NOT PCRE_STATIC)
+
+ENDIF(PCRE_BUILD_PCRE16)
+
 # pcrecpp
 IF(PCRE_BUILD_PCRECPP)
-  ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
+ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
 SET(targets ${targets} pcrecpp)
-  TARGET_LINK_LIBRARIES(pcrecpp pcre)
+TARGET_LINK_LIBRARIES(pcrecpp pcre)


   IF(MINGW AND NOT PCRE_STATIC)
     IF(NON_STANDARD_LIB_PREFIX)
@@ -470,24 +547,45 @@
 #         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
 # ENDIF(NOT BUILD_SHARED_LIBS)


-IF(PCRE_BUILD_PCREGREP OR PCRE_BUILD_TESTS)
+IF(PCRE_BUILD_PCREGREP)
ADD_EXECUTABLE(pcregrep pcregrep.c)
SET(targets ${targets} pcregrep)
TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
-ENDIF(PCRE_BUILD_PCREGREP OR PCRE_BUILD_TESTS)
+ENDIF(PCRE_BUILD_PCREGREP)

# Testing
IF(PCRE_BUILD_TESTS)
ENABLE_TESTING()

-  ADD_EXECUTABLE(pcretest pcretest.c)
+  SET(PCRETEST_SOURCES pcretest.c)
+  IF(PCRE_BUILD_PCRE8)
+    LIST(APPEND PCRETEST_SOURCES pcre_printint.c)
+  ENDIF(PCRE_BUILD_PCRE8)
+  IF(PCRE_BUILD_PCRE16)
+    LIST(APPEND PCRETEST_SOURCES pcre16_printint.c)
+  ENDIF(PCRE_BUILD_PCRE16)
+
+  ADD_EXECUTABLE(pcretest ${PCRETEST_SOURCES})
   SET(targets ${targets} pcretest)
-  TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})
+  IF(PCRE_BUILD_PCRE8)
+    LIST(APPEND PCRETEST_LIBS pcreposix pcre)
+  ENDIF(PCRE_BUILD_PCRE8)
+  IF(PCRE_BUILD_PCRE16)
+    LIST(APPEND PCRETEST_LIBS pcre16)
+  ENDIF(PCRE_BUILD_PCRE16)
+  TARGET_LINK_LIBRARIES(pcretest ${PCRETEST_LIBS})


   IF(PCRE_SUPPORT_JIT)
     ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)
     SET(targets ${targets} pcre_jit_test)
-    TARGET_LINK_LIBRARIES(pcre_jit_test pcre)
+    SET(PCRE_JIT_TEST_LIBS )
+    IF(PCRE_BUILD_PCRE8)
+      LIST(APPEND PCRE_JIT_TEST_LIBS pcre)
+    ENDIF(PCRE_BUILD_PCRE8)
+    IF(PCRE_BUILD_PCRE16)
+      LIST(APPEND PCRE_JIT_TEST_LIBS pcre16)
+    ENDIF(PCRE_BUILD_PCRE16)
+    TARGET_LINK_LIBRARIES(pcre_jit_test ${PCRE_JIT_TEST_LIBS})
   ENDIF(PCRE_SUPPORT_JIT)


IF(PCRE_BUILD_PCRECPP)
@@ -511,7 +609,10 @@

   # exes in Debug location tested by the RunTest shell script
   # via "make test"
-  GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
+  IF(PCRE_BUILD_PCREGREP)
+    GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
+  ENDIF(PCRE_BUILD_PCREGREP)
+
   GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)


# =================================================
@@ -524,19 +625,23 @@
MESSAGE(\"\")
")

-      FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.sh
-      "#! /bin/sh
+  FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.sh
+  "#! /bin/sh
 # This is a generated file.
 srcdir=${PROJECT_SOURCE_DIR}
-pcregrep=${PCREGREP_EXE}
 pcretest=${PCRETEST_EXE}
 source ${PROJECT_SOURCE_DIR}/RunTest
 if test \"$?\" != \"0\"; then exit 1; fi
 # End
 ")


-      FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_grep_test.sh
-      "#! /bin/sh
+  IF(UNIX)
+    ADD_TEST(pcre_test      sh ${PROJECT_BINARY_DIR}/pcre_test.sh)
+  ENDIF(UNIX)
+
+  IF(PCRE_BUILD_PCREGREP)
+    FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_grep_test.sh
+    "#! /bin/sh
 # This is a generated file.
 srcdir=${PROJECT_SOURCE_DIR}
 pcregrep=${PCREGREP_EXE}
@@ -546,10 +651,10 @@
 # End
 ")


-  IF(UNIX)
-    ADD_TEST(pcre_test      sh ${PROJECT_BINARY_DIR}/pcre_test.sh)
-    ADD_TEST(pcre_grep_test sh ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
-  ENDIF(UNIX)
+    IF(UNIX)
+      ADD_TEST(pcre_grep_test sh ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
+    ENDIF(UNIX)
+  ENDIF(PCRE_BUILD_PCREGREP)


   IF(WIN32)
     # Provide environment for executing the bat file version of RunTest
@@ -561,7 +666,6 @@
 setlocal
 SET\ srcdir=\${srcdir}
 SET\ pcretest=\${pcretest}
-SET\ pcregrep=\${pcregrep}
 call \"\${srcdir}\\RunTest.Bat\"
 if errorlevel 1 exit /b 1
 echo RunTest.bat tests successfully completed
@@ -570,13 +674,11 @@
   FILE(WRITE ${PROJECT_BINARY_DIR}/BatDriver.cmake
   "# This is a generated file.
 # this script is run with arguments via the cmake command in add_test(NAME pcre_test_bat)
-# BatDriver feeds the actual location of pcretest.exe and pcregrep.exe
+# BatDriver feeds the actual location of pcretest.exe
 FILE(TO_NATIVE_PATH \${pcretestx} pcretest)
-FILE(TO_NATIVE_PATH \${pcregrepx} pcregrep)
 FILE(TO_NATIVE_PATH \${srcdirx} srcdir)
 configure_file(\"\${bindirx}/pcre_test.txt\" \"\${bindirx}/pcre_test.bat\")
 # MESSAGE(\"cmake\ variable\ pcretest\ is\ \${pcretest}\")
-# MESSAGE(\"cmake\ variable\ pcregrep\ is\ \${pcregrep}\")
 # STRING(REPLACE \" \" \"\\ \" bindir \${bindirx})
 MESSAGE(\"COMMAND pcre_test.bat \")
 EXECUTE_PROCESS(COMMAND pcre_test.bat
@@ -586,32 +688,33 @@
 ")


ADD_TEST(NAME pcre_test_bat
- COMMAND ${CMAKE_COMMAND} -D bindirx=${PROJECT_BINARY_DIR} -D srcdirx=${PROJECT_SOURCE_DIR} -D pcretestx=$<TARGET_FILE:pcretest> -D pcregrepx=$<TARGET_FILE:pcregrep> -P "${PROJECT_BINARY_DIR}/BatDriver.cmake")
+ COMMAND ${CMAKE_COMMAND} -D bindirx=${PROJECT_BINARY_DIR} -D srcdirx=${PROJECT_SOURCE_DIR} -D pcretestx=$<TARGET_FILE:pcretest> -P "${PROJECT_BINARY_DIR}/BatDriver.cmake")
SET_TESTS_PROPERTIES(pcre_test_bat PROPERTIES
PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")

     IF("$ENV{OSTYPE}" STREQUAL "msys")
-    # Both the sh and bat file versions of RunTest are run if make test is used
-    # in msys
-
+      # Both the sh and bat file versions of RunTest are run if make test is used
+      # in msys
       ADD_TEST(pcre_test_sh    sh.exe ${PROJECT_BINARY_DIR}/pcre_test.sh)
-      ADD_TEST(pcre_grep_test sh.exe ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
+      IF(PCRE_BUILD_PCREGREP)
+        ADD_TEST(pcre_grep_test  sh.exe ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
+      ENDIF(PCRE_BUILD_PCREGREP)
+    ENDIF("$ENV{OSTYPE}" STREQUAL "msys")


-    ENDIF("$ENV{OSTYPE}" STREQUAL "msys")
   ENDIF(WIN32)


# Changed to accommodate testing whichever location was just built

   IF(PCRE_SUPPORT_JIT)
-  ADD_TEST(pcre_jit_test       pcre_jit_test)
+    ADD_TEST(pcre_jit_test         pcre_jit_test)
   ENDIF(PCRE_SUPPORT_JIT)


   IF(PCRE_BUILD_PCRECPP)
     ADD_TEST(pcrecpp_test          pcrecpp_unittest)
     ADD_TEST(pcre_scanner_test     pcre_scanner_unittest)
     ADD_TEST(pcre_stringpiece_test pcre_stringpiece_unittest)
+  ENDIF(PCRE_BUILD_PCRECPP)


- ENDIF(PCRE_BUILD_PCRECPP)
ENDIF(PCRE_BUILD_TESTS)

# Installation
@@ -670,9 +773,11 @@
MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
MESSAGE(STATUS " C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")
MESSAGE(STATUS "")
+ MESSAGE(STATUS " Build 8 bit PCRE library ........ : ${PCRE_BUILD_PCRE8}")
+ MESSAGE(STATUS " Build 16 bit PCRE library ....... : ${PCRE_BUILD_PCRE16}")
MESSAGE(STATUS " Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
- MESSAGE(STATUS " Enable UTF-8 support ............ : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
+ MESSAGE(STATUS " Enable UTF support .............. : ${PCRE_SUPPORT_UTF}")
MESSAGE(STATUS " Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE_NEWLINE}")
MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")

Modified: code/trunk/RunTest.bat
===================================================================
--- code/trunk/RunTest.bat    2012-01-11 16:07:32 UTC (rev 862)
+++ code/trunk/RunTest.bat    2012-01-12 19:19:56 UTC (rev 863)
@@ -12,14 +12,13 @@
 @rem  options.
 @rem
 @rem Sheri Pierce added logic to skip feature dependent tests
-@rem tests 4 5 8 and 12 require utf8 support
-@rem tests 6 9 13 require ucp support
-@rem 10 requires ucp and link size 2
-@rem 14 requires presense of jit support
-@rem 15 requires absence of jit support
+@rem tests 4 5 9 15 and 18 require utf support
+@rem tests 6 7 10 16 and 19 require ucp support
+@rem 11 requires ucp and link size 2
+@rem 12 requires presense of jit support
+@rem 13 requires absence of jit support
 @rem Sheri P also added override tests for study and jit testing
-@rem JIT testing n/a for tests 7-10, removed JIT override test for them
-@rem removed override tests for 14-15
+@rem Zoltan Herczeg added libpcre16 support


setlocal enabledelayedexpansion
if [%srcdir%]==[] (
@@ -35,20 +34,11 @@
goto :eof
)

-if "%pcregrep%"=="" set pcregrep=.\pcregrep.exe
if "%pcretest%"=="" set pcretest=.\pcretest.exe

echo source dir is %srcdir%
echo pcretest=%pcretest%
-echo pcregrep=%pcregrep%

-if NOT exist "%pcregrep%" (
-echo Error: "%pcregrep%" not found!
-echo.
-call :conferror
-exit /b 1
-)
-
if NOT exist "%pcretest%" (
echo Error: "%pcretest%" not found!
echo.
@@ -56,22 +46,30 @@
exit /b 1
)

-"%pcretest%" -C|"%pcregrep%" --no-jit "No UTF-8 support">NUL
-set utf8=%ERRORLEVEL%
-"%pcretest%" -C|"%pcregrep%" --no-jit "No Unicode properties support">NUL
+"%pcretest%" -C linksize >NUL
+set link_size=%ERRORLEVEL%
+"%pcretest%" -C pcre8 >NUL
+set support8=%ERRORLEVEL%
+"%pcretest%" -C pcre16 >NUL
+set support16=%ERRORLEVEL%
+"%pcretest%" -C utf >NUL
+set utf=%ERRORLEVEL%
+"%pcretest%" -C ucp >NUL
set ucp=%ERRORLEVEL%
-"%pcretest%" -C|"%pcregrep%" --no-jit "No just-in-time compiler support">NUL
+"%pcretest%" -C jit >NUL
set jit=%ERRORLEVEL%
-"%pcretest%" -C|"%pcregrep%" --no-jit "Internal link size = 2">NUL
-set link2=%ERRORLEVEL%
-set ucpandlink2=0
-if %ucp% EQU 1 (
- if %link2% EQU 0 set ucpandlink2=1
+
+if %support8% EQU 1 (
+if not exist testout8 md testout8
+if not exist testoutstudy8 md testoutstudy8
+if not exist testoutjit8 md testoutjit8
)

-if not exist testout md testout
-if not exist testoutstudy md testoutstudy
-if not exist testoutjit md testoutjit
+if %support16% EQU 1 (
+if not exist testout16 md testout16
+if not exist testoutstudy16 md testoutstudy16
+if not exist testoutjit16 md testoutjit16
+)

set do1=no
set do2=no
@@ -88,18 +86,23 @@
set do13=no
set do14=no
set do15=no
+set do16=no
+set do17=no
+set do18=no
+set do19=no
+set do20=no
set all=yes

 for %%a in (%*) do (
   set valid=no
-  for %%v in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) do if %%v == %%a set valid=yes
+  for %%v in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) do if %%v == %%a set valid=yes
   if "!valid!" == "yes" (
     set do%%a=yes
     set all=no
 ) else (
     echo Invalid test number - %%a!
         echo Usage %0 [ test_number ] ...
-        echo Where test_number is one or more optional test numbers 1 through 15, default is all tests.
+        echo Where test_number is one or more optional test numbers 1 through 20, default is all tests.
         exit /b 1
 )
 )
@@ -121,11 +124,32 @@
   set do13=yes
   set do14=yes
   set do15=yes
+  set do16=yes
+  set do17=yes
+  set do18=yes
+  set do19=yes
+  set do20=yes
 )


@echo RunTest.bat's pcretest output is written to newly created subfolders named
@echo testout, testoutstudy and testoutjit.
@echo.
+
+set mode=
+set bits=8
+
+:nextMode
+if "%mode%" == "" (
+ if %support8% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 8-bit library ----
+ echo.
+) else (
+ if %support16% EQU 0 goto modeSkip
+ echo.
+ echo ---- Testing 16-bit library ----
+ echo.
+)
if "%do1%" == "yes" call :do1
if "%do2%" == "yes" call :do2
if "%do3%" == "yes" call :do3
@@ -141,6 +165,18 @@
if "%do13%" == "yes" call :do13
if "%do14%" == "yes" call :do14
if "%do15%" == "yes" call :do15
+if "%do16%" == "yes" call :do16
+if "%do17%" == "yes" call :do17
+if "%do18%" == "yes" call :do18
+if "%do19%" == "yes" call :do19
+if "%do20%" == "yes" call :do20
+:modeSkip
+if "%mode%" == "" (
+ set mode=-16
+ set bits=16
+ goto nextMode
+)
+
if %failed% == "yes" (
echo In above output, one or more of the various tests failed!
exit /b 1
@@ -180,17 +216,21 @@
)

 echo Test %1: %3
-"%pcretest%" %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%">%2\%testoutput%
+"%pcretest%" %mode% %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%">%2%bits%\%testoutput%
 if errorlevel 1 (
   echo.          failed executing command-line:
-  echo.            "%pcretest%" %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%"^>%2\%testoutput%
+  echo.            "%pcretest%" %mode% %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%"^>%2%bits%\%testoutput%
   set failed="yes"
   goto :eof
 )


-fc /n "%srcdir%\testdata\%testoutput%" "%2\%testoutput%">NUL
+if [%1]==[11] (
+  fc /n "%srcdir%\testdata\%testoutput%-%bits%" "%2%bits%\%testoutput%">NUL
+) else (
+  fc /n "%srcdir%\testdata\%testoutput%" "%2%bits%\%testoutput%">NUL
+)
 if errorlevel 1 (
-  echo.          failed comparison: fc /n "%srcdir%\testdata\%testoutput%" "%2\%testoutput%"
+  echo.          failed comparison: fc /n "%srcdir%\testdata\%testoutput%" "%2%bits%\%testoutput%"
   set failed="yes"
   if [%1]==[2] (
     echo.
@@ -202,6 +242,7 @@
     echo.
 )
   if [%1]==[3] (
+    set failed="no"
     echo.
     echo ** Test 3 failure usually means french locale is not
     echo ** available on the system, rather than a bug or problem with PCRE.
@@ -233,109 +274,187 @@
 goto :eof


:do4
- if %utf8% EQU 0 (
- echo Test 4 Skipped due to absence of UTF-8 support.
+ if %utf% EQU 0 (
+ echo Test 4 Skipped due to absence of UTF-%bits% support.
goto :eof
)
- call :runsub 4 testout "UTF-8 support - Compatible with Perl 5.8 and above" -q
+ call :runsub 4 testout "UTF-%bits% support - Compatible with Perl 5.8 and above" -q
call :runsub 4 testoutstudy "Test with Study Override" -q -s
if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
goto :eof

:do5
- if %utf8% EQU 0 (
- echo Test 5 Skipped due to absence of UTF-8 support.
+ if %utf% EQU 0 (
+ echo Test 5 Skipped due to absence of UTF-%bits% support.
goto :eof
)
- call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-8 support" -q
+ call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-%bits% support" -q
call :runsub 5 testoutstudy "Test with Study Override" -q -s
if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
goto :eof

:do6
if %ucp% EQU 0 (
- echo Test 6 Skipped due to absence of ucp support.
+ echo Test 6 Skipped due to absence of Unicode property support.
goto :eof
)
- call :runsub 6 testout "Unicode property support - Compatible with Perl 5.10 and above" -q
+ call :runsub 6 testout "Unicode property support (Compatible with Perl >= 5.10)" -q
call :runsub 6 testoutstudy "Test with Study Override" -q -s
if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
goto :eof

:do7
- call :runsub 7 testout "DFA matching" -q -dfa
- call :runsub 7 testoutstudy "Test with Study Override" -q -dfa -s
+if %ucp% EQU 0 (
+ echo Test 7 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 7 testout "API, internals, and non-Perl stuff for Unicode property support" -q
+ call :runsub 7 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -s+
goto :eof

:do8
- if %utf8% EQU 0 (
- echo Test 8 Skipped due to absence of UTF-8 support.
- goto :eof
-)
- call :runsub 8 testout "DFA matching with UTF-8" -q -dfa
+ call :runsub 8 testout "DFA matching main functionality" -q -dfa
call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
- goto :eof
+goto :eof

:do9
- if %ucp% EQU 0 (
- echo Test 9 Skipped due to absence of ucp support.
+ if %utf% EQU 0 (
+ echo Test 9 Skipped due to absence of UTF-%bits% support.
goto :eof
)
- call :runsub 9 testout "DFA matching with Unicode properties" -q -dfa
+ call :runsub 9 testout "DFA matching with UTF-%bits%" -q -dfa
call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
-goto :eof
+ goto :eof

:do10
- if %ucpandlink2% EQU 0 (
- echo Test 10 Skipped due to requirements of ucp support AND link size 2.
+ if %ucp% EQU 0 (
+ echo Test 10 Skipped due to absence of Unicode property support.
goto :eof
)
- call :runsub 10 testout "Internal offsets and code size tests" -q
- call :runsub 10 testoutstudy "Test with Study Override" -q -s
+ call :runsub 10 testout "DFA matching with Unicode properties" -q -dfa
+ call :runsub 10 testoutstudy "Test with Study Override" -q -dfa -s
goto :eof

:do11
- call :runsub 11 testout "Features from Perl 5.10 and above" -q
+ if NOT %link_size% EQU 2 (
+ echo Test 11 Skipped because link size is not 2.
+ goto :eof
+)
+ if %ucp% EQU 0 (
+ echo Test 11 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 11 testout "Internal offsets and code size tests" -q
call :runsub 11 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 11 testoutjit "Test with JIT Override" -q -s+
goto :eof

:do12
- if %utf8% EQU 0 (
- echo Test 12 Skipped due to absence of UTF-8 support.
+if %jit% EQU 0 (
+ echo Test 12 Skipped due to absence of JIT support.
goto :eof
)
- call :runsub 12 testout "Features from Perl 5.10 and above w UTF-8" -q
- call :runsub 12 testoutstudy "Test with Study Override" -q -s
- if %jit% EQU 1 call :runsub 12 testoutjit "Test with JIT Override" -q -s+
+ call :runsub 12 testout "JIT-specific features - have JIT" -q
goto :eof

:do13
- if %ucp% EQU 0 (
- echo Test 13 Skipped due to absence of ucp support.
+ if %jit% EQU 1 (
+ echo Test 13 Skipped due to presence of JIT support.
goto :eof
)
-call :runsub 13 testout "API internals and non-Perl stuff for Unicode property support" -q
-call :runsub 13 testoutstudy "Test with Study Override" -q -s
-if %jit% EQU 1 call :runsub 13 testoutjit "Test with JIT Override" -q -s+
+ call :runsub 13 testout "JIT-specific features - no JIT" -q
goto :eof

:do14
-if %jit% EQU 0 (
- echo Test 14 Skipped due to absence of JIT support.
+ if NOT %bits% EQU 8 (
+ echo Test 14 Skipped when running 16-bit tests.
goto :eof
)
- call :runsub 14 testout "JIT-specific features - have JIT" -q
+ call :runsub 14 testout "Specials for the basic 8-bit library" -q
+ call :runsub 14 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 14 testoutjit "Test with JIT Override" -q -s+
goto :eof

:do15
- if %jit% EQU 1 (
- echo Test 15 Skipped due to presence of JIT support.
+ if NOT %bits% EQU 8 (
+ echo Test 15 Skipped when running 16-bit tests.
goto :eof
)
- call :runsub 15 testout "JIT-specific features - no JIT" -q
+ if %utf% EQU 0 (
+ echo Test 15 Skipped due to absence of UTF-8 support.
+ goto :eof
+)
+ call :runsub 15 testout "Specials for the 8-bit library with UTF-8 support" -q
+ call :runsub 15 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 15 testoutjit "Test with JIT Override" -q -s+
goto :eof

+:do16
+ if NOT %bits% EQU 8 (
+ echo Test 16 Skipped when running 16-bit tests.
+ goto :eof
+)
+ if %ucp% EQU 0 (
+ echo Test 16 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 16 testout "Specials for the 8-bit library with Unicode propery support" -q
+ call :runsub 16 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 16 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do17
+ if NOT %bits% EQU 16 (
+ echo Test 17 Skipped when running 8-bit tests.
+ goto :eof
+)
+ copy /Y "%srcdir%\testdata\saved8" testsaved8
+ copy /Y "%srcdir%\testdata\saved16LE-1" testsaved16LE-1
+ copy /Y "%srcdir%\testdata\saved16BE-1" testsaved16BE-1
+ call :runsub 17 testout "Specials for the basic 8-bit library" -q
+ call :runsub 17 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 17 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do18
+ if NOT %bits% EQU 16 (
+ echo Test 18 Skipped when running 8-bit tests.
+ goto :eof
+)
+ if %utf% EQU 0 (
+ echo Test 18 Skipped due to absence of UTF-8 support.
+ goto :eof
+)
+ copy /Y "%srcdir%\testdata\saved16LE-2" testsaved16LE-2
+ copy /Y "%srcdir%\testdata\saved16BE-2" testsaved16BE-2
+ call :runsub 18 testout "Specials for the basic 8-bit library" -q
+ call :runsub 18 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 18 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do19
+ if NOT %bits% EQU 16 (
+ echo Test 19 Skipped when running 8-bit tests.
+ goto :eof
+)
+ if %ucp% EQU 0 (
+ echo Test 19 Skipped due to absence of Unicode property support.
+ goto :eof
+)
+ call :runsub 19 testout "Specials for the basic 8-bit library" -q
+ call :runsub 19 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 19 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do20
+ if NOT %bits% EQU 16 (
+ echo Test 20 Skipped when running 8-bit tests.
+ goto :eof
+)
+ call :runsub 20 testout "DFA specials for the basic 16-bit library" -q
+ call :runsub 20 testoutstudy "Test with Study Override" -q -s
+goto :eof
+
:conferror
@echo.
@echo Either your build is incomplete or you have a configuration error.

Modified: code/trunk/config-cmake.h.in
===================================================================
--- code/trunk/config-cmake.h.in    2012-01-11 16:07:32 UTC (rev 862)
+++ code/trunk/config-cmake.h.in    2012-01-12 19:19:56 UTC (rev 863)
@@ -18,9 +18,11 @@


#cmakedefine PCRE_STATIC 1

+#cmakedefine SUPPORT_PCRE8 1
+#cmakedefine SUPPORT_PCRE16 1
#cmakedefine SUPPORT_JIT 1
#cmakedefine SUPPORT_PCREGREP_JIT 1
-#cmakedefine SUPPORT_UTF8 1
+#cmakedefine SUPPORT_UTF 1
#cmakedefine SUPPORT_UCP 1
#cmakedefine EBCDIC 1
#cmakedefine BSR_ANYCRLF 1