|
6854 | 6854 | without regard to the value of \tcode{os.exceptions()} and
|
6855 | 6855 | without turning on \tcode{ios_base::badbit} in the error state of \tcode{os}.
|
6856 | 6856 | \end{itemize}
|
| 6857 | + |
| 6858 | +\par % This paragraph is part of the \effects clause. |
6857 | 6859 | After constructing a \tcode{sentry} object,
|
6858 | 6860 | the function initializes a variable with automatic storage duration via
|
6859 | 6861 | \begin{codeblock}
|
6860 | 6862 | string out = vformat(os.getloc(), fmt, args);
|
6861 | 6863 | \end{codeblock}
|
| 6864 | +\begin{itemize} |
| 6865 | +\item |
6862 | 6866 | If the function is \tcode{vprint_unicode} and
|
6863 |
| -\tcode{os} is a stream that refers to a terminal capable of displaying Unicode |
| 6867 | +\tcode{os} is a stream that refers to a terminal that |
| 6868 | +is only capable of displaying Unicode via a native Unicode API, |
6864 | 6869 | which is determined in an implementation-defined manner,
|
| 6870 | +flushes \tcode{os} and then |
6865 | 6871 | writes \tcode{out} to the terminal using the native Unicode API;
|
6866 | 6872 | if \tcode{out} contains invalid code units,
|
6867 | 6873 | \indextext{undefined}%
|
6868 |
| -the behavior is undefined and |
6869 |
| -implementations are encouraged to diagnose it. |
6870 |
| -If the native Unicode API is used, |
6871 |
| -the function flushes \tcode{os} before writing \tcode{out}. |
6872 |
| -Otherwise (if \tcode{os} is not such a stream or |
6873 |
| -the function is \tcode{vprint_nonunicode}), |
| 6874 | +the behavior is undefined. |
| 6875 | +\item |
| 6876 | +Otherwise |
6874 | 6877 | inserts the character sequence
|
6875 | 6878 | \range{out.begin()}{out.end()} into \tcode{os}.
|
| 6879 | +\end{itemize} |
| 6880 | + |
| 6881 | +\par % This paragraph is part of the \effects clause. |
6876 | 6882 | If writing to the terminal or inserting into \tcode{os} fails,
|
6877 | 6883 | calls \tcode{os.setstate(ios_base::badbit)}
|
6878 | 6884 | (which may throw \tcode{ios_base::failure}).
|
|
7837 | 7843 | Let \tcode{out} denote the character representation of
|
7838 | 7844 | formatting arguments provided by \tcode{args}
|
7839 | 7845 | formatted according to specifications given in \tcode{fmt}.
|
7840 |
| -If \tcode{stream} refers to a terminal capable of displaying Unicode, |
| 7846 | +\begin{itemize} |
| 7847 | +\item |
| 7848 | +If \tcode{stream} refers to a terminal that |
| 7849 | +is only capable of displaying Unicode via a native Unicode API, |
| 7850 | +flushes \tcode{stream} and then |
7841 | 7851 | writes \tcode{out} to the terminal using the native Unicode API;
|
7842 | 7852 | if \tcode{out} contains invalid code units,
|
7843 | 7853 | \indextext{undefined}%
|
7844 |
| -the behavior is undefined and |
7845 |
| -implementations are encouraged to diagnose it. |
| 7854 | +the behavior is undefined. |
| 7855 | +\item |
7846 | 7856 | Otherwise writes \tcode{out} to \tcode{stream} unchanged.
|
7847 |
| -If the native Unicode API is used, |
7848 |
| -the function flushes \tcode{stream} before writing \tcode{out}. |
| 7857 | +\end{itemize} |
7849 | 7858 | Unconditionally unlocks \tcode{stream} on function exit.
|
7850 | 7859 |
|
7851 | 7860 | \xrefc{7.21.2}.
|
7852 | 7861 |
|
7853 | 7862 | \begin{note}
|
7854 |
| -On POSIX and Windows, \tcode{stream} referring to a terminal means that, |
7855 |
| -respectively, |
7856 |
| -\tcode{isatty(fileno(\linebreak{}stream))} and |
| 7863 | +On Windows the native Unicode API is \tcode{WriteConsoleW} and |
| 7864 | +\tcode{stream} referring to a terminal means that |
7857 | 7865 | \tcode{GetConsoleMode(_get_osfhandle(_fileno(stream)), ...)}
|
7858 |
| -return nonzero. |
7859 |
| -\end{note} |
7860 |
| -\begin{note} |
7861 |
| -On Windows, the native Unicode API is \tcode{WriteConsoleW}. |
| 7866 | +returns nonzero. |
7862 | 7867 | \end{note}
|
7863 | 7868 |
|
7864 | 7869 | \pnum
|
|
0 commit comments