[Pcre-svn] [112] code/trunk/src/pcre2test.c: Fix Unicode ver…

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [112] code/trunk/src/pcre2test.c: Fix Unicode version and JIT target output .
Revision: 112
          http://www.exim.org/viewvc/pcre2?view=rev&revision=112
Author:   ph10
Date:     2014-10-14 18:07:46 +0100 (Tue, 14 Oct 2014)


Log Message:
-----------
Fix Unicode version and JIT target output.

Modified Paths:
--------------
    code/trunk/src/pcre2test.c


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2014-10-14 16:41:13 UTC (rev 111)
+++ code/trunk/src/pcre2test.c    2014-10-14 17:07:46 UTC (rev 112)
@@ -616,6 +616,7 @@
 static uint32_t max_oveccount;
 static uint32_t callout_count;


+static VERSION_TYPE jittarget[VERSION_SIZE];
static VERSION_TYPE version[VERSION_SIZE];
static VERSION_TYPE uversion[VERSION_SIZE];

@@ -1103,7 +1104,7 @@
   if (test_mode == G(G(PCRE,BITONE),_MODE)) \
     G(pcre2_jit_stack_free_,BITONE)((G(pcre2_jit_stack_,BITONE) *)a); \
   else \
-    G(pcre2_jit_stack_free_,BITWO)((G(pcre2_jit_stack_,BITTWO) *)a);
+    G(pcre2_jit_stack_free_,BITTWO)((G(pcre2_jit_stack_,BITTWO) *)a);


 #define PCRE2_MAKETABLES(a) \
   if (test_mode == G(G(PCRE,BITONE),_MODE)) \
@@ -5103,8 +5104,6 @@
 *               Print PCRE2 version              *
 *************************************************/


-/* The version string was read into 'version' at the start of execution. */
-
static void
print_version(FILE *f)
{
@@ -5117,6 +5116,33 @@


 /*************************************************
+*               Print Unicode version            *
+*************************************************/
+
+static void
+print_unicode_version(FILE *f)
+{
+VERSION_TYPE *vp;
+fprintf(f, "Unicode version ");
+for (vp = uversion; *vp != 0; vp++) fprintf(f, "%c", *vp);
+}
+
+
+
+/*************************************************
+*               Print JIT target                 *
+*************************************************/
+
+static void
+print_jit_target(FILE *f)
+{
+VERSION_TYPE *vp;
+for (vp = jittarget; *vp != 0; vp++) fprintf(f, "%c", *vp);
+}
+
+
+
+/*************************************************
 *       Print newline configuration              *
 *************************************************/


@@ -5293,23 +5319,25 @@

(void)PCRE2_CONFIG(PCRE2_CONFIG_UNICODE, &rc, sizeof(rc));
if (rc != 0)
- printf(" UTF and UCP support (Unicode version %s)\n", uversion);
-else
- printf(" No UTF or UCP support\n");
+ {
+ printf(" UTF and UCP support (");
+ print_unicode_version(stdout);
+ printf(")\n");
+ }
+else printf(" No UTF or UCP support\n");
+
(void)PCRE2_CONFIG(PCRE2_CONFIG_JIT, &rc, sizeof(rc));
if (rc != 0)
{
-/* FIXME: config needs sorting for jit target
- const char *arch;
- (void)PCRE2_CONFIG(PCRE2_CONFIG_JITTARGET, (void *)(&arch));
- printf(" Just-in-time compiler support: %s\n", arch);
-*/
- printf(" Just-in-time compiler support: FIXME\n");
+ printf(" Just-in-time compiler support: ");
+ print_jit_target(stdout);
+ printf("\n");
}
else
{
printf(" No just-in-time compiler support\n");
}
+
(void)PCRE2_CONFIG(PCRE2_CONFIG_NEWLINE, &rc, sizeof(rc));
print_newline_config(rc, FALSE);
(void)PCRE2_CONFIG(PCRE2_CONFIG_BSR, &rc, sizeof(rc));
@@ -5362,11 +5390,13 @@
return 1;
}

-/* Get the PCRE2 and Unicode version number information. */
+/* Get the PCRE2 and Unicode version number and JIT target information. */

PCRE2_CONFIG(PCRE2_CONFIG_VERSION, version, sizeof(VERSION_TYPE)*VERSION_SIZE);
PCRE2_CONFIG(PCRE2_CONFIG_UNICODE_VERSION, uversion,
sizeof(VERSION_TYPE)*VERSION_SIZE);
+PCRE2_CONFIG(PCRE2_CONFIG_JITTARGET, jittarget,
+ sizeof(VERSION_TYPE)*VERSION_SIZE);

/* Get buffers from malloc() so that valgrind will check their misuse when
debugging. They grow automatically when very long lines are read. The 16-