| 1 |
|
############################################################ |
| 2 |
|
############################################################ |
| 3 |
|
## As of PCRE 8.0 this file is OBSOLETE. A different way ## |
| 4 |
|
## of handling Unicode property data is now used. See the ## |
| 5 |
|
## maint/README document. ## |
| 6 |
|
## PH 02 July 2008 ## |
| 7 |
|
############################################################ |
| 8 |
|
############################################################ |
| 9 |
|
|
| 10 |
/************************************************* |
/************************************************* |
| 11 |
* Perl-Compatible Regular Expressions * |
* Perl-Compatible Regular Expressions * |
| 12 |
*************************************************/ |
*************************************************/ |
| 15 |
and semantics are as close as possible to those of the Perl 5 language. |
and semantics are as close as possible to those of the Perl 5 language. |
| 16 |
|
|
| 17 |
Written by Philip Hazel |
Written by Philip Hazel |
| 18 |
Copyright (c) 1997-2006 University of Cambridge |
Copyright (c) 1997-2008 University of Cambridge |
| 19 |
|
|
| 20 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
| 21 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
| 50 |
/* This module contains code for searching the table of Unicode character |
/* This module contains code for searching the table of Unicode character |
| 51 |
properties. */ |
properties. */ |
| 52 |
|
|
| 53 |
|
#ifdef HAVE_CONFIG_H |
| 54 |
|
#include "config.h" |
| 55 |
|
#endif |
| 56 |
|
|
| 57 |
#include "pcre_internal.h" |
#include "pcre_internal.h" |
| 58 |
|
|
| 59 |
#include "ucp.h" /* Category definitions */ |
#include "ucp.h" /* Category definitions */ |
| 60 |
#include "ucpinternal.h" /* Internal table details */ |
#include "ucpinternal.h" /* Internal table details */ |
| 61 |
#include "ucptable.c" /* The table itself */ |
#include "ucptable.h" /* The table itself */ |
| 62 |
|
|
| 63 |
|
|
| 64 |
/* Table to translate from particular type value to the general value. */ |
/* Table to translate from particular type value to the general value. */ |
| 65 |
|
|
| 66 |
static int ucp_gentype[] = { |
static const int ucp_gentype[] = { |
| 67 |
ucp_C, ucp_C, ucp_C, ucp_C, ucp_C, /* Cc, Cf, Cn, Co, Cs */ |
ucp_C, ucp_C, ucp_C, ucp_C, ucp_C, /* Cc, Cf, Cn, Co, Cs */ |
| 68 |
ucp_L, ucp_L, ucp_L, ucp_L, ucp_L, /* Ll, Lu, Lm, Lo, Lt */ |
ucp_L, ucp_L, ucp_L, ucp_L, ucp_L, /* Ll, Lu, Lm, Lo, Lt */ |
| 69 |
ucp_M, ucp_M, ucp_M, /* Mc, Me, Mn */ |
ucp_M, ucp_M, ucp_M, /* Mc, Me, Mn */ |
| 161 |
|
|
| 162 |
for (;;) |
for (;;) |
| 163 |
{ |
{ |
| 164 |
if (top <= bot) return -1; |
if (top <= bot) return (unsigned int)(-1); |
| 165 |
mid = (bot + top) >> 1; |
mid = (bot + top) >> 1; |
| 166 |
if (c == (ucp_table[mid].f0 & f0_charmask)) break; |
if (c == (ucp_table[mid].f0 & f0_charmask)) break; |
| 167 |
if (c < (ucp_table[mid].f0 & f0_charmask)) top = mid; |
if (c < (ucp_table[mid].f0 & f0_charmask)) top = mid; |