| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 static inline uint16_t LeadSurrogate(uint32_t char_code) { | 128 static inline uint16_t LeadSurrogate(uint32_t char_code) { |
| 129 return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff); | 129 return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff); |
| 130 } | 130 } |
| 131 static inline uint16_t TrailSurrogate(uint32_t char_code) { | 131 static inline uint16_t TrailSurrogate(uint32_t char_code) { |
| 132 return 0xdc00 + (char_code & 0x3ff); | 132 return 0xdc00 + (char_code & 0x3ff); |
| 133 } | 133 } |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 class Latin1 { | 136 class Latin1 { |
| 137 public: | 137 public: |
| 138 #ifndef ENABLE_LATIN_1 | |
| 139 static const unsigned kMaxChar = 0x7f; | |
| 140 #else | |
| 141 static const unsigned kMaxChar = 0xff; | 138 static const unsigned kMaxChar = 0xff; |
| 142 #endif | |
| 143 // Returns 0 if character does not convert to single latin-1 character | 139 // Returns 0 if character does not convert to single latin-1 character |
| 144 // or if the character doesn't not convert back to latin-1 via inverse | 140 // or if the character doesn't not convert back to latin-1 via inverse |
| 145 // operation (upper to lower, etc). | 141 // operation (upper to lower, etc). |
| 146 static inline uint16_t ConvertNonLatin1ToLatin1(uint16_t); | 142 static inline uint16_t ConvertNonLatin1ToLatin1(uint16_t); |
| 147 }; | 143 }; |
| 148 | 144 |
| 149 class Utf8 { | 145 class Utf8 { |
| 150 public: | 146 public: |
| 151 static inline uchar Length(uchar chr, int previous); | 147 static inline uchar Length(uchar chr, int previous); |
| 152 static inline unsigned Encode( | 148 static inline unsigned Encode( |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 static const int kMaxWidth = 1; | 264 static const int kMaxWidth = 1; |
| 269 static int Convert(uchar c, | 265 static int Convert(uchar c, |
| 270 uchar n, | 266 uchar n, |
| 271 uchar* result, | 267 uchar* result, |
| 272 bool* allow_caching_ptr); | 268 bool* allow_caching_ptr); |
| 273 }; | 269 }; |
| 274 | 270 |
| 275 } // namespace unibrow | 271 } // namespace unibrow |
| 276 | 272 |
| 277 #endif // V8_UNICODE_H_ | 273 #endif // V8_UNICODE_H_ |
| OLD | NEW |