CUBRID Engine  latest
locale_lib_common.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * locale_lib_common.h : Locale support using LDML files
22  *
23  */
24 
25 #ifndef _LOCALE_SUPPORT_AUX_H_
26 #define _LOCALE_SUPPORT_AUX_H_
27 
28 /* maximum characters to be used as a sequence in UCA
29  (contraction or expansion) */
30 #define LOC_MAX_UCA_CHARS_SEQ 3
31 
32 #define MAX_UCA_EXP_CE 10
33 
34 /* maximum char size for UTF-8 */
35 #define INTL_UTF8_MAX_CHAR_SIZE 4
36 
37 #define INTL_MAX_UNICODE_CP_ALLOWED 0x10ffff
38 
39 typedef unsigned int UCA_L13_W;
40 typedef unsigned short int UCA_L4_W;
41 
42 /* Collation data with optimized weights */
45 {
46  /* WARNING: Changing the order of the elements breaks locale library backwards compatibility : -
47  * 'save_contraction_to_C_file' function needs to be updated - checksum of collation with contraction changes */
48 
49  /* next sequence (codepoint or contraction which sorts after this contraction) */
50  unsigned int next;
51 
52  /* weight value for contraction (collation without expansions) */
53  unsigned int wv;
54 
55  /* weight values for contraction (collation with expansions) */
58 
59  /* buffer of contraction contraction, nul-terminated */
61 
62  /* number of codepoints in contraction */
63  unsigned char cp_count;
64  /* size in bytes of c_buf */
65  unsigned char size;
66 
67  /* UCA weight count (collation with expansions) */
68  unsigned char uca_num;
69 };
70 
71 #define TEXT_CONV_MAX_BYTES 3
72 
73 /* bytes sequence encoding of a source codepoint :
74  * codepoint is index in an array; encoding is the item accessed by the index */
77 {
78  unsigned char size; /* size in bytes of converted codepoint */
79  unsigned char bytes[TEXT_CONV_MAX_BYTES]; /* bytes of encoded sequence */
80 };
81 
82 
83 /* Unicode normalization structures */
84 
85 /* This is the maximum number of bytes necessary to store any of the unicode
86  * decompositions
87  * Buffer size is enough to fit maximum 3 characters of a decomposition
88  */
89 #define NORMALIZATION_MAX_BUF_SIZE 10
90 
91 
94 {
95  unsigned int cp; /* The codepoint which the buffer composes to. */
96  int size; /* number of bytes in the buffer */
97  /* utf8 buffer, null terminated. */
98  unsigned char buffer[NORMALIZATION_MAX_BUF_SIZE];
99 };
100 
101 #endif /* _LOCALE_SUPPORT_AUX_H_ */
unsigned char size
#define LOC_MAX_UCA_CHARS_SEQ
UCA_L13_W uca_w_l13[MAX_UCA_EXP_CE]
unsigned char uca_num
UCA_L4_W uca_w_l4[MAX_UCA_EXP_CE]
#define NORMALIZATION_MAX_BUF_SIZE
#define MAX_UCA_EXP_CE
char c_buf[LOC_MAX_UCA_CHARS_SEQ *INTL_UTF8_MAX_CHAR_SIZE]
#define INTL_UTF8_MAX_CHAR_SIZE
#define TEXT_CONV_MAX_BYTES
unsigned int UCA_L13_W
unsigned short int UCA_L4_W
unsigned char size
unsigned char cp_count