summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-01-07 13:52:30 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-07 13:52:30 +0000
commit0a2ef0541d69d1720f3d5aaa6132c0ba5c1cb77a (patch)
tree01a93933afe2dca7587494a62d6ddc6880c19cdc /utf8.c
parent24ba5a3c299023f5194e249f235a760c95d88f74 (diff)
downloadperl-0a2ef0541d69d1720f3d5aaa6132c0ba5c1cb77a.tar.gz
Document the flags of pv_uni_display().
p4raw-id: //depot/perl@14117
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/utf8.c b/utf8.c
index 8258ef5330..d979e168d6 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1646,8 +1646,8 @@ Allows length and flags to be passed to low level routine.
=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
@@ -1663,8 +1663,14 @@ Perl_utf8n_to_uvchr(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
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 */
@@ -1685,10 +1691,6 @@ Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
}
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':
@@ -1706,6 +1708,10 @@ Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
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);
@@ -1720,9 +1726,11 @@ Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags)
=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 */