/[pcre]/code/trunk/pcretest.c
ViewVC logotype

Diff of /code/trunk/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1030 by ph10, Sat Sep 8 15:58:38 2012 UTC revision 1033 by ph10, Mon Sep 10 11:02:48 2012 UTC
# Line 1103  return sys_errlist[n]; Line 1103  return sys_errlist[n];
1103  *************************************************/  *************************************************/
1104    
1105  /*  /*
1106  Argument: the return code from PCRE_CONFIG_NEWLINE  Arguments:
1107  Returns:  nothing    rc         the return code from PCRE_CONFIG_NEWLINE
1108      isc        TRUE if called from "-C newline"
1109    Returns:     nothing
1110  */  */
1111    
1112  static void  static void
1113  print_newline_config(int rc)  print_newline_config(int rc, BOOL isc)
1114  {  {
1115  const char *s = NULL;  const char *s = NULL;
1116  printf("  Newline sequence is ");  if (!isc) printf("  Newline sequence is ");
1117  switch(rc)  switch(rc)
1118    {    {
1119    case CHAR_CR: s = "CR"; break;    case CHAR_CR: s = "CR"; break;
# Line 2407  while (argc > 1 && argv[op][0] == '-') Line 2409  while (argc > 1 && argv[op][0] == '-')
2409          (void)PCRE_CONFIG(PCRE_CONFIG_LINK_SIZE, &rc);          (void)PCRE_CONFIG(PCRE_CONFIG_LINK_SIZE, &rc);
2410          printf("%d\n", rc);          printf("%d\n", rc);
2411          yield = rc;          yield = rc;
         goto EXIT;  
2412          }          }
2413        if (strcmp(argv[op + 1], "pcre8") == 0)        else if (strcmp(argv[op + 1], "pcre8") == 0)
2414          {          {
2415  #ifdef SUPPORT_PCRE8  #ifdef SUPPORT_PCRE8
2416          printf("1\n");          printf("1\n");
# Line 2418  while (argc > 1 && argv[op][0] == '-') Line 2419  while (argc > 1 && argv[op][0] == '-')
2419          printf("0\n");          printf("0\n");
2420          yield = 0;          yield = 0;
2421  #endif  #endif
         goto EXIT;  
2422          }          }
2423        if (strcmp(argv[op + 1], "pcre16") == 0)        else if (strcmp(argv[op + 1], "pcre16") == 0)
2424          {          {
2425  #ifdef SUPPORT_PCRE16  #ifdef SUPPORT_PCRE16
2426          printf("1\n");          printf("1\n");
# Line 2429  while (argc > 1 && argv[op][0] == '-') Line 2429  while (argc > 1 && argv[op][0] == '-')
2429          printf("0\n");          printf("0\n");
2430          yield = 0;          yield = 0;
2431  #endif  #endif
         goto EXIT;  
2432          }          }
2433        if (strcmp(argv[op + 1], "utf") == 0)        else if (strcmp(argv[op + 1], "utf") == 0)
2434          {          {
2435  #ifdef SUPPORT_PCRE8  #ifdef SUPPORT_PCRE8
2436          (void)pcre_config(PCRE_CONFIG_UTF8, &rc);          (void)pcre_config(PCRE_CONFIG_UTF8, &rc);
# Line 2442  while (argc > 1 && argv[op][0] == '-') Line 2441  while (argc > 1 && argv[op][0] == '-')
2441          printf("%d\n", rc);          printf("%d\n", rc);
2442          yield = rc;          yield = rc;
2443  #endif  #endif
         goto EXIT;  
2444          }          }
2445        if (strcmp(argv[op + 1], "ucp") == 0)        else if (strcmp(argv[op + 1], "ucp") == 0)
2446          {          {
2447          (void)PCRE_CONFIG(PCRE_CONFIG_UNICODE_PROPERTIES, &rc);          (void)PCRE_CONFIG(PCRE_CONFIG_UNICODE_PROPERTIES, &rc);
2448          printf("%d\n", rc);          printf("%d\n", rc);
2449          yield = rc;          yield = rc;
         goto EXIT;  
2450          }          }
2451        if (strcmp(argv[op + 1], "jit") == 0)        else if (strcmp(argv[op + 1], "jit") == 0)
2452          {          {
2453          (void)PCRE_CONFIG(PCRE_CONFIG_JIT, &rc);          (void)PCRE_CONFIG(PCRE_CONFIG_JIT, &rc);
2454          printf("%d\n", rc);          printf("%d\n", rc);
2455          yield = rc;          yield = rc;
         goto EXIT;  
2456          }          }
2457        if (strcmp(argv[op + 1], "newline") == 0)        else if (strcmp(argv[op + 1], "newline") == 0)
2458          {          {
2459          (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);          (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);
2460          print_newline_config(rc);          print_newline_config(rc, TRUE);
         goto EXIT;  
2461          }          }
2462        printf("Unknown -C option: %s\n", argv[op + 1]);        else if (strcmp(argv[op + 1], "ebcdic") == 0)
2463            {
2464    #ifdef EBCDIC
2465            printf("1\n");
2466            yield = 1;
2467    #else
2468            printf("0\n");
2469    #endif
2470            }
2471          else if (strcmp(argv[op + 1], "ebcdic-nl") == 0)
2472            {
2473    #ifdef EBCDIC
2474            printf("0x%02x\n", CHAR_LF);
2475    #else
2476            printf("0\n");
2477    #endif
2478            }
2479          else
2480            {
2481            printf("Unknown -C option: %s\n", argv[op + 1]);
2482            }
2483        goto EXIT;        goto EXIT;
2484        }        }
2485    
2486        /* No argument for -C: output all configuration information. */
2487    
2488      printf("PCRE version %s\n", version);      printf("PCRE version %s\n", version);
2489      printf("Compiled with\n");      printf("Compiled with\n");
# Line 2507  are set, either both UTFs are supported Line 2524  are set, either both UTFs are supported
2524      else      else
2525        printf("  No just-in-time compiler support\n");        printf("  No just-in-time compiler support\n");
2526      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);
2527      print_newline_config(rc);      print_newline_config(rc, FALSE);
2528      (void)PCRE_CONFIG(PCRE_CONFIG_BSR, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_BSR, &rc);
2529      printf("  \\R matches %s\n", rc? "CR, LF, or CRLF only" :      printf("  \\R matches %s\n", rc? "CR, LF, or CRLF only" :
2530                                       "all Unicode newlines");                                       "all Unicode newlines");

Legend:
Removed from v.1030  
changed lines
  Added in v.1033

  ViewVC Help
Powered by ViewVC 1.1.5