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

Diff of /code/trunk/pcre_ord2utf8.c

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

revision 77 by nigel, Sat Feb 24 21:40:45 2007 UTC revision 349 by ph10, Wed Jul 2 18:42:11 2008 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-2005 University of Cambridge             Copyright (c) 1997-2008 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 file contains a private PCRE function that converts an ordinal  /* This file contains a private PCRE function that converts an ordinal
42  character value into a UTF8 string. */  character value into a UTF8 string. */
43    
44    #ifdef HAVE_CONFIG_H
45    #include "config.h"
46    #endif
47    
48  #include "pcre_internal.h"  #include "pcre_internal.h"
49    
# Line 59  Arguments: Line 62  Arguments:
62  Returns:     number of characters placed in the buffer  Returns:     number of characters placed in the buffer
63  */  */
64    
65  EXPORT int  int
66  _pcre_ord2utf8(int cvalue, uschar *buffer)  _pcre_ord2utf8(int cvalue, uschar *buffer)
67  {  {
68    #ifdef SUPPORT_UTF8
69  register int i, j;  register int i, j;
70  for (i = 0; i < _pcre_utf8_table1_size; i++)  for (i = 0; i < _pcre_utf8_table1_size; i++)
71    if (cvalue <= _pcre_utf8_table1[i]) break;    if (cvalue <= _pcre_utf8_table1[i]) break;
# Line 73  for (j = i; j > 0; j--) Line 77  for (j = i; j > 0; j--)
77   }   }
78  *buffer = _pcre_utf8_table2[i] | cvalue;  *buffer = _pcre_utf8_table2[i] | cvalue;
79  return i + 1;  return i + 1;
80    #else
81    return 0;   /* Keep compiler happy; this function won't ever be */
82    #endif      /* called when SUPPORT_UTF8 is not defined. */
83  }  }
84    
85    /* Table to translate from particular type value to the general value. */
86    
87    const int ucp_gentype[] = {
88      ucp_C, ucp_C, ucp_C, ucp_C, ucp_C,  /* Cc, Cf, Cn, Co, Cs */
89      ucp_L, ucp_L, ucp_L, ucp_L, ucp_L,  /* Ll, Lu, Lm, Lo, Lt */
90      ucp_M, ucp_M, ucp_M,                /* Mc, Me, Mn */
91      ucp_N, ucp_N, ucp_N,                /* Nd, Nl, No */
92      ucp_P, ucp_P, ucp_P, ucp_P, ucp_P,  /* Pc, Pd, Pe, Pf, Pi */
93      ucp_P, ucp_P,                       /* Ps, Po */
94      ucp_S, ucp_S, ucp_S, ucp_S,         /* Sc, Sk, Sm, So */
95      ucp_Z, ucp_Z, ucp_Z                 /* Zl, Zp, Zs */
96    };
97    
98  /* End of pcre_ord2utf8.c */  /* End of pcre_ord2utf8.c */

Legend:
Removed from v.77  
changed lines
  Added in v.349

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12