19.12.2010 - variables and structs, fixed consoleand interfaces

This commit is contained in:
peri4
2010-12-19 22:00:21 +03:00
parent 8926fe2f69
commit a32edb1fef
12 changed files with 291 additions and 35 deletions

View File

@@ -217,6 +217,7 @@ void PIConsole::begin() {
void PIConsole::run() {
uint cx, clen = 0;
string ts;
#ifdef WINDOWS
GetConsoleScreenBufferInfo(hOut, &sbi);
width = sbi.srWindow.Right - sbi.srWindow.Left;
@@ -262,8 +263,10 @@ void PIConsole::run() {
case 13: clen = printValue(*tv.ull, tv.format); break;
case 14: clen = printValue(bitsValue(tv.uc, tv.bitFrom, tv.bitCount), tv.format); break;
}
if (clen + tv.offset < (uint)col_wid)
printf("%s", PIString(col_wid - clen - tv.offset, ' ').data());
if (clen + tv.offset < (uint)col_wid) {
ts = PIString(col_wid - clen - tv.offset, ' ').stdString();
printf("%s", ts.c_str());
}
newLine();
}
}
@@ -391,14 +394,19 @@ inline void PIConsole::printLine(const PIString & value, int dx, Flags<PIConsole
#ifdef QNX
--i;
#endif
couts(fstr(format).stdString());
if (i >= 0) couts((value + PIString(i, ' ')).stdString());
else couts(value.left(value.size() + i).stdString());
couts(fstr(Dec).stdString());
string ts = fstr(format).stdString();
couts(ts);
if (i >= 0) ts = (value + PIString(i, ' ')).stdString();
else ts = value.left(value.size() + i).stdString();
couts(ts);
ts = fstr(Dec).stdString();
couts(ts);
}
inline int PIConsole::printValue(const PIString & value, Flags<PIConsole::Format> format) {
couts(fstr(format).stdString());
int ret = couts(value.stdString());
string ts = fstr(format).stdString();
couts(ts);
ts = value.stdString();
int ret = couts(ts);
fstr(PIConsole::Dec);
return ret;
}