#include <time.h> in pcretest.c (a PCRE bug, fixed in later PCRE
[exim.git] / src / src / pcre / pcre_tables.c
CommitLineData
aa41d2de 1/* $Cambridge: exim/src/src/pcre/pcre_tables.c,v 1.3 2006/11/07 16:50:36 ph10 Exp $ */
8ac170f3
PH
2
3/*************************************************
4* Perl-Compatible Regular Expressions *
5*************************************************/
6
7/* PCRE is a library of functions to support regular expressions whose syntax
8and semantics are as close as possible to those of the Perl 5 language.
9
10 Written by Philip Hazel
aa41d2de 11 Copyright (c) 1997-2006 University of Cambridge
8ac170f3
PH
12
13-----------------------------------------------------------------------------
14Redistribution and use in source and binary forms, with or without
15modification, are permitted provided that the following conditions are met:
16
17 * Redistributions of source code must retain the above copyright notice,
18 this list of conditions and the following disclaimer.
19
20 * Redistributions in binary form must reproduce the above copyright
21 notice, this list of conditions and the following disclaimer in the
22 documentation and/or other materials provided with the distribution.
23
24 * Neither the name of the University of Cambridge nor the names of its
25 contributors may be used to endorse or promote products derived from
26 this software without specific prior written permission.
27
28THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38POSSIBILITY OF SUCH DAMAGE.
39-----------------------------------------------------------------------------
40*/
41
42
43/* This module contains some fixed tables that are used by more than one of the
aa41d2de
PH
44PCRE code modules. The tables are also #included by the pcretest program, which
45uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name
46clashes with the library. */
8ac170f3
PH
47
48
49#include "pcre_internal.h"
50
51
52/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
aa41d2de 53the definition is next to the definition of the opcodes in pcre_internal.h. */
8ac170f3
PH
54
55const uschar _pcre_OP_lengths[] = { OP_LENGTHS };
56
57
58
59/*************************************************
60* Tables for UTF-8 support *
61*************************************************/
62
63/* These are the breakpoints for different numbers of bytes in a UTF-8
64character. */
65
66const int _pcre_utf8_table1[] =
67 { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
68
69const int _pcre_utf8_table1_size = sizeof(_pcre_utf8_table1)/sizeof(int);
70
71/* These are the indicator bits and the mask for the data bits to set in the
72first byte of a character, indexed by the number of additional bytes. */
73
74const int _pcre_utf8_table2[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
75const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
76
77/* Table of the number of extra characters, indexed by the first character
78masked with 0x3f. The highest number for a valid UTF-8 character is in fact
790x3d. */
80
81const uschar _pcre_utf8_table4[] = {
82 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
83 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
84 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
85 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
86
aa41d2de
PH
87/* This table translates Unicode property names into type and code values. It
88is searched by binary chop, so must be in collating sequence of name. */
8ac170f3
PH
89
90const ucp_type_table _pcre_utt[] = {
aa41d2de
PH
91 { "Any", PT_ANY, 0 },
92 { "Arabic", PT_SC, ucp_Arabic },
93 { "Armenian", PT_SC, ucp_Armenian },
94 { "Bengali", PT_SC, ucp_Bengali },
95 { "Bopomofo", PT_SC, ucp_Bopomofo },
96 { "Braille", PT_SC, ucp_Braille },
97 { "Buginese", PT_SC, ucp_Buginese },
98 { "Buhid", PT_SC, ucp_Buhid },
99 { "C", PT_GC, ucp_C },
100 { "Canadian_Aboriginal", PT_SC, ucp_Canadian_Aboriginal },
101 { "Cc", PT_PC, ucp_Cc },
102 { "Cf", PT_PC, ucp_Cf },
103 { "Cherokee", PT_SC, ucp_Cherokee },
104 { "Cn", PT_PC, ucp_Cn },
105 { "Co", PT_PC, ucp_Co },
106 { "Common", PT_SC, ucp_Common },
107 { "Coptic", PT_SC, ucp_Coptic },
108 { "Cs", PT_PC, ucp_Cs },
109 { "Cypriot", PT_SC, ucp_Cypriot },
110 { "Cyrillic", PT_SC, ucp_Cyrillic },
111 { "Deseret", PT_SC, ucp_Deseret },
112 { "Devanagari", PT_SC, ucp_Devanagari },
113 { "Ethiopic", PT_SC, ucp_Ethiopic },
114 { "Georgian", PT_SC, ucp_Georgian },
115 { "Glagolitic", PT_SC, ucp_Glagolitic },
116 { "Gothic", PT_SC, ucp_Gothic },
117 { "Greek", PT_SC, ucp_Greek },
118 { "Gujarati", PT_SC, ucp_Gujarati },
119 { "Gurmukhi", PT_SC, ucp_Gurmukhi },
120 { "Han", PT_SC, ucp_Han },
121 { "Hangul", PT_SC, ucp_Hangul },
122 { "Hanunoo", PT_SC, ucp_Hanunoo },
123 { "Hebrew", PT_SC, ucp_Hebrew },
124 { "Hiragana", PT_SC, ucp_Hiragana },
125 { "Inherited", PT_SC, ucp_Inherited },
126 { "Kannada", PT_SC, ucp_Kannada },
127 { "Katakana", PT_SC, ucp_Katakana },
128 { "Kharoshthi", PT_SC, ucp_Kharoshthi },
129 { "Khmer", PT_SC, ucp_Khmer },
130 { "L", PT_GC, ucp_L },
131 { "L&", PT_LAMP, 0 },
132 { "Lao", PT_SC, ucp_Lao },
133 { "Latin", PT_SC, ucp_Latin },
134 { "Limbu", PT_SC, ucp_Limbu },
135 { "Linear_B", PT_SC, ucp_Linear_B },
136 { "Ll", PT_PC, ucp_Ll },
137 { "Lm", PT_PC, ucp_Lm },
138 { "Lo", PT_PC, ucp_Lo },
139 { "Lt", PT_PC, ucp_Lt },
140 { "Lu", PT_PC, ucp_Lu },
141 { "M", PT_GC, ucp_M },
142 { "Malayalam", PT_SC, ucp_Malayalam },
143 { "Mc", PT_PC, ucp_Mc },
144 { "Me", PT_PC, ucp_Me },
145 { "Mn", PT_PC, ucp_Mn },
146 { "Mongolian", PT_SC, ucp_Mongolian },
147 { "Myanmar", PT_SC, ucp_Myanmar },
148 { "N", PT_GC, ucp_N },
149 { "Nd", PT_PC, ucp_Nd },
150 { "New_Tai_Lue", PT_SC, ucp_New_Tai_Lue },
151 { "Nl", PT_PC, ucp_Nl },
152 { "No", PT_PC, ucp_No },
153 { "Ogham", PT_SC, ucp_Ogham },
154 { "Old_Italic", PT_SC, ucp_Old_Italic },
155 { "Old_Persian", PT_SC, ucp_Old_Persian },
156 { "Oriya", PT_SC, ucp_Oriya },
157 { "Osmanya", PT_SC, ucp_Osmanya },
158 { "P", PT_GC, ucp_P },
159 { "Pc", PT_PC, ucp_Pc },
160 { "Pd", PT_PC, ucp_Pd },
161 { "Pe", PT_PC, ucp_Pe },
162 { "Pf", PT_PC, ucp_Pf },
163 { "Pi", PT_PC, ucp_Pi },
164 { "Po", PT_PC, ucp_Po },
165 { "Ps", PT_PC, ucp_Ps },
166 { "Runic", PT_SC, ucp_Runic },
167 { "S", PT_GC, ucp_S },
168 { "Sc", PT_PC, ucp_Sc },
169 { "Shavian", PT_SC, ucp_Shavian },
170 { "Sinhala", PT_SC, ucp_Sinhala },
171 { "Sk", PT_PC, ucp_Sk },
172 { "Sm", PT_PC, ucp_Sm },
173 { "So", PT_PC, ucp_So },
174 { "Syloti_Nagri", PT_SC, ucp_Syloti_Nagri },
175 { "Syriac", PT_SC, ucp_Syriac },
176 { "Tagalog", PT_SC, ucp_Tagalog },
177 { "Tagbanwa", PT_SC, ucp_Tagbanwa },
178 { "Tai_Le", PT_SC, ucp_Tai_Le },
179 { "Tamil", PT_SC, ucp_Tamil },
180 { "Telugu", PT_SC, ucp_Telugu },
181 { "Thaana", PT_SC, ucp_Thaana },
182 { "Thai", PT_SC, ucp_Thai },
183 { "Tibetan", PT_SC, ucp_Tibetan },
184 { "Tifinagh", PT_SC, ucp_Tifinagh },
185 { "Ugaritic", PT_SC, ucp_Ugaritic },
186 { "Yi", PT_SC, ucp_Yi },
187 { "Z", PT_GC, ucp_Z },
188 { "Zl", PT_PC, ucp_Zl },
189 { "Zp", PT_PC, ucp_Zp },
190 { "Zs", PT_PC, ucp_Zs }
8ac170f3
PH
191};
192
193const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
194
195/* End of pcre_tables.c */