]> git.proxmox.com Git - rustc.git/blame - src/llvm/lib/Support/Locale.cpp
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / lib / Support / Locale.cpp
CommitLineData
223e47cc 1#include "llvm/Support/Locale.h"
1a4d82fc 2#include "llvm/Support/Unicode.h"
223e47cc 3
1a4d82fc
JJ
4namespace llvm {
5namespace sys {
6namespace locale {
7
8int columnWidth(StringRef Text) {
9#if LLVM_ON_WIN32
10 return Text.size();
223e47cc 11#else
1a4d82fc 12 return llvm::sys::unicode::columnWidthUTF8(Text);
223e47cc 13#endif
1a4d82fc
JJ
14}
15
16bool isPrint(int UCS) {
17#if LLVM_ON_WIN32
18 // Restrict characters that we'll try to print to the the lower part of ASCII
19 // except for the control characters (0x20 - 0x7E). In general one can not
20 // reliably output code points U+0080 and higher using narrow character C/C++
21 // output functions in Windows, because the meaning of the upper 128 codes is
22 // determined by the active code page in the console.
23 return ' ' <= UCS && UCS <= '~';
24#else
25 return llvm::sys::unicode::isPrintable(UCS);
26#endif
27}
28
29} // namespace locale
30} // namespace sys
31} // namespace llvm