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

Contents of /code/trunk/pcre_tables.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 77 - (show annotations) (download)
Sat Feb 24 21:40:45 2007 UTC (7 years, 2 months ago) by nigel
File MIME type: text/plain
File size: 4503 byte(s)
Load pcre-6.0 into code/trunk.

1 /*************************************************
2 * Perl-Compatible Regular Expressions *
3 *************************************************/
4
5 /* PCRE is a library of functions to support regular expressions whose syntax
6 and semantics are as close as possible to those of the Perl 5 language.
7
8 Written by Philip Hazel
9 Copyright (c) 1997-2005 University of Cambridge
10
11 -----------------------------------------------------------------------------
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14
15 * Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 * Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21
22 * Neither the name of the University of Cambridge nor the names of its
23 contributors may be used to endorse or promote products derived from
24 this software without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37 -----------------------------------------------------------------------------
38 */
39
40
41 /* This module contains some fixed tables that are used by more than one of the
42 PCRE code modules. */
43
44
45 #include "pcre_internal.h"
46
47
48 /* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
49 the definition is next to the definition of the opcodes in internal.h. */
50
51 const uschar _pcre_OP_lengths[] = { OP_LENGTHS };
52
53
54
55 /*************************************************
56 * Tables for UTF-8 support *
57 *************************************************/
58
59 /* These are the breakpoints for different numbers of bytes in a UTF-8
60 character. */
61
62 const int _pcre_utf8_table1[] =
63 { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
64
65 const int _pcre_utf8_table1_size = sizeof(_pcre_utf8_table1)/sizeof(int);
66
67 /* These are the indicator bits and the mask for the data bits to set in the
68 first byte of a character, indexed by the number of additional bytes. */
69
70 const int _pcre_utf8_table2[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
71 const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
72
73 /* Table of the number of extra characters, indexed by the first character
74 masked with 0x3f. The highest number for a valid UTF-8 character is in fact
75 0x3d. */
76
77 const uschar _pcre_utf8_table4[] = {
78 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
79 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
80 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
81 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
82
83 /* This table translates Unicode property names into code values for the
84 ucp_findchar() function. It is used by pcretest as well as by the library
85 functions. */
86
87 const ucp_type_table _pcre_utt[] = {
88 { "C", 128 + ucp_C },
89 { "Cc", ucp_Cc },
90 { "Cf", ucp_Cf },
91 { "Cn", ucp_Cn },
92 { "Co", ucp_Co },
93 { "Cs", ucp_Cs },
94 { "L", 128 + ucp_L },
95 { "Ll", ucp_Ll },
96 { "Lm", ucp_Lm },
97 { "Lo", ucp_Lo },
98 { "Lt", ucp_Lt },
99 { "Lu", ucp_Lu },
100 { "M", 128 + ucp_M },
101 { "Mc", ucp_Mc },
102 { "Me", ucp_Me },
103 { "Mn", ucp_Mn },
104 { "N", 128 + ucp_N },
105 { "Nd", ucp_Nd },
106 { "Nl", ucp_Nl },
107 { "No", ucp_No },
108 { "P", 128 + ucp_P },
109 { "Pc", ucp_Pc },
110 { "Pd", ucp_Pd },
111 { "Pe", ucp_Pe },
112 { "Pf", ucp_Pf },
113 { "Pi", ucp_Pi },
114 { "Po", ucp_Po },
115 { "Ps", ucp_Ps },
116 { "S", 128 + ucp_S },
117 { "Sc", ucp_Sc },
118 { "Sk", ucp_Sk },
119 { "Sm", ucp_Sm },
120 { "So", ucp_So },
121 { "Z", 128 + ucp_Z },
122 { "Zl", ucp_Zl },
123 { "Zp", ucp_Zp },
124 { "Zs", ucp_Zs }
125 };
126
127 const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
128
129 /* End of pcre_tables.c */

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12