29.07.2011 - fundamental new
This commit is contained in:
146
piconsole.h
146
piconsole.h
@@ -29,42 +29,73 @@ public:
|
||||
Magenta = 0x2000,
|
||||
Cyan = 0x4000,
|
||||
White = 0x8000,
|
||||
Dec = 0x10000,
|
||||
Hex = 0x20000,
|
||||
Oct = 0x40000,
|
||||
Scientific = 0x80000};
|
||||
BackBlack = 0x10000,
|
||||
BackRed = 0x20000,
|
||||
BackGreen = 0x40000,
|
||||
BackYellow = 0x80000,
|
||||
BackBlue = 0x100000,
|
||||
BackMagenta = 0x200000,
|
||||
BackCyan = 0x400000,
|
||||
BackWhite = 0x800000,
|
||||
Dec = 0x1000000,
|
||||
Hex = 0x2000000,
|
||||
Oct = 0x4000000,
|
||||
Scientific = 0x8000000};
|
||||
|
||||
void addString(PIString name, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, PIString * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, char * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, bool * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, short * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, int * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, long * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, llong * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, uchar * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, ushort * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, uint * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, ulong * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, ullong * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, float * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(PIString name, double * ptr, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addBitVariable(PIString name, uchar * ptr, int fromBit, int bitCount, int column = 1, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addEmptyLine(int column = 1);
|
||||
int addTab(PIString name, char bind_key = 0);
|
||||
void removeTab(uint index);
|
||||
void removeTab(PIString name);
|
||||
void addString(const PIString & name, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, PIString * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, char * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, bool * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, short * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, int * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, long * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, llong * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, uchar * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, ushort * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, uint * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, ulong * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, ullong * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, float * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addVariable(const PIString & name, double * ptr, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addBitVariable(const PIString & name, void * ptr, int fromBit, int bitCount, int column = 1, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
void addEmptyLine(int column = 1, uint count = 1);
|
||||
|
||||
PIString getString(int x, int y);
|
||||
short getShort(int x, int y) {return getString(x, y).toShort();}
|
||||
int getInt(int x, int y) {return getString(x, y).toInt();}
|
||||
float getFloat(int x, int y) {return getString(x, y).toFloat();}
|
||||
double getDouble(int x, int y) {return getString(x, y).toDouble();}
|
||||
PIString getString(const PIString & name);
|
||||
short getShort(const PIString & name) {return getString(name).toShort();}
|
||||
int getInt(const PIString & name) {return getString(name).toInt();}
|
||||
float getFloat(const PIString & name) {return getString(name).toFloat();}
|
||||
double getDouble(const PIString & name) {return getString(name).toDouble();}
|
||||
|
||||
uint tabsCount() const {return tabs.size();}
|
||||
bool setTab(uint index);
|
||||
bool setTab(PIString name);
|
||||
bool setTabBindKey(uint index, char bind_key);
|
||||
bool setTabBindKey(PIString name, char bind_key);
|
||||
void addCustomStatus(PIString str) {tabs[cur_tab].status = str;}
|
||||
void clearCustomStatus() {tabs[cur_tab].status = "";}
|
||||
void clearVariables(bool clearScreen = true) {if (clearScreen && isRunning()) {toUpperLeft(); clearScreenLower();} vars().clear();}
|
||||
void clearTabs(bool clearScreen = true) {if (clearScreen && isRunning()) {toUpperLeft(); clearScreenLower();} tabs.clear();}
|
||||
PIString fstr(Flags<PIConsole::Format> f);
|
||||
PIString currentTab() const {return tabs[cur_tab].name;}
|
||||
int addTab(const PIString & name, char bind_key = 0);
|
||||
void removeTab(uint index);
|
||||
void removeTab(const PIString & name);
|
||||
bool setTab(uint index);
|
||||
bool setTab(const PIString & name);
|
||||
bool setTabBindKey(uint index, char bind_key);
|
||||
bool setTabBindKey(const PIString & name, char bind_key);
|
||||
void clearTabs(bool clearScreen = true) {if (clearScreen && isRunning()) {toUpperLeft(); clearScreenLower();} tabs.clear();}
|
||||
|
||||
void addCustomStatus(const PIString & str) {tabs[cur_tab].status = str;}
|
||||
void clearCustomStatus() {tabs[cur_tab].status.clear();}
|
||||
|
||||
void clearVariables(bool clearScreen = true) {if (clearScreen && isRunning()) {toUpperLeft(); clearScreenLower();} vars().clear();}
|
||||
|
||||
inline void waitForFinish() {WAIT_FOR_EXIT}
|
||||
inline void start() {PIThread::start(40);}
|
||||
void stop(bool clear = false);
|
||||
PIString fstr(PIFlags<PIConsole::Format> f);
|
||||
|
||||
inline void enableExitCapture(char key = 'Q') {listener->enableExitCapture(key);}
|
||||
inline void disableExitCapture() {listener->disableExitCapture();}
|
||||
inline bool exitCaptured() const {return listener->exitCaptured();}
|
||||
inline char exitKey() const {return listener->exitKey();}
|
||||
|
||||
private:
|
||||
void begin();
|
||||
@@ -101,28 +132,30 @@ private:
|
||||
#endif
|
||||
void status();
|
||||
void checkColumn(uint col) {if (vars().size() < col) {vars().resize(col);}}
|
||||
int bitsValue(unsigned char * src, int offset, int count);
|
||||
inline void printLine(const PIString & str, int dx = 0, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const PIString & str, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const char * str, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const bool value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const int value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const long value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const llong value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const float value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const double value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const char value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const short value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const uchar value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const ushort value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const uint value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const ulong value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const ullong value, Flags<PIConsole::Format> format = PIConsole::Normal);
|
||||
int bitsValue(void * src, int offset, int count);
|
||||
inline void printLine(const PIString & str, int dx = 0, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const PIString & str, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const char * str, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const bool value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const int value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const long value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const llong value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const float value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const double value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const char value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const short value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const uchar value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const ushort value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const uint value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const ulong value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
inline int printValue(const ullong value, PIFlags<PIConsole::Format> format = PIConsole::Normal);
|
||||
static void key_event(char key, void * t);
|
||||
|
||||
struct Variable {
|
||||
PIString name;
|
||||
Flags<PIConsole::Format> format;
|
||||
PIFlags<PIConsole::Format> format;
|
||||
int nx;
|
||||
int ny;
|
||||
int type;
|
||||
int offset;
|
||||
int bitFrom;
|
||||
@@ -142,13 +175,14 @@ private:
|
||||
uint * ui;
|
||||
ulong * ul;
|
||||
ullong * ull;
|
||||
void * ptr;
|
||||
};
|
||||
void operator =(const Variable & src) {name = src.name; format = src.format; type = src.type; offset = src.offset;
|
||||
bitFrom = src.bitFrom; bitCount = src.bitCount; c = src.c;}
|
||||
bitFrom = src.bitFrom; bitCount = src.bitCount; c = src.c; nx = src.nx; ny = src.ny;}
|
||||
};
|
||||
|
||||
struct Tab {
|
||||
vector<vector<Variable> > variables;
|
||||
PIVector<PIVector<Variable> > variables;
|
||||
PIString name;
|
||||
PIString status;
|
||||
char key;
|
||||
@@ -156,7 +190,7 @@ private:
|
||||
Tab(PIString n, char k) {name = n; key = k;}
|
||||
};
|
||||
|
||||
inline vector<vector<Variable> > & vars() {return tabs[cur_tab].variables;}
|
||||
inline PIVector<PIVector<Variable> > & vars() {return tabs[cur_tab].variables;}
|
||||
inline int couts(const string v);
|
||||
inline int couts(const char * v);
|
||||
inline int couts(const bool v);
|
||||
@@ -183,11 +217,11 @@ private:
|
||||
#else
|
||||
struct termios sterm, vterm;
|
||||
#endif
|
||||
vector<Tab> tabs;
|
||||
PIVector<Tab> tabs;
|
||||
Variable tv;
|
||||
PIKbdListener * listener;
|
||||
KBFunc ret_func;
|
||||
int width, height, ret, col_wid, num_format;
|
||||
int width, height, pwidth, pheight, ret, col_wid, num_format;
|
||||
uint my;
|
||||
uint cur_tab, col_cnt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user