/arkcompiler/ets_runtime/ecmascript/base/tests/ |
H A D | utf_helper_test.cpp | 409 // code point lie in [0x00, 0x7F], the length of utf8 code element byte is 1 in HWTEST_F_L0() 420 // code point lie in [0x80, 0x7FF], the length of utf8 code element byte is 2 in HWTEST_F_L0() 432 // code point lie in [0x800, 0xD7FF] or [0xDC00,0xFFFF], the length of utf8 code element byte is 3. in HWTEST_F_L0() 433 // when code point lie in [0xD800, 0xDBFF], due to the use of UCS-2, it corresponds to 3 utf8 symbols. in HWTEST_F_L0() 444 // code point lie in [0x10000, 0x10FFFF], the length of utf8 code element byte is 4. in HWTEST_F_L0() 579 * unicode point and the byte length of the utf8 encoding sequence. 670 std::string utf8 = "Hello"; in HWTEST_F_L0() local 673 size_t converted = Utf8ToUtf16Size(reinterpret_cast<const uint8_t*>(utf8.data()), utf8.size()); in HWTEST_F_L0() 684 std::string utf8 in HWTEST_F_L0() local 698 std::string utf8 = ""; HWTEST_F_L0() local 712 std::string utf8 = "Hello, 你好"; HWTEST_F_L0() local 726 std::string utf8 = "你好,世界!"; HWTEST_F_L0() local 740 std::string utf8 = "\\xF0\\x28\\x8C\\x28"; HWTEST_F_L0() local 754 std::string utf8 = "ABC"; // All are single byte characters HWTEST_F_L0() local 768 std::string utf8 = "\\xC2\\xA2\\xC3\\xBC"; // They are ¢ and ü, respectively HWTEST_F_L0() local 782 std::string utf8 = "\\xE2\\x82\\xAC"; // euro: € HWTEST_F_L0() local 796 std::string utf8 = "\\xF0\\x9F\\x98\\x8E"; // Emoji 😎 HWTEST_F_L0() local 810 std::string utf8 = "Hello\\0World", utf8Nul = utf8 + '\\0' + "World"; // Clearly including zero bytes HWTEST_F_L0() local 824 std::string utf8 = "\\xC0\\x80\\xC0\\x80"; // Continuous illegal sequence HWTEST_F_L0() local 838 std::string utf8 = "Hello"; HWTEST_F_L0() local 853 std::string utf8 = "你好,世界!"; HWTEST_F_L0() local 868 std::string utf8 = ""; HWTEST_F_L0() local 883 std::string utf8 = "Hello, 你好"; HWTEST_F_L0() local 898 std::string utf8 = "你好,世界!"; HWTEST_F_L0() local 913 std::string utf8 = "\\xF0\\x28\\x8C\\x28"; HWTEST_F_L0() local 928 std::string utf8 = "ABC"; // All are single byte characters HWTEST_F_L0() local 943 std::string utf8 = "\\xC2\\xA2\\xC3\\xBC"; // They are ¢ and ü, respectively HWTEST_F_L0() local 958 std::string utf8 = "\\xE2\\x82\\xAC"; // euro € HWTEST_F_L0() local 973 std::string utf8 = "\\xF0\\x9F\\x98\\x8E"; // Emoji 😎 HWTEST_F_L0() local 988 std::string utf8 = "Hello\\0World", utf8Nul = utf8 + '\\0' + "World"; // Clearly including zero bytes HWTEST_F_L0() local 1004 std::string utf8 = "\\xC0\\x80\\xC0\\x80"; // Continuous illegal sequence HWTEST_F_L0() local 1019 std::string utf8 = "\\xF0\\x9F\\x98\\x8E"; // Emoji 😎 HWTEST_F_L0() local 1033 std::string utf8 = "\\xF0\\x9F\\x98\\x8E"; // Emoji 😎 HWTEST_F_L0() local [all...] |
/arkcompiler/ets_runtime/ecmascript/tests/ |
H A D | concurrent_sweep_test.cpp | 30 const uint8_t *utf8 = reinterpret_cast<const uint8_t *>("test"); in TEST_F() local 32 EcmaStringAccessor::CreateFromUtf8(instance, utf8, 4, true)); // 4 : utf8 encoding length in TEST_F() 37 EcmaStringAccessor::CreateFromUtf8(instance, utf8, 4, true)); // 4 : utf8 encoding length in TEST_F()
|
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/napi/ |
H A D | ets_mangle.cpp | 28 const uint8_t *utf8 = ark::utf::CStringAsMutf8(name.c_str()); in MangleString() local 29 while (*utf8 != '\0') { in MangleString() 30 auto [ch, len] = ark::utf::ConvertMUtf8ToUtf16Pair(utf8); in MangleString() 32 utf8 += len; in MangleString()
|
/arkcompiler/ets_frontend/ets2panda/public/ |
H A D | es2panda_lib.cpp | 116 std::string_view utf8 = sv.Utf8(); in StringViewToCString() local 117 if (utf8.data()[utf8.size()] == '\0') { in StringViewToCString() 119 return const_cast<char *>(utf8.data()); in StringViewToCString() 121 char *res = reinterpret_cast<char *>(allocator->Alloc(utf8.size() + 1)); in StringViewToCString() 122 [[maybe_unused]] auto err = memmove_s(res, utf8.size() + 1, utf8.cbegin(), utf8.size()); in StringViewToCString() 124 res[utf8.size()] = '\0'; in StringViewToCString() 129 char *StringViewToCString(ArenaAllocator *allocator, std::string_view const utf8) in StringViewToCString() argument [all...] |
/arkcompiler/ets_frontend/ets2panda/lexer/token/ |
H A D | number.cpp | 26 Number::Number(util::StringView str, const std::string &utf8, NumberFlags flags) noexcept : str_(str), flags_(flags) in flags_() 30 const int64_t temp = Lexer::StrToNumeric(&std::strtoll, utf8.c_str(), res, 10); in flags_() 46 const double temp = Lexer::StrToNumeric(&std::strtod, utf8.c_str(), res); in flags_()
|
H A D | number.h | 69 explicit Number(util::StringView str, const std::string &utf8, NumberFlags flags) noexcept;
|
/arkcompiler/ets_runtime/ecmascript/base/ |
H A D | utf_helper.cpp | 101 size_t EncodeUTF8(uint32_t codepoint, uint8_t* utf8, size_t len, size_t index) in EncodeUTF8() argument 109 utf8[index + j] = cont; in EncodeUTF8() 112 utf8[index] = codepoint | firstByteMark[size]; in EncodeUTF8() 354 static inline size_t FixUtf8Len(const uint8_t* utf8, size_t utf8Len) in FixUtf8Len() argument 357 if (utf8Len >= 1 && utf8[utf8Len - 1] >= 0xC0) { in FixUtf8Len() 361 if (utf8Len >= CONST_2 && utf8[utf8Len - CONST_2] >= 0xE0) { in FixUtf8Len() 365 if (utf8Len >= CONST_3 && utf8[utf8Len - CONST_3] >= 0xF0) { in FixUtf8Len() 372 size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8Len) in Utf8ToUtf16Size() argument 374 size_t safeUtf8Len = FixUtf8Len(utf8, utf8Len); in Utf8ToUtf16Size() 378 uint8_t src = utf8[in_po in Utf8ToUtf16Size() 493 ConvertUtf8ToUnicodeChar(const uint8_t *utf8, size_t maxLen) ConvertUtf8ToUnicodeChar() argument [all...] |
H A D | utf_helper.h | 105 size_t EncodeUTF8(uint32_t codepoint, uint8_t* utf8, size_t len, size_t index); 127 size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8Len); 142 std::pair<int32_t, size_t> ConvertUtf8ToUnicodeChar(const uint8_t *utf8, size_t maxLen);
|
/arkcompiler/ets_frontend/ets2panda/lexer/ |
H A D | lexer.cpp | 281 void Lexer::ConvertNumber(const std::string &utf8, [[maybe_unused]] NumberFlags flags) in ConvertNumber() argument 284 const long double temp = StrToNumeric(&std::strtold, utf8.c_str(), res); in ConvertNumber() 336 std::string utf8 = std::string {sv.Utf8()}; in ScanNumber() local 340 utf8.insert(exponentSignPos, 1, '+'); in ScanNumber() 345 utf8.erase(std::remove(utf8.begin(), utf8.end(), LEX_CHAR_UNDERSCORE), utf8.end()); in ScanNumber() 350 util::UString converted(utf8, Allocator()); in ScanNumber() 356 ConvertNumber(utf8, flag in ScanNumber() [all...] |
H A D | ETSLexer.cpp | 113 void ETSLexer::ConvertNumber(const std::string &utf8, NumberFlags flags) in ConvertNumber() argument 115 GetToken().number_ = lexer::Number(GetToken().src_, utf8, flags); in ConvertNumber()
|
H A D | ETSLexer.h | 66 void ConvertNumber(const std::string &utf8, NumberFlags flags) override;
|
H A D | lexer.h | 291 virtual void ConvertNumber(const std::string &utf8, NumberFlags flags);
|
/arkcompiler/ets_frontend/es2panda/lexer/ |
H A D | lexer.cpp | 345 std::string utf8 = std::string {sv.Utf8()}; in ConvertNumber() local 349 utf8.insert(exponentSignPos, 1, '+'); in ConvertNumber() 354 utf8.erase(std::remove(utf8.begin(), utf8.end(), LEX_CHAR_UNDERSCORE), utf8.end()); in ConvertNumber() 359 util::UString converted(utf8, Allocator()); in ConvertNumber() 366 GetToken().number_ = static_cast<double>(std::stold(utf8, nullptr)); in ConvertNumber()
|
/arkcompiler/ets_frontend/es2panda/util/ |
H A D | helpers.cpp | 890 std::wstring Helpers::Utf8ToUtf16(const std::string &utf8) in Utf8ToUtf16() argument 893 if (utf8.empty()) { in Utf8ToUtf16() 897 if (utf8.length() > static_cast<size_t>(std::numeric_limits<int>::max())) { in Utf8ToUtf16() 898 std::cerr << "Length of filename: " << utf8 << " is too long" << std::endl; in Utf8ToUtf16() 902 const int utf8Length = static_cast<int>(utf8.length()); in Utf8ToUtf16() 904 const int utf16Length = MultiByteToWideChar(CP_UTF8, kFlags, utf8.data(), utf8Length, nullptr, 0); in Utf8ToUtf16() 906 std::cerr << "The filename: " << utf8 << " is not a valid utf8 encoding string" << std::endl; in Utf8ToUtf16() 911 MultiByteToWideChar(CP_UTF8, kFlags, utf8.data(), utf8Length, &utf16[0], utf16Length); in Utf8ToUtf16()
|
H A D | helpers.h | 149 static std::wstring Utf8ToUtf16(const std::string &utf8);
|
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/types/ |
H A D | ets_string.h | 61 static EtsString *CreateFromUtf8(const char *utf8, uint32_t length) in CreateFromUtf8() argument 69 if (utf8 == nullptr) { in CreateFromUtf8() 73 const auto *data = reinterpret_cast<const uint8_t *>(utf8); in CreateFromUtf8()
|
/arkcompiler/ets_runtime/ecmascript/napi/include/ |
H A D | jsnapi_expo.h | 798 bool Set(const EcmaVM *vm, const char *utf8, Local<JSValueRef> value); 803 Local<JSValueRef> Get(const EcmaVM *vm, const char *utf8); 936 static Local<StringRef> NewFromUtf8WithoutStringTable(const EcmaVM *vm, const char *utf8, int length = -1); 937 static Local<StringRef> NewFromUtf8(const EcmaVM *vm, const char *utf8, int length = -1); 1380 Local<JSValueRef> Get(const EcmaVM *vm, const char *utf8); 1385 void Set(const EcmaVM *vm, const char *utf8, Local<JSValueRef> value); 1387 bool Has(const EcmaVM *vm, const char *utf8); 1401 Local<JSValueRef> Get(const EcmaVM *vm, const char *utf8); 1405 void Set(const EcmaVM *vm, const char *utf8, Local<JSValueRef> value); 1407 bool Has(const EcmaVM *vm, const char *utf8); [all...] |
/arkcompiler/runtime_core/static_core/libpandabase/utils/ |
H A D | utf.h | 141 PANDA_PUBLIC_API size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8Len);
|
H A D | utf.cpp | 208 // compare plain utf8, which allows 0 inside a string 569 size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8Len) in Utf8ToUtf16Size() argument 571 return MUtf8ToUtf16Size(utf8, utf8Len); in Utf8ToUtf16Size()
|
/arkcompiler/ets_runtime/ecmascript/napi/ |
H A D | jsnapi_expo.cpp | 1278 Local<JSValueRef> MapRef::Get(const EcmaVM *vm, const char *utf8) in Get() argument 1284 JSHandle<JSTaggedValue> key(factory->NewFromUtf8(utf8)); in Get() 1297 void MapRef::Set(const EcmaVM *vm, const char *utf8, Local<JSValueRef> value) in Set() argument 1303 JSHandle<JSTaggedValue> key(factory->NewFromUtf8(utf8)); in Set() 1316 bool MapRef::Has(const EcmaVM *vm, const char *utf8) in Has() argument 1322 JSHandle<JSTaggedValue> key(factory->NewFromUtf8(utf8)); in Has() 1452 Local<JSValueRef> SendableMapRef::Get(const EcmaVM *vm, const char *utf8) in Get() argument 1458 JSHandle<JSTaggedValue> key(factory->NewFromUtf8(utf8)); in Get() 1471 void SendableMapRef::Set(const EcmaVM *vm, const char *utf8, Local<JSValueRef> value) in Set() argument 1477 JSHandle<JSTaggedValue> key(factory->NewFromUtf8(utf8)); in Set() 1490 Has(const EcmaVM *vm, const char *utf8) Has() argument 2083 NewFromUtf8(const EcmaVM *vm, const char *utf8, int length) NewFromUtf8() argument 2098 NewFromUtf8WithoutStringTable(const EcmaVM *vm, const char *utf8, int length) NewFromUtf8WithoutStringTable() argument 2604 Set(const EcmaVM *vm, const char *utf8, Local<JSValueRef> value) Set() argument 2696 Get(const EcmaVM *vm, const char *utf8) Get() argument 4986 KeyIsNumber(const char* utf8) KeyIsNumber() argument [all...] |
/arkcompiler/ets_runtime/ecmascript/ |
H A D | ecma_string.cpp | 981 static size_t FixUtf8Len(const uint8_t* utf8, size_t utf8Len) in FixUtf8Len() argument 986 if (utf8Len >= 1 && utf8[utf8Len - 1] >= 0xC0) { in FixUtf8Len() 990 if (utf8Len >= TWO_BYTES_LENGTH && utf8[utf8Len - TWO_BYTES_LENGTH] >= 0xE0) { in FixUtf8Len() 994 if (utf8Len >= THREE_BYTES_LENGTH && utf8[utf8Len - THREE_BYTES_LENGTH] >= 0xF0) { in FixUtf8Len()
|
/arkcompiler/ets_runtime/ecmascript/napi/test/ |
H A D | jsnapi_third_tests.cpp | 779 char utf8[] = "hello world!"; in HWTEST_F_L0() local 780 int length = strlen(utf8); in HWTEST_F_L0() 781 Local<StringRef> result = StringRef::NewFromUtf8(vm_, utf8, length); in HWTEST_F_L0()
|
H A D | jsnapi_sample.cpp | 211 char utf8[12] = "Hello world"; in HWTEST_F_L0() local 212 Local<JSValueRef> local = StringRef::NewFromUtf8(vm_, utf8); in HWTEST_F_L0()
|
/arkcompiler/ets_runtime/ecmascript/compiler/builtins/ |
H A D | builtins_string_stub_builder.cpp | 1237 Label utf8(env);
in CreateStringBySingleCharCode() 1241 BRANCH(canStoreAsUtf8, &utf8, &utf16);
in CreateStringBySingleCharCode() 1242 Bind(&utf8);
in CreateStringBySingleCharCode() 1662 // source is utf8, dst is utf16
1703 // source is utf16, dst is utf8
2373 // left is utf8,right string must utf16
in StringConcat()
|