30 #if defined(_WIN32) || defined(_WIN64)
36 # include <QTextStream>
43 #if defined(_WIN32) || defined(_WIN64)
44 static QFile win32_stdin;
45 static QFile win32_stdout;
46 static QFile win32_stderr;
48 static const WORD MAX_CONSOLE_LINES = 500;
50 void RedirectIOToConsole() {
53 CONSOLE_SCREEN_BUFFER_INFO coninfo;
55 GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
56 coninfo.dwSize.Y = MAX_CONSOLE_LINES;
57 SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
59 lStdHandle = (intptr_t)GetStdHandle(STD_INPUT_HANDLE);
60 hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
61 win32_stdin.
open(hConHandle,QIODevice::ReadOnly);
63 lStdHandle = (intptr_t)GetStdHandle(STD_OUTPUT_HANDLE);
64 hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
65 win32_stdout.
open(hConHandle,QIODevice::WriteOnly);
67 lStdHandle = (intptr_t)GetStdHandle(STD_ERROR_HANDLE);
68 hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
69 win32_stderr.
open(hConHandle, QIODevice::WriteOnly);
71 std::ios::sync_with_stdio();
108 return consoleOut() <<
"WARNING: (" << area <<
") ";
111 QString i18n(
const char *
string )
120 if ( !kjsembed_in ) {
124 kjsembed_in =
new QTextStream( stdin, QIODevice::ReadOnly );
132 if ( !kjsembed_out ) {
136 kjsembed_out =
new QTextStream( stdout, QIODevice::WriteOnly );
145 if ( !kjsembed_err ) {
149 kjsembed_err =
new QTextStream( stderr, QIODevice::WriteOnly );
QTextStream & consoleError()
KJSEMBED_EXPORT QTextStream * conin()
QString tr(const char *sourceText, const char *disambiguation, int n)
static QTextStream * kjsembed_err
KJSEMBED_EXPORT QTextStream * conout()
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QTextStream & consoleOut()
QTextStream & consoleIn()
static QTextStream * kjsembed_in
static QTextStream * kjsembed_out
KJSEMBED_EXPORT QTextStream * conerr()