/[pcre]/code/tags/pcre-6.7/ucpinternal.h
ViewVC logotype

Contents of /code/tags/pcre-6.7/ucpinternal.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 92 - (show annotations) (download)
Sat Feb 24 21:41:36 2007 UTC (7 years, 8 months ago) by nigel
File MIME type: text/plain
File size: 3376 byte(s)
Tag code/trunk as code/tags/pcre-6.7.

1 /*************************************************
2 * Unicode Property Table handler *
3 *************************************************/
4
5 /* Internal header file defining the layout of the bits in each pair of 32-bit
6 words that form a data item in the table. */
7
8 typedef struct cnode {
9 pcre_uint32 f0;
10 pcre_uint32 f1;
11 } cnode;
12
13 /* Things for the f0 field */
14
15 #define f0_scriptmask 0xff000000 /* Mask for script field */
16 #define f0_scriptshift 24 /* Shift for script value */
17 #define f0_rangeflag 0x00f00000 /* Flag for a range item */
18 #define f0_charmask 0x001fffff /* Mask for code point value */
19
20 /* Things for the f1 field */
21
22 #define f1_typemask 0xfc000000 /* Mask for char type field */
23 #define f1_typeshift 26 /* Shift for the type field */
24 #define f1_rangemask 0x0000ffff /* Mask for a range offset */
25 #define f1_casemask 0x0000ffff /* Mask for a case offset */
26 #define f1_caseneg 0xffff8000 /* Bits for negation */
27
28 /* The data consists of a vector of structures of type cnode. The two unsigned
29 32-bit integers are used as follows:
30
31 (f0) (1) The most significant byte holds the script number. The numbers are
32 defined by the enum in ucp.h.
33
34 (2) The 0x00800000 bit is set if this entry defines a range of characters.
35 It is not set if this entry defines a single character
36
37 (3) The 0x00600000 bits are spare.
38
39 (4) The 0x001fffff bits contain the code point. No Unicode code point will
40 ever be greater than 0x0010ffff, so this should be OK for ever.
41
42 (f1) (1) The 0xfc000000 bits contain the character type number. The numbers are
43 defined by an enum in ucp.h.
44
45 (2) The 0x03ff0000 bits are spare.
46
47 (3) The 0x0000ffff bits contain EITHER the unsigned offset to the top of
48 range if this entry defines a range, OR the *signed* offset to the
49 character's "other case" partner if this entry defines a single
50 character. There is no partner if the value is zero.
51
52 -------------------------------------------------------------------------------
53 | script (8) |.|.|.| codepoint (21) || type (6) |.|.| spare (8) | offset (16) |
54 -------------------------------------------------------------------------------
55 | | | | |
56 | | |-> spare | |-> spare
57 | | |
58 | |-> spare |-> spare
59 |
60 |-> range flag
61
62 The upper/lower casing information is set only for characters that come in
63 pairs. The non-one-to-one mappings in the Unicode data are ignored.
64
65 When searching the data, proceed as follows:
66
67 (1) Set up for a binary chop search.
68
69 (2) If the top is not greater than the bottom, the character is not in the
70 table. Its type must therefore be "Cn" ("Undefined").
71
72 (3) Find the middle vector element.
73
74 (4) Extract the code point and compare. If equal, we are done.
75
76 (5) If the test character is smaller, set the top to the current point, and
77 goto (2).
78
79 (6) If the current entry defines a range, compute the last character by adding
80 the offset, and see if the test character is within the range. If it is,
81 we are done.
82
83 (7) Otherwise, set the bottom to one element past the current point and goto
84 (2).
85 */
86
87 /* End of ucpinternal.h */

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12