summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-27 12:24:23 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-27 12:24:23 +0000
commit066b6208e6c9f7e992cdfe62e8807b1243f09caf (patch)
tree2c3088f482e0903ea10a65280b95ef634ad8776b
parent041f627ce61da03579a61be8c8854a2fbf144fe0 (diff)
downloadpcre-066b6208e6c9f7e992cdfe62e8807b1243f09caf.tar.gz
Change some preprocessor directives to support various configure modes
git-svn-id: svn://vcs.exim.org/pcre/code/branches/pcre16@829 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--pcre_tables.c11
-rw-r--r--pcretest.c19
2 files changed, 19 insertions, 11 deletions
diff --git a/pcre_tables.c b/pcre_tables.c
index 4b27b83..d3f98f9 100644
--- a/pcre_tables.c
+++ b/pcre_tables.c
@@ -67,9 +67,10 @@ const pcre_uint8 PRIV(OP_lengths)[] = { OP_LENGTHS };
/* These are the breakpoints for different numbers of bytes in a UTF-8
character. */
-#ifdef SUPPORT_UTF
+#if (defined SUPPORT_UTF && defined COMPILE_PCRE8) \
+ || (defined PCRE_INCLUDED && defined SUPPORT_PCRE16)
-#ifdef COMPILE_PCRE8
+/* These tables are also required by pcretest in 16 bit mode. */
const int PRIV(utf8_table1)[] =
{ 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
@@ -91,7 +92,9 @@ const pcre_uint8 PRIV(utf8_table4)[] = {
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
-#endif /* COMPILE_PCRE8 */
+#endif /* (SUPPORT_UTF && COMPILE_PCRE8) || (PCRE_INCLUDED && SUPPORT_PCRE16)*/
+
+#ifdef SUPPORT_UTF
/* Table to translate from particular type value to the general value. */
@@ -119,7 +122,7 @@ const int PRIV(ucp_typerange)[] = {
ucp_Sc, ucp_So,
ucp_Zl, ucp_Zs,
};
-#endif
+#endif /* SUPPORT_JIT */
/* The pcre_utt[] table below translates Unicode property names into type and
code values. It is searched by binary chop, so must be in collating sequence of
diff --git a/pcretest.c b/pcretest.c
index c43d01c..1b6f089 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -160,6 +160,11 @@ that differ in their output from isprint() even in the "C" locale. */
#define PRINTOK(c) (locale_set? isprint(c) : PRINTABLE(c))
+/* Posix support is disabled in 16 bit only mode. */
+#if defined SUPPORT_PCRE16 && !defined SUPPORT_PCRE8 && !defined NOPOSIX
+#define NOPOSIX
+#endif
+
/* It is possible to compile this test program without including support for
testing the POSIX interface, though this is not available via the standard
Makefile. */
@@ -1028,7 +1033,7 @@ return (pcre_jit_stack *)arg;
}
-#if !defined NOUTF
+#if !defined NOUTF || defined SUPPORT_PCRE16
/*************************************************
* Convert UTF-8 string to value *
*************************************************/
@@ -1084,11 +1089,11 @@ if (j != i) return -(i+1);
*vptr = d;
return i+1;
}
-#endif /* NOUTF */
+#endif /* NOUTF || SUPPORT_PCRE16 */
-#if !defined NOUTF
+#if !defined NOUTF || defined SUPPORT_PCRE16
/*************************************************
* Convert character value to UTF-8 *
*************************************************/
@@ -1118,7 +1123,7 @@ for (j = i; j > 0; j--)
*utf8bytes = utf8_table2[i] | cvalue;
return i + 1;
}
-#endif
+#endif /* NOUTF || SUPPORT_PCRE16 */
@@ -3624,16 +3629,16 @@ while (!done)
}
continue;
}
-
+
/* We now have a character value in c that may be greater than 255. In
16-bit mode, we always convert characters to UTF-8 so that values greater
than 255 can be passed to non-UTF 16-bit strings. In 8-bit mode we
convert to UTF-8 if we are in UTF mode. Values greater than 127 in UTF
mode must have come from \x{...} or octal constructs because values from
\x.. get this far only in non-UTF mode. */
-
+
if (use_pcre16 || use_utf)
- {
+ {
pcre_uint8 buff8[8];
int ii, utn;
utn = ord2utf8(c, buff8);