1234971Sdim#include "llvm/Support/Locale.h" 2263508Sdim#include "llvm/Support/Unicode.h" 3234971Sdim 4263508Sdimnamespace llvm { 5263508Sdimnamespace sys { 6263508Sdimnamespace locale { 7263508Sdim 8263508Sdimint columnWidth(StringRef Text) { 9263508Sdim#if LLVM_ON_WIN32 10263508Sdim return Text.size(); 11234971Sdim#else 12263508Sdim return llvm::sys::unicode::columnWidthUTF8(Text); 13234971Sdim#endif 14263508Sdim} 15263508Sdim 16263508Sdimbool isPrint(int UCS) { 17263508Sdim#if LLVM_ON_WIN32 18263508Sdim // Restrict characters that we'll try to print to the the lower part of ASCII 19263508Sdim // except for the control characters (0x20 - 0x7E). In general one can not 20263508Sdim // reliably output code points U+0080 and higher using narrow character C/C++ 21263508Sdim // output functions in Windows, because the meaning of the upper 128 codes is 22263508Sdim // determined by the active code page in the console. 23263508Sdim return ' ' <= UCS && UCS <= '~'; 24263508Sdim#else 25263508Sdim return llvm::sys::unicode::isPrintable(UCS); 26263508Sdim#endif 27263508Sdim} 28263508Sdim 29263508Sdim} // namespace locale 30263508Sdim} // namespace sys 31263508Sdim} // namespace llvm 32