| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 uint16_t* dst, | 72 uint16_t* dst, |
| 73 intptr_t len); | 73 intptr_t len); |
| 74 static bool DecodeToUTF32(const uint8_t* utf8_array, | 74 static bool DecodeToUTF32(const uint8_t* utf8_array, |
| 75 intptr_t array_len, | 75 intptr_t array_len, |
| 76 int32_t* dst, | 76 int32_t* dst, |
| 77 intptr_t len); | 77 intptr_t len); |
| 78 static bool DecodeCStringToUTF32(const char* str, | 78 static bool DecodeCStringToUTF32(const char* str, |
| 79 int32_t* dst, | 79 int32_t* dst, |
| 80 intptr_t len); | 80 intptr_t len); |
| 81 | 81 |
| 82 private: | |
| 83 static const int32_t kMaxOneByteChar = 0x7F; | 82 static const int32_t kMaxOneByteChar = 0x7F; |
| 84 static const int32_t kMaxTwoByteChar = 0x7FF; | 83 static const int32_t kMaxTwoByteChar = 0x7FF; |
| 85 static const int32_t kMaxThreeByteChar = 0xFFFF; | 84 static const int32_t kMaxThreeByteChar = 0xFFFF; |
| 86 static const int32_t kMaxFourByteChar = Utf::kMaxCodePoint; | 85 static const int32_t kMaxFourByteChar = Utf::kMaxCodePoint; |
| 87 | 86 |
| 87 private: |
| 88 static bool IsTrailByte(uint8_t code_unit) { | 88 static bool IsTrailByte(uint8_t code_unit) { |
| 89 return (code_unit & 0xC0) == 0x80; | 89 return (code_unit & 0xC0) == 0x80; |
| 90 } | 90 } |
| 91 | 91 |
| 92 static bool IsNonShortestForm(uint32_t code_point, size_t num_code_units) { | 92 static bool IsNonShortestForm(uint32_t code_point, size_t num_code_units) { |
| 93 return code_point < kOverlongMinimum[num_code_units]; | 93 return code_point < kOverlongMinimum[num_code_units]; |
| 94 } | 94 } |
| 95 | 95 |
| 96 static bool IsLatin1SequenceStart(uint8_t code_unit) { | 96 static bool IsLatin1SequenceStart(uint8_t code_unit) { |
| 97 // Check if utf8 sequence is the start of a codepoint <= U+00FF | 97 // Check if utf8 sequence is the start of a codepoint <= U+00FF |
| (...skipping 124 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 |