GUI: Rename ConsolDialog methods (v)printf, putchar

svn-id: r54006
This commit is contained in:
Max Horn 2010-11-01 16:03:02 +00:00
parent 06876671e5
commit 2af2704421
3 changed files with 17 additions and 22 deletions

View File

@ -487,7 +487,7 @@ void ConsoleDialog::defaultKeyDownHandler(Common::KeyState &state) {
for (int i = _promptEndPos - 1; i >= _currentPos; i--)
buffer(i + 1) = buffer(i);
_promptEndPos++;
putchar((byte)state.ascii);
printChar((byte)state.ascii);
scrollToCurrent();
}
}
@ -498,7 +498,7 @@ void ConsoleDialog::insertIntoPrompt(const char* str) {
buffer(i + l) = buffer(i);
for (unsigned int j = 0; j < l; ++j) {
_promptEndPos++;
putcharIntern(str[j]);
printCharIntern(str[j]);
}
}
@ -620,7 +620,7 @@ void ConsoleDialog::historyScroll(int direction) {
else
idx = _historyIndex;
for (int i = 0; i < kLineBufferSize && _history[idx][i] != '\0'; i++)
putcharIntern(_history[idx][i]);
printCharIntern(_history[idx][i]);
_promptEndPos = _currentPos;
// Ensure once more the caret is visible (in case of very long history entries)
@ -659,38 +659,33 @@ void ConsoleDialog::updateScrollBuffer() {
_scrollBar->recalc();
}
int ConsoleDialog::printf(const char *format, ...) {
int ConsoleDialog::printFormat(int dummy, const char *format, ...) {
va_list argptr;
va_start(argptr, format);
int count = this->vprintf(format, argptr);
int count = this->vprintFormat(dummy, format, argptr);
va_end (argptr);
return count;
}
int ConsoleDialog::vprintf(const char *format, va_list argptr) {
int ConsoleDialog::vprintFormat(int dummy, const char *format, va_list argptr) {
char buf[2048];
#if defined(WIN32)
int count = _vsnprintf(buf, sizeof(buf), format, argptr);
#elif defined(__SYMBIAN32__)
int count = vsprintf(buf, format, argptr);
#else
int count = vsnprintf(buf, sizeof(buf), format, argptr);
#endif
buf[sizeof(buf)-1] = 0; // ensure termination
print(buf);
return count;
}
void ConsoleDialog::putchar(int c) {
void ConsoleDialog::printChar(int c) {
if (_caretVisible)
drawCaret(true);
putcharIntern(c);
printCharIntern(c);
drawLine(pos2line(_currentPos));
}
void ConsoleDialog::putcharIntern(int c) {
void ConsoleDialog::printCharIntern(int c) {
if (c == '\n')
nextLine();
else {
@ -708,7 +703,7 @@ void ConsoleDialog::print(const char *str) {
drawCaret(true);
while (*str)
putcharIntern(*str++);
printCharIntern(*str++);
draw();
}

View File

@ -143,10 +143,10 @@ public:
void handleKeyDown(Common::KeyState state);
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
int printf(const char *format, ...) GCC_PRINTF(2, 3);
int vprintf(const char *format, va_list argptr);
#undef putchar
void putchar(int c);
int printFormat(int dummy, const char *format, ...) GCC_PRINTF(3, 4);
int vprintFormat(int dummy, const char *format, va_list argptr);
void printChar(int c);
void setInputCallback(InputCallbackProc proc, void *refCon) {
_callbackProc = proc;
@ -172,7 +172,7 @@ protected:
void drawLine(int line, bool restoreBg = true);
void drawCaret(bool erase);
void putcharIntern(int c);
void printCharIntern(int c);
void insertIntoPrompt(const char *str);
void print(const char *str);
void updateScrollBuffer();

View File

@ -78,7 +78,7 @@ int Debugger::DebugPrintf(const char *format, ...) {
va_start(argptr, format);
int count;
#ifndef USE_TEXT_CONSOLE
count = _debuggerDialog->vprintf(format, argptr);
count = _debuggerDialog->vprintFormat(1, format, argptr);
#else
count = ::vprintf(format, argptr);
#endif