/[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 199 by ph10, Tue Jul 31 14:39:09 2007 UTC
# Line 6  Line 6 
6  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.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2006 University of Cambridge             Copyright (c) 1997-2007 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  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 41  POSSIBILITY OF SUCH DAMAGE.
41  /* This module contains code for searching the table of Unicode character  /* This module contains code for searching the table of Unicode character
42  properties. */  properties. */
43    
44    #ifdef HAVE_CONFIG_H
45    #include <config.h>
46    #endif
47    
48  #include "pcre_internal.h"  #include "pcre_internal.h"
49    
50  #include "ucp.h"               /* Category definitions */  #include "ucp.h"               /* Category definitions */
51  #include "ucpinternal.h"       /* Internal table details */  #include "ucpinternal.h"       /* Internal table details */
52  #include "ucptable.c"          /* The table itself */  #include "ucptable.h"          /* The table itself */
53    
54    
55  /* Table to translate from particular type value to the general value. */  /* Table to translate from particular type value to the general value. */
56    
57  static int ucp_gentype[] = {  static const int ucp_gentype[] = {
58    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 */
59    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 */
60    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 83  Returns:      the character type categor
83  */  */
84    
85  int  int
86  _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)
87  {  {
88  int bot = 0;  int bot = 0;
89  int top = sizeof(ucp_table)/sizeof(cnode);  int top = sizeof(ucp_table)/sizeof(cnode);
# Line 131  letter, return the other case. Otherwise Line 135  letter, return the other case. Otherwise
135  Arguments:  Arguments:
136    c           the character value    c           the character value
137    
138  Returns:      the other case or -1 if none  Returns:      the other case or NOTACHAR if none
139  */  */
140    
141  int  unsigned int
142  _pcre_ucp_othercase(const int c)  _pcre_ucp_othercase(const unsigned int c)
143  {  {
144  int bot = 0;  int bot = 0;
145  int top = sizeof(ucp_table)/sizeof(cnode);  int top = sizeof(ucp_table)/sizeof(cnode);
# Line 161  for (;;) Line 165  for (;;)
165      }      }
166    }    }
167    
168  /* 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
169  the other case if there is one, else -1. */  return the other case if there is one, else NOTACHAR. */
170    
171  if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return -1;  if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return NOTACHAR;
172    
173  offset = ucp_table[mid].f1 & f1_casemask;  offset = ucp_table[mid].f1 & f1_casemask;
174  if ((offset & f1_caseneg) != 0) offset |= f1_caseneg;  if ((offset & f1_caseneg) != 0) offset |= f1_caseneg;
175  return (offset == 0)? -1 : c + offset;  return (offset == 0)? NOTACHAR : c + offset;
176  }  }
177    
178    

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

  ViewVC Help
Powered by ViewVC 1.1.5