Skip to content

Commit 53756d5

Browse files
committed
perlapi: Clarifications to uv_to_utf8 entry
1 parent 0aa3d05 commit 53756d5

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

utf8.c

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ const char super_cp_format[] = "Code point 0x%" UVXf " is not Unicode,"
150150
These functions are identical. THEY SHOULD BE USED IN ONLY VERY SPECIALIZED
151151
CIRCUMSTANCES.
152152
153-
Most code should use C<L</uvchr_to_utf8_flags>()> rather than call this directly.
153+
Most code should use C<L</uv_to_utf8_flags>()> rather than call this directly.
154154
155155
This function is for code that wants any warning and/or error messages to be
156-
returned to the caller rather than be displayed. All messages that would have
157-
been displayed if all lexical warnings are enabled will be returned.
156+
returned to the caller rather than be displayed. Any message that would have
157+
been displayed if all lexical warnings are enabled will instead be returned.
158158
159159
It is just like C<L</uvchr_to_utf8_flags>> but it takes an extra parameter
160160
placed after all the others, C<msgs>. If this parameter is 0, this function
161161
behaves identically to C<L</uvchr_to_utf8_flags>>. Otherwise, C<msgs> should
162162
be a pointer to an C<HV *> variable, in which this function creates a new HV to
163-
contain any appropriate messages. The hash has three key-value pairs, as
163+
contain any appropriate message. The hash has three key-value pairs, as
164164
follows:
165165
166166
=over 4
@@ -173,26 +173,44 @@ The text of the message as a C<SVpv>.
173173
174174
The warning category (or categories) packed into a C<SVuv>.
175175
176-
=item C<flag>
176+
=item C<flag_bit>
177177
178178
A single flag bit associated with this message, in a C<SVuv>.
179-
The bit corresponds to some bit in the C<*errors> return value,
180-
such as C<UNICODE_GOT_SURROGATE>.
179+
The bit corresponds to some bit in the C<*errors> return value.
180+
The possibilities are:
181+
182+
=over
183+
184+
=item C<UNICODE_GOT_SURROGATE>
185+
186+
=item C<UNICODE_GOT_NONCHAR>
187+
188+
=item C<UNICODE_GOT_SUPER>
189+
190+
=item C<UNICODE_GOT_PERL_EXTENDED>
191+
192+
=back
181193
182194
=back
183195
184196
It's important to note that specifying this parameter as non-null will cause
185-
any warnings this function would otherwise generate to be suppressed, and
197+
any warning this function would otherwise generate to be suppressed, and
186198
instead be placed in C<*msgs>. The caller can check the lexical warnings state
187-
(or not) when choosing what to do with the returned messages.
199+
(or not) when choosing what to do with the returned message.
200+
201+
Only a single message is returned; if a code point requires Perl extended UTF-8
202+
to represent, it is also above-Unicode. If either the
203+
C<UNICODE_WARN_PERL_EXTENDED> or C<UNICODE_DISALLOW_PERL_EXTENDED> flags are
204+
set, the return is controlled by them; if neither is set, the return is
205+
controlled by the C<UNICODE_WARN_SUPER> and C<UNICODE_DISALLOW_SUPER> flags.
188206
189207
The caller, of course, is responsible for freeing any returned HV.
190208
191209
=cut
192210
*/
193211

194212
/* Undocumented; we don't want people using this. Instead they should use
195-
* uvchr_to_utf8_flags_msgs() */
213+
* uv_to_utf8_msgs() */
196214
U8 *
197215
Perl_uvoffuni_to_utf8_flags_msgs(pTHX_ U8 *d, UV input_uv, UV flags, HV** msgs)
198216
{

0 commit comments

Comments
 (0)