10.12.2010 - light modifies in headers
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "piconsole.h"
|
||||
|
||||
|
||||
PIConsole::PIConsole(bool startNow, KeyFunc slot): PIThread() {
|
||||
PIConsole::PIConsole(bool startNow, KBFunc slot): PIThread() {
|
||||
setPriority(piLow);
|
||||
needLockRun(true);
|
||||
ret_func = slot;
|
||||
@@ -110,7 +110,7 @@ bool PIConsole::setTabBindKey(PIString name, char bind_key) {
|
||||
}
|
||||
|
||||
|
||||
void PIConsole::key_event(void * t, char key) {
|
||||
void PIConsole::key_event(char key, void * t) {
|
||||
PIConsole * p = (PIConsole * )t;
|
||||
for (uint i = 0; i < p->tabsCount(); ++i) {
|
||||
if (p->tabs[i].key == key) {
|
||||
@@ -118,7 +118,7 @@ void PIConsole::key_event(void * t, char key) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (p->ret_func != 0) p->ret_func(t, key);
|
||||
if (p->ret_func != 0) p->ret_func(key, t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,12 +8,10 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
typedef void (*KeyFunc)(void * , char);
|
||||
|
||||
class PIConsole: public PIThread
|
||||
{
|
||||
public:
|
||||
PIConsole(bool startNow = true, KeyFunc slot = 0);
|
||||
PIConsole(bool startNow = true, KBFunc slot = 0);
|
||||
~PIConsole();
|
||||
|
||||
enum Format {Normal = 0x01,
|
||||
@@ -120,7 +118,7 @@ private:
|
||||
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);
|
||||
static void key_event(void * t, char key);
|
||||
static void key_event(char key, void * t);
|
||||
|
||||
struct Variable {
|
||||
PIString name;
|
||||
@@ -188,7 +186,7 @@ private:
|
||||
vector<Tab> tabs;
|
||||
Variable tv;
|
||||
PIKbdListener * listener;
|
||||
KeyFunc ret_func;
|
||||
KBFunc ret_func;
|
||||
int width, height, ret, col_wid, num_format;
|
||||
uint my;
|
||||
uint cur_tab, col_cnt;
|
||||
|
||||
@@ -34,6 +34,6 @@ void PIKbdListener::run() {
|
||||
#else
|
||||
ret = read(0, &rc, 1);
|
||||
#endif
|
||||
if (ret_func != 0 && ret > 0) ret_func(data, rc);
|
||||
if (ret_func != 0 && ret > 0) ret_func(rc, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
typedef void (*KBFunc)(void * , char);
|
||||
typedef void (*KBFunc)(char, void * );
|
||||
|
||||
class PIKbdListener: public PIThread {
|
||||
public:
|
||||
// slot is any function format "void <func>(void * , char)"
|
||||
// slot is any function format "void <func>(char, void * )"
|
||||
PIKbdListener(KBFunc slot = 0, void * data = 0);
|
||||
~PIKbdListener();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void PIProtocol::init() {
|
||||
net_diag = PIProtocol::Unknown;
|
||||
cur_pckt = 0;
|
||||
timer = 0;
|
||||
sendtimer = new PITimer(this, run);
|
||||
sendtimer = new PITimer(run, this);
|
||||
wrong_count = receive_count = send_count = 0;
|
||||
immediateFreq = integralFreq = 0.f;
|
||||
headerPtr = dataPtr = sendDataPtr = 0;
|
||||
@@ -68,7 +68,7 @@ void PIProtocol::setExpectedFrequency(float frequency)
|
||||
if (exp_freq < 3.33) pckt_cnt_max = 10;
|
||||
else pckt_cnt_max = 3 * (int)exp_freq;
|
||||
last_packets.resize(pckt_cnt_max);
|
||||
timer = new PITimer(this, diag_event);
|
||||
timer = new PITimer(diag_event, this);
|
||||
timer->start(1000. / exp_freq);
|
||||
timer->reset();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
PIString(const char * str) {*this += str;}
|
||||
PIString(const string & str) {*this += str;}
|
||||
PIString(const PIString & str) {*this += str;}
|
||||
PIString(const int len, const char c = ' ') {for (uint i = 0; i < len; ++i) push_back(c);}
|
||||
PIString(const int len, const char c = ' ') {for (int i = 0; i < len; ++i) push_back(c);}
|
||||
|
||||
operator const char*() {return data();}
|
||||
operator const string() {return (size() == 0) ? string() : string(&at(0), size());}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "pitimer.h"
|
||||
|
||||
|
||||
PITimer::PITimer(void * data_, TimerEvent slot) {
|
||||
PITimer::PITimer(TimerEvent slot, void * data_) {
|
||||
ret_func = slot;
|
||||
data = data_;
|
||||
#ifndef __WIN32__
|
||||
|
||||
Reference in New Issue
Block a user