Build to the scalar dsv a displayable version of the string spv,
length len, the displayable version being at most pvlim bytes long
(if longer, the rest is truncated and "..." will be appended).
-The flags argument is currently unused but available for future extensions.
+
+The flags argument can have UNI_DISPLAY_ISPRINT set to display
+isprint()able characters as themselves, UNI_DISPLAY_BACKSLASH
+to display the \\[nrfta\\] as the backslashed versions (like '\n')
+(UNI_DISPLAY_BACKSLASH is preferred over UNI_DISPLAY_ISPRINT for \\).
+UNI_DISPLAY_QQ (and its alias UNI_DISPLAY_REGEX) have both
+UNI_DISPLAY_BACKSLASH and UNI_DISPLAY_ISPRINT turned on.
+
The pointer to the PV of the dsv is returned.
char* pv_uni_display(SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
=item sv_uni_display
Build to the scalar dsv a displayable version of the scalar sv,
-he displayable version being at most pvlim bytes long
+the displayable version being at most pvlim bytes long
(if longer, the rest is truncated and "..." will be appended).
-The flags argument is currently unused but available for future extensions.
+
+The flags argument is as in pv_uni_display().
+
The pointer to the PV of the dsv is returned.
char* sv_uni_display(SV *dsv, SV *ssv, STRLEN pvlim, UV flags)
=cut
*/
-/* On ASCII machines this is normally a macro but we want a
- real function in case XS code wants it
+/* On ASCII machines this is normally a macro but we want
+ a real function in case XS code wants it
*/
#undef Perl_utf8n_to_uvchr
UV
Build to the scalar dsv a displayable version of the string spv,
length len, the displayable version being at most pvlim bytes long
(if longer, the rest is truncated and "..." will be appended).
+
The flags argument can have UNI_DISPLAY_ISPRINT set to display
-isprint() characters as themselves.
+isprint()able characters as themselves, UNI_DISPLAY_BACKSLASH
+to display the \\[nrfta\\] as the backslashed versions (like '\n')
+(UNI_DISPLAY_BACKSLASH is preferred over UNI_DISPLAY_ISPRINT for \\).
+UNI_DISPLAY_QQ (and its alias UNI_DISPLAY_REGEX) have both
+UNI_DISPLAY_BACKSLASH and UNI_DISPLAY_ISPRINT turned on.
+
The pointer to the PV of the dsv is returned.
=cut */
}
u = utf8_to_uvchr((U8*)s, 0);
if (u < 256) {
- if (!ok && (flags & UNI_DISPLAY_ISPRINT) && isprint(u & 0xFF)) {
- Perl_sv_catpvf(aTHX_ dsv, "%c", u);
- ok = TRUE;
- }
if (!ok && (flags & UNI_DISPLAY_BACKSLASH)) {
switch (u & 0xFF) {
case '\n':
default: break;
}
}
+ if (!ok && (flags & UNI_DISPLAY_ISPRINT) && isprint(u & 0xFF)) {
+ Perl_sv_catpvf(aTHX_ dsv, "%c", u);
+ ok = TRUE;
+ }
}
if (!ok)
Perl_sv_catpvf(aTHX_ dsv, "\\x{%"UVxf"}", u);
=for apidoc A|char *|sv_uni_display|SV *dsv|SV *ssv|STRLEN pvlim|UV flags
Build to the scalar dsv a displayable version of the scalar sv,
-he displayable version being at most pvlim bytes long
+the displayable version being at most pvlim bytes long
(if longer, the rest is truncated and "..." will be appended).
-The flags argument is currently unused but available for future extensions.
+
+The flags argument is as in pv_uni_display().
+
The pointer to the PV of the dsv is returned.
=cut */