mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
1b50bd3f5c
Code extracted from:
http://public.kitware.com/KWSys.git
at commit 4967ccc054d268c430e73445f3a103e737c5f5f7 (master).
Upstream Shortlog
-----------------
Chuck Atkins (2):
f1afce25 DynamicLoader: Re-organize preprocessor checks to use if, elif, else
d94f92f7 DynamicLoader: Expand noop implementation to more platforms
Dāvis Mosāns (2):
f069db91 Encoding: Fix conversion of strings that contain null bytes
4967ccc0 ConsoleBuf: Fix output for strings that contain null byte
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
|
|
#include "kwsysPrivate.h"
|
|
|
|
#include KWSYS_HEADER(ConsoleBuf.hxx)
|
|
#include KWSYS_HEADER(Encoding.hxx)
|
|
|
|
// Work-around CMake dependency scanning limitation. This must
|
|
// duplicate the above list of headers.
|
|
#if 0
|
|
#include "ConsoleBuf.hxx.in"
|
|
#include "Encoding.hxx.in"
|
|
#endif
|
|
|
|
#include <iostream>
|
|
|
|
#include "testConsoleBuf.hxx"
|
|
|
|
//----------------------------------------------------------------------------
|
|
int main(int argc, const char* argv[])
|
|
{
|
|
#if defined(_WIN32)
|
|
kwsys::ConsoleBuf::Manager out(std::cout);
|
|
kwsys::ConsoleBuf::Manager err(std::cerr, true);
|
|
kwsys::ConsoleBuf::Manager in(std::cin);
|
|
|
|
if (argc > 1) {
|
|
std::cout << argv[1] << std::endl;
|
|
std::cerr << argv[1] << std::endl;
|
|
} else {
|
|
std::string str = kwsys::Encoding::ToNarrow(std::wstring(
|
|
UnicodeTestString, sizeof(UnicodeTestString) / sizeof(wchar_t) - 1));
|
|
std::cout << str << std::endl;
|
|
std::cerr << str << std::endl;
|
|
}
|
|
|
|
std::string input;
|
|
HANDLE event = OpenEventW(EVENT_MODIFY_STATE, FALSE, BeforeInputEventName);
|
|
if (event) {
|
|
SetEvent(event);
|
|
CloseHandle(event);
|
|
}
|
|
|
|
std::cin >> input;
|
|
std::cout << input << std::endl;
|
|
event = OpenEventW(EVENT_MODIFY_STATE, FALSE, AfterOutputEventName);
|
|
if (event) {
|
|
SetEvent(event);
|
|
CloseHandle(event);
|
|
}
|
|
#else
|
|
static_cast<void>(argc);
|
|
static_cast<void>(argv);
|
|
#endif
|
|
return 0;
|
|
}
|