Lines Matching defs:uv
32 =for apidoc A|U8 *|uvuni_to_utf8_flags|U8 *d|UV uv|UV flags
34 Adds the UTF-8 representation of the Unicode codepoint C<uv> to the end
39 d = uvuni_to_utf8_flags(d, uv, flags);
43 d = uvuni_to_utf8(d, uv);
47 d = uvuni_to_utf8_flags(d, uv, 0);
51 *(d++) = uv;
57 Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
60 if (UNICODE_IS_SURROGATE(uv) &&
62 Perl_warner(aTHX_ packWARN(WARN_UTF8), "UTF-16 surrogate 0x%04"UVxf, uv);
64 ((uv >= 0xFDD0 && uv <= 0xFDEF &&
67 ((uv & 0xFFFE) == 0xFFFE && /* Either FFFE or FFFF. */
71 ((uv <= PERL_UNICODE_MAX) ||
75 "Unicode character 0x%04"UVxf" is illegal", uv);
77 if (UNI_IS_INVARIANT(uv)) {
78 *d++ = (U8)UTF_TO_NATIVE(uv);
83 STRLEN len = UNISKIP(uv);
86 *p-- = (U8)UTF_TO_NATIVE((uv & UTF_CONTINUATION_MASK) | UTF_CONTINUATION_MARK);
87 uv >>= UTF_ACCUMULATION_SHIFT;
89 *p = (U8)UTF_TO_NATIVE((uv & UTF_START_MASK(len)) | UTF_START_MARK(len));
93 if (uv < 0x800) {
94 *d++ = (U8)(( uv >> 6) | 0xc0);
95 *d++ = (U8)(( uv & 0x3f) | 0x80);
98 if (uv < 0x10000) {
99 *d++ = (U8)(( uv >> 12) | 0xe0);
100 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
101 *d++ = (U8)(( uv & 0x3f) | 0x80);
104 if (uv < 0x200000) {
105 *d++ = (U8)(( uv >> 18) | 0xf0);
106 *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80);
107 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
108 *d++ = (U8)(( uv & 0x3f) | 0x80);
111 if (uv < 0x4000000) {
112 *d++ = (U8)(( uv >> 24) | 0xf8);
113 *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80);
114 *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80);
115 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
116 *d++ = (U8)(( uv & 0x3f) | 0x80);
119 if (uv < 0x80000000) {
120 *d++ = (U8)(( uv >> 30) | 0xfc);
121 *d++ = (U8)(((uv >> 24) & 0x3f) | 0x80);
122 *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80);
123 *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80);
124 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
125 *d++ = (U8)(( uv & 0x3f) | 0x80);
129 if (uv < UTF8_QUAD_MAX)
133 *d++ = (U8)(((uv >> 30) & 0x3f) | 0x80);
134 *d++ = (U8)(((uv >> 24) & 0x3f) | 0x80);
135 *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80);
136 *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80);
137 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
138 *d++ = (U8)(( uv & 0x3f) | 0x80);
145 *d++ = (U8)(((uv >> 60) & 0x0f) | 0x80); /* 2 Reserved bits */
146 *d++ = (U8)(((uv >> 54) & 0x3f) | 0x80);
147 *d++ = (U8)(((uv >> 48) & 0x3f) | 0x80);
148 *d++ = (U8)(((uv >> 42) & 0x3f) | 0x80);
149 *d++ = (U8)(((uv >> 36) & 0x3f) | 0x80);
150 *d++ = (U8)(((uv >> 30) & 0x3f) | 0x80);
151 *d++ = (U8)(((uv >> 24) & 0x3f) | 0x80);
152 *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80);
153 *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80);
154 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
155 *d++ = (U8)(( uv & 0x3f) | 0x80);
163 Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
165 return Perl_uvuni_to_utf8_flags(aTHX_ d, uv, 0);
183 UV uv, ouv;
199 uv = u;
200 ouv = uv;
204 uv = UTF8_ACCUMULATE(uv, *s);
205 if (uv < ouv)
207 ouv = uv;
211 if ((STRLEN)UNISKIP(uv) < len)
336 UV uv = *s, ouv = 0;
361 if (UTF8_IS_INVARIANT(uv)) {
367 if (UTF8_IS_CONTINUATION(uv) &&
373 if (UTF8_IS_START(uv) && curlen > 1 && !UTF8_IS_CONTINUATION(s[1]) &&
380 uv = NATIVE_TO_UTF(uv);
382 if ((uv == 0xfe || uv == 0xff) &&
389 if (!(uv & 0x20)) { len = 2; uv &= 0x1f; }
390 else if (!(uv & 0x10)) { len = 3; uv &= 0x0f; }
391 else if (!(uv & 0x08)) { len = 4; uv &= 0x07; }
392 else if (!(uv & 0x04)) { len = 5; uv &= 0x03; }
394 else if (!(uv & 0x02)) { len = 6; uv &= 0x01; }
395 else { len = 7; uv &= 0x01; }
397 else if (!(uv & 0x02)) { len = 6; uv &= 0x01; }
398 else if (!(uv & 0x01)) { len = 7; uv = 0; }
399 else { len = 13; uv = 0; } /* whoa! */
415 ouv = uv;
425 uv = UTF8_ACCUMULATE(uv, *s);
426 if (!(uv > ouv)) {
428 if (uv == ouv) {
434 else { /* uv < ouv */
441 ouv = uv;
444 if (UNICODE_IS_SURROGATE(uv) &&
448 } else if ((expectlen > (STRLEN)UNISKIP(uv)) &&
452 } else if (UNICODE_IS_ILLEGAL(uv) &&
458 return uv;
477 Perl_sv_catpvf(aTHX_ sv, "(unexpected continuation byte 0x%02"UVxf", with no preceding start byte)", uv);
489 Perl_sv_catpvf(aTHX_ sv, "(byte 0x%02"UVxf")", uv);
501 Perl_sv_catpvf(aTHX_ sv, "(UTF-16 surrogate 0x%04"UVxf")", uv);
505 expectlen, expectlen == 1 ? "": "s", UNISKIP(uv), startbyte);
508 Perl_sv_catpvf(aTHX_ sv, "(character 0x%04"UVxf")", uv);
840 UV uv = NATIVE_TO_ASCII(*s++);
841 if (UNI_IS_INVARIANT(uv))
842 *d++ = (U8)UTF_TO_NATIVE(uv);
844 *d++ = (U8)UTF8_EIGHT_BIT_HI(uv);
845 *d++ = (U8)UTF8_EIGHT_BIT_LO(uv);
871 UV uv = (p[0] << 8) + p[1]; /* UTF-16BE */
873 if (uv < 0x80) {
874 *d++ = (U8)uv;
877 if (uv < 0x800) {
878 *d++ = (U8)(( uv >> 6) | 0xc0);
879 *d++ = (U8)(( uv & 0x3f) | 0x80);
882 if (uv >= 0xd800 && uv < 0xdbff) { /* surrogates */
887 uv = ((uv - 0xd800) << 10) + (low - 0xdc00) + 0x10000;
889 if (uv < 0x10000) {
890 *d++ = (U8)(( uv >> 12) | 0xe0);
891 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
892 *d++ = (U8)(( uv & 0x3f) | 0x80);
896 *d++ = (U8)(( uv >> 18) | 0xf0);
897 *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80);
898 *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80);
899 *d++ = (U8)(( uv & 0x3f) | 0x80);
1763 =for apidoc A|U8 *|uvchr_to_utf8|U8 *d|UV uv
1765 Adds the UTF-8 representation of the Native codepoint C<uv> to the end
1770 d = uvchr_to_utf8(d, uv);
1774 *(d++) = uv;
1784 Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv)
1786 return Perl_uvuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), 0);
1790 Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
1792 return Perl_uvuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), flags);
1813 UV uv = Perl_utf8n_to_uvuni(aTHX_ s, curlen, retlen, flags);
1814 return UNI_TO_NATIVE(uv);