/[pcre]/code/tags/pcre-7.1/pcre_ucp_searchfuncs.c
ViewVC logotype

Diff of /code/tags/pcre-7.1/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 117 by ph10, Fri Mar 9 15:59:06 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 45  properties. */ Line 45  properties. */
45    
46  #include "ucp.h"               /* Category definitions */  #include "ucp.h"               /* Category definitions */
47  #include "ucpinternal.h"       /* Internal table details */  #include "ucpinternal.h"       /* Internal table details */
48  #include "ucptable.c"          /* The table itself */  #include "ucptable.h"          /* The table itself */
49    
50    
51  /* Table to translate from particular type value to the general value. */  /* Table to translate from particular type value to the general value. */
52    
53  static int ucp_gentype[] = {  static const int ucp_gentype[] = {
54    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 */
55    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 */
56    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 79  Returns: the character type categor
79  */  */
80    
81  int  int
82  _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)
83  {  {
84  int bot = 0;  int bot = 0;
85  int top = sizeof(ucp_table)/sizeof(cnode);  int top = sizeof(ucp_table)/sizeof(cnode);
# Line 131  letter, return the other case. Otherwise Line 131  letter, return the other case. Otherwise
131  Arguments:  Arguments:
132    c           the character value    c           the character value
133    
134  Returns:      the other case or -1 if none  Returns:      the other case or NOTACHAR if none
135  */  */
136    
137  int  unsigned int
138  _pcre_ucp_othercase(const int c)  _pcre_ucp_othercase(const unsigned int c)
139  {  {
140  int bot = 0;  int bot = 0;
141  int top = sizeof(ucp_table)/sizeof(cnode);  int top = sizeof(ucp_table)/sizeof(cnode);
# Line 161  for (;;) Line 161  for (;;)
161      }      }
162    }    }
163    
164  /* 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
165  the other case if there is one, else -1. */  return the other case if there is one, else NOTACHAR. */
166    
167  if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return -1;  if ((ucp_table[mid].f0 & f0_rangeflag) != 0) return NOTACHAR;
168    
169  offset = ucp_table[mid].f1 & f1_casemask;  offset = ucp_table[mid].f1 & f1_casemask;
170  if ((offset & f1_caseneg) != 0) offset |= f1_caseneg;  if ((offset & f1_caseneg) != 0) offset |= f1_caseneg;
171  return (offset == 0)? -1 : c + offset;  return (offset == 0)? NOTACHAR : c + offset;
172  }  }
173    
174    

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12