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

Diff of /code/trunk/pcre_ucp_searchfuncs.c

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

revision 87 by nigel, Sat Feb 24 21:41:21 2007 UTC revision 351 by ph10, Fri Jul 4 18:27:16 2008 UTC
# Line 1  Line 1 
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  *************************************************/  *************************************************/
# Line 6  Line 15 
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
# Line 41  POSSIBILITY OF SUCH DAMAGE. Line 50  POSSIBILITY OF SUCH DAMAGE.
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 */
# Line 79  Returns:      the character type categor Line 92  Returns:      the character type categor
92  */  */
93    
94  int  int
95  _pcre_ucp_findprop(const int c, int *type_ptr, int *script_ptr)  _pcre_ucp_findprop(const unsigned int c, int *type_ptr, int *script_ptr)
96  {  {
97  int bot = 0;  int bot = 0;
98  int top = sizeof(ucp_table)/sizeof(cnode);  int top = sizeof(ucp_table)/sizeof(cnode);
# Line 131  letter, return the other case. Otherwise Line 144  letter, return the other case. Otherwise
144  Arguments:  Arguments:
145    c           the character value    c           the character value
146    
147  Returns:      the other case or -1 if none  Returns:      the other case or NOTACHAR if none
148  */  */
149    
150  int  unsigned int
151  _pcre_ucp_othercase(const int c)  _pcre_ucp_othercase(const unsigned int c)
152  {  {
153  int bot = 0;  int bot = 0;
154  int top = sizeof(ucp_table)/sizeof(cnode);  int top = sizeof(ucp_table)/sizeof(cnode);
# Line 161  for (;;) Line 174  for (;;)
174      }      }
175    }    }
176    
177  /* Found an entry in the table. Return -1 for a range entry. Otherwise return  /* Found an entry in the table. Return NOTACHAR for a range entry. Otherwise
178  the other case if there is one, else -1. */  return the other case if there is one, else NOTACHAR. */
179    
180  if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return -1;  if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return NOTACHAR;
181    
182  offset = ucp_table[mid].f1 & f1_casemask;  offset = ucp_table[mid].f1 & f1_casemask;
183  if ((offset & f1_caseneg) != 0) offset |= f1_caseneg;  if ((offset & f1_caseneg) != 0) offset |= f1_caseneg;
184  return (offset == 0)? -1 : c + offset;  return (offset == 0)? NOTACHAR : c + offset;
185  }  }
186    
187    

Legend:
Removed from v.87  
changed lines
  Added in v.351

  ViewVC Help
Powered by ViewVC 1.1.5