/[pcre]/code/trunk/ucpinternal.h
ViewVC logotype

Contents of /code/trunk/ucpinternal.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 351 - (hide annotations) (download)
Fri Jul 4 18:27:16 2008 UTC (6 years, 3 months ago) by ph10
File MIME type: text/plain
File size: 3942 byte(s)
Final tidies for new Unicode property code; upgrade to Unicode 5.1.0.

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

Properties

Name Value
svn:keywords "Author Date Id Revision Url"

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12