OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_UNICODE_H_ | 5 #ifndef VM_UNICODE_H_ |
6 #define VM_UNICODE_H_ | 6 #define VM_UNICODE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 // Decodes a surrogate pair into a supplementary code point. | 149 // Decodes a surrogate pair into a supplementary code point. |
150 static int32_t Decode(int32_t lead, int32_t trail) { | 150 static int32_t Decode(int32_t lead, int32_t trail) { |
151 return 0x10000 + ((lead & 0x3FF) << 10) + (trail & 0x3FF); | 151 return 0x10000 + ((lead & 0x3FF) << 10) + (trail & 0x3FF); |
152 } | 152 } |
153 | 153 |
154 // Encodes a single code point. | 154 // Encodes a single code point. |
155 static void Encode(int32_t codepoint, uint16_t* dst); | 155 static void Encode(int32_t codepoint, uint16_t* dst); |
156 | 156 |
157 private: | |
158 static const int32_t kMaxCodeUnit = 0xFFFF; | 157 static const int32_t kMaxCodeUnit = 0xFFFF; |
159 | 158 |
| 159 private: |
160 static const int32_t kLeadSurrogateOffset = (0xD800 - (0x10000 >> 10)); | 160 static const int32_t kLeadSurrogateOffset = (0xD800 - (0x10000 >> 10)); |
161 | 161 |
162 static const int32_t kSurrogateOffset = (0x10000 - (0xD800 << 10) - 0xDC00); | 162 static const int32_t kSurrogateOffset = (0x10000 - (0xD800 << 10) - 0xDC00); |
163 }; | 163 }; |
164 | 164 |
165 | 165 |
166 class CaseMapping : AllStatic { | 166 class CaseMapping : AllStatic { |
167 public: | 167 public: |
168 // Maps a code point to uppercase. | 168 // Maps a code point to uppercase. |
169 static int32_t ToUpper(int32_t code_point) { | 169 static int32_t ToUpper(int32_t code_point) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // Data for small code points with one mapping | 222 // Data for small code points with one mapping |
223 static const int16_t stage2_[]; | 223 static const int16_t stage2_[]; |
224 | 224 |
225 // Data for large code points or code points with both mappings. | 225 // Data for large code points or code points with both mappings. |
226 static const int32_t stage2_exception_[][2]; | 226 static const int32_t stage2_exception_[][2]; |
227 }; | 227 }; |
228 | 228 |
229 } // namespace dart | 229 } // namespace dart |
230 | 230 |
231 #endif // VM_UNICODE_H_ | 231 #endif // VM_UNICODE_H_ |
OLD | NEW |