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();
96 QTextStream &kdDebug(
int area )
106 QTextStream &kdWarning(
int area )
108 return consoleOut() <<
"WARNING: (" << area <<
") ";
111 QString i18n(
const char *
string )
113 return QObject::tr(
string,
"qjsembed string");
124 kjsembed_in =
new QTextStream( stdin, QIODevice::ReadOnly );
136 kjsembed_out =
new QTextStream( stdout, QIODevice::WriteOnly );
149 kjsembed_err =
new QTextStream( stderr, QIODevice::WriteOnly );
QTextStream & consoleError()
KJSEMBED_EXPORT QTextStream * conin()
static QTextStream * kjsembed_err
KJSEMBED_EXPORT QTextStream * conout()
QTextStream & consoleOut()
QTextStream & consoleIn()
static QTextStream * kjsembed_in
static QTextStream * kjsembed_out
KJSEMBED_EXPORT QTextStream * conerr()