diff options
Diffstat (limited to 'lskat/lskatproc')
-rw-r--r-- | lskat/lskatproc/KChildConnect.cpp | 20 | ||||
-rw-r--r-- | lskat/lskatproc/KChildConnect.h | 12 | ||||
-rw-r--r-- | lskat/lskatproc/KEMessage.cpp | 70 | ||||
-rw-r--r-- | lskat/lskatproc/KEMessage.h | 56 | ||||
-rw-r--r-- | lskat/lskatproc/KInputChildProcess.cpp | 10 | ||||
-rw-r--r-- | lskat/lskatproc/KInputChildProcess.h | 4 | ||||
-rw-r--r-- | lskat/lskatproc/lskatproc.cpp | 34 |
7 files changed, 103 insertions, 103 deletions
diff --git a/lskat/lskatproc/KChildConnect.cpp b/lskat/lskatproc/KChildConnect.cpp index 0308a3f0..6ea4b973 100644 --- a/lskat/lskatproc/KChildConnect.cpp +++ b/lskat/lskatproc/KChildConnect.cpp @@ -20,7 +20,7 @@ #include "KChildConnect.moc" KChildConnect::KChildConnect() - : QObject(0,0) + : TQObject(0,0) { input_pending=false; inputbuffer=""; @@ -38,14 +38,14 @@ KR_STATUS KChildConnect::QueryStatus() // Communication with process bool KChildConnect::SendMsg(KEMessage *msg) { - QString sendstring=msg->ToString(); + TQString sendstring=msg->ToString(); // Debug only - if (msg->HasKey(QCString("KLogSendMsg"))) + if (msg->HasKey(TQCString("KLogSendMsg"))) { char *p; int size; FILE *fp; - msg->GetData(QCString("KLogSendMsg"),p,size); + msg->GetData(TQCString("KLogSendMsg"),p,size); if (p && (fp=fopen(p,"a")) ) { fprintf(fp,"------------------------------------\n"); @@ -58,7 +58,7 @@ bool KChildConnect::SendMsg(KEMessage *msg) } // Send string to parent -bool KChildConnect::Send(QString str) +bool KChildConnect::Send(TQString str) { if (!str || str.length()<1) return true; // no need to send crap printf("%s",str.latin1()); @@ -66,11 +66,11 @@ bool KChildConnect::Send(QString str) return true; } -void KChildConnect::Receive(QString input) +void KChildConnect::Receive(TQString input) { // Cut out CR int len,pos; - QString tmp; + TQString tmp; // Call us recursive until there are no CR left @@ -86,14 +86,14 @@ void KChildConnect::Receive(QString input) } // printf(" ---> KChildConnect::Receive: '%s'\n",(const char *)input); - if (input==QString(KEMESSAGE_HEAD) && !input_pending) + if (input==TQString(KEMESSAGE_HEAD) && !input_pending) { input_pending=true; inputcache.clear(); return ; } if (!input_pending) return ; // ignore - if (input!=QString(KEMESSAGE_TAIL)) + if (input!=TQString(KEMESSAGE_TAIL)) { inputcache.append(input.latin1()); return; @@ -104,7 +104,7 @@ void KChildConnect::Receive(QString input) char *it; for (it=inputcache.first();it!=0;it=inputcache.next()) { - msg->AddString(QCString(it)); + msg->AddString(TQCString(it)); } // printf("+- CHILDprocess:: GOT MESSAGE::Emmiting slotReceiveMsg\n"); diff --git a/lskat/lskatproc/KChildConnect.h b/lskat/lskatproc/KChildConnect.h index 9cad1a5d..37339218 100644 --- a/lskat/lskatproc/KChildConnect.h +++ b/lskat/lskatproc/KChildConnect.h @@ -9,8 +9,8 @@ #ifndef _KCHILDCONNECT_H_ #define _KCHILDCONNECT_H_ -#include <qobject.h> -#include <qstrlist.h> +#include <tqobject.h> +#include <tqstrlist.h> #include "KEMessage.h" @@ -19,20 +19,20 @@ class KChildConnect: public QObject Q_OBJECT protected: - QStrList inputcache; + TQStrList inputcache; bool input_pending; - QString inputbuffer; + TQString inputbuffer; int ID; public: KChildConnect(); ~KChildConnect(); - void Receive(QString input); + void Receive(TQString input); int QueryID(); void SetID(int id); virtual bool SendMsg(KEMessage *msg); - virtual bool Send(QString str); + virtual bool Send(TQString str); virtual KR_STATUS QueryStatus(); public slots: diff --git a/lskat/lskatproc/KEMessage.cpp b/lskat/lskatproc/KEMessage.cpp index db598573..ce8985f3 100644 --- a/lskat/lskatproc/KEMessage.cpp +++ b/lskat/lskatproc/KEMessage.cpp @@ -19,7 +19,7 @@ #include <stdlib.h> #include "KEMessage.h" -void KEMessage::AddEntry(QString key,KMessageEntry *entry) +void KEMessage::AddEntry(TQString key,KMessageEntry *entry) { // printf(" AddingEntry: %s with data field %p\n",(char *)key,entry->QueryData()); if (!entry) return ; @@ -27,7 +27,7 @@ void KEMessage::AddEntry(QString key,KMessageEntry *entry) keys.append(key.latin1()); } -void KEMessage::AddDataType(QString key,int size,const char *data,KGM_TYPE type) +void KEMessage::AddDataType(TQString key,int size,const char *data,KGM_TYPE type) { // printf("AddDataType for %s size=%d\n",(const char *)key,size); if (size<=0) return ; @@ -37,28 +37,28 @@ void KEMessage::AddDataType(QString key,int size,const char *data,KGM_TYPE type) AddEntry(key,entry); } -void KEMessage::AddData(QString key,short data) +void KEMessage::AddData(TQString key,short data) { AddDataType(key,sizeof(short),(char *)&data,KGM_TYPE_SHORT); } -void KEMessage::AddData(QString key,long data) +void KEMessage::AddData(TQString key,long data) { AddDataType(key,sizeof(long),(char *)&data,KGM_TYPE_LONG); } -void KEMessage::AddData(QString key,float data) +void KEMessage::AddData(TQString key,float data) { AddDataType(key,sizeof(float),(char *)&data,KGM_TYPE_FLOAT); } -void KEMessage::AddData(QString key,const char *data,int size) +void KEMessage::AddData(TQString key,const char *data,int size) { if (size<0) size=strlen(data)+1; // +1 for 0 Byte AddDataType(key,size,data,KGM_TYPE_DATA); } -KGM_TYPE KEMessage::QueryType(QString key) +KGM_TYPE KEMessage::QueryType(TQString key) { KMessageEntry *entry; entry=dict.find(key); @@ -66,7 +66,7 @@ KGM_TYPE KEMessage::QueryType(QString key) return entry->QueryType(); } -bool KEMessage::HasKey(QString key) +bool KEMessage::HasKey(TQString key) { KMessageEntry *entry; entry=dict.find(key); @@ -74,7 +74,7 @@ bool KEMessage::HasKey(QString key) return true; } -bool KEMessage::GetData(QString key,short &s) +bool KEMessage::GetData(TQString key,short &s) { short *result; KMessageEntry *entry; @@ -87,7 +87,7 @@ bool KEMessage::GetData(QString key,short &s) return true; } -bool KEMessage::GetData(QString key,long &l) +bool KEMessage::GetData(TQString key,long &l) { long *result; KMessageEntry *entry; @@ -99,7 +99,7 @@ bool KEMessage::GetData(QString key,long &l) return true; } -bool KEMessage::GetData(QString key,float &f) +bool KEMessage::GetData(TQString key,float &f) { float *result; KMessageEntry *entry; @@ -112,7 +112,7 @@ bool KEMessage::GetData(QString key,float &f) return true; } -bool KEMessage::GetData(QString key,char * &c,int &size) +bool KEMessage::GetData(TQString key,char * &c,int &size) { KMessageEntry *entry; entry=dict.find(key); @@ -123,13 +123,13 @@ bool KEMessage::GetData(QString key,char * &c,int &size) return true; } -QString KEMessage::EntryToString(char *key,KMessageEntry *entry) +TQString KEMessage::EntryToString(char *key,KMessageEntry *entry) { - QString s,tmp; + TQString s,tmp; int size,i; KGM_TYPE type; char *data; - s=QCString(""); + s=TQCString(""); if (!entry) return s; size=entry->QuerySize(); type=entry->QueryType(); @@ -142,7 +142,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry) size,KEMESSAGE_SEP, (int)type,KEMESSAGE_SEP); */ - tmp=QCString(key); + tmp=TQCString(key); s+=tmp; s+=KEMESSAGE_SEP; tmp.sprintf("%d",size); @@ -168,31 +168,31 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry) return s; } -QString KEMessage::StringToEntry(QString str,KMessageEntry *entry) +TQString KEMessage::StringToEntry(TQString str,KMessageEntry *entry) { int pos,oldpos,cnt,len; - QString key,size,type,data; + TQString key,size,type,data; const char *p; char *q; char c; len=KEMESSAGE_SEP.length(); - if (!entry) return QString(); + if (!entry) return TQString(); pos=str.find(KEMESSAGE_SEP,0); - if (pos<0) return QString(); // wrong format + if (pos<0) return TQString(); // wrong format key=str.left(pos); oldpos=pos; pos=str.find(KEMESSAGE_SEP,oldpos+len); - if (pos<0) return QString(); // wrong format + if (pos<0) return TQString(); // wrong format size=str.mid(oldpos+len,pos-oldpos-len); oldpos=pos; pos=str.find(KEMESSAGE_SEP,oldpos+len); - if (pos<0) return QString(); // wrong format + if (pos<0) return TQString(); // wrong format type=str.mid(oldpos+len,pos-oldpos-len); @@ -205,10 +205,10 @@ QString KEMessage::StringToEntry(QString str,KMessageEntry *entry) // I hope this works with unicode strings as well p=data.latin1(); q=(char *)calloc(data.length()/2,sizeof(char)); - if (!q) return QString(); + if (!q) return TQString(); for(pos=0;pos<cnt;pos++) { - if (pos*2+1>(int)data.length()) return QString(); // SEVERE ERROR + if (pos*2+1>(int)data.length()) return TQString(); // SEVERE ERROR c=*(p+2*pos)-'a' | ((*(p+2*pos+1)-'a')<<4); q[pos]=c; } @@ -218,35 +218,35 @@ QString KEMessage::StringToEntry(QString str,KMessageEntry *entry) return key; } -QString KEMessage::ToString() +TQString KEMessage::ToString() { - QString s; + TQString s; KMessageEntry *entry; char *it; s=KEMESSAGE_HEAD+KEMESSAGE_CR; for (it=keys.first();it!=0;it=keys.next()) { - entry=dict.find(QCString(it)); + entry=dict.find(TQCString(it)); s+=EntryToString(it,entry); } s+=KEMESSAGE_TAIL+KEMESSAGE_CR; return s; } -bool KEMessage::AddString(QString s) +bool KEMessage::AddString(TQString s) { // break s into key,size and data - QString key; + TQString key; KMessageEntry *entry=new KMessageEntry; key=StringToEntry(s,entry); if (!key) return false; AddEntry(key,entry); return true; } -bool KEMessage::AddStringMsg(QString str) +bool KEMessage::AddStringMsg(TQString str) { bool result; - QString data; + TQString data; int pos,oldpos,len; len=KEMESSAGE_CR.length(); @@ -277,7 +277,7 @@ void KEMessage::RemoveAll() dict.clear(); } -void KEMessage::Remove(QString key) +void KEMessage::Remove(TQString key) { keys.remove(key.latin1()); dict.remove(key); @@ -287,7 +287,7 @@ uint KEMessage::QueryNumberOfKeys() { return keys.count(); } -QStrList *KEMessage::QueryKeys() +TQStrList *KEMessage::QueryKeys() { return &keys; } @@ -315,10 +315,10 @@ KEMessage &KEMessage::operator=(KEMessage &msg) // printf("Assigning = KEMessage from %p to %p\n",&msg,this); for (it=msg.keys.first();it!=0;it=msg.keys.next()) { - entry=msg.dict.find(QCString(it)); + entry=msg.dict.find(TQCString(it)); newentry=new KMessageEntry; *newentry=*entry; - AddEntry(QCString(it),newentry); + AddEntry(TQCString(it),newentry); } // return *newmsg; diff --git a/lskat/lskatproc/KEMessage.h b/lskat/lskatproc/KEMessage.h index 0a1913cc..9e4d6912 100644 --- a/lskat/lskatproc/KEMessage.h +++ b/lskat/lskatproc/KEMessage.h @@ -18,44 +18,44 @@ #define _KEMESSAGE_H_ #include <string.h> -#include <qstring.h> -#include <qstrlist.h> -#include <qdict.h> +#include <tqstring.h> +#include <tqstrlist.h> +#include <tqdict.h> #include "KMessageEntry.h" -#define KEMESSAGE_HEAD QString(QCString("BEGIN_V1000")) -#define KEMESSAGE_TAIL QString(QCString("END_V1000")) -#define KEMESSAGE_CR QString(QCString("\n")) -#define KEMESSAGE_SEP QString(QCString(":::")) +#define KEMESSAGE_HEAD TQString(TQCString("BEGIN_V1000")) +#define KEMESSAGE_TAIL TQString(TQCString("END_V1000")) +#define KEMESSAGE_CR TQString(TQCString("\n")) +#define KEMESSAGE_SEP TQString(TQCString(":::")) class KEMessage { private: - QStrList keys; - QDict<KMessageEntry> dict; + TQStrList keys; + TQDict<KMessageEntry> dict; protected: - void AddEntry(QString key,KMessageEntry *entry); + void AddEntry(TQString key,KMessageEntry *entry); public: - QStrList *QueryKeys(); + TQStrList *QueryKeys(); uint QueryNumberOfKeys(); - void AddDataType(QString key,int size,const char *data,KGM_TYPE type); - void AddData(QString key,short data); - void AddData(QString key,long data); - void AddData(QString key,float data); - void AddData(QString key,const char *data,int size=-1); - bool GetData(QString key,short &s); - bool GetData(QString key,long &l); - bool GetData(QString key,float &f); - bool GetData(QString key,char * &c,int &size); - bool HasKey(QString key); - void Remove(QString key); - KGM_TYPE QueryType(QString key); - QString ToString(); - QString EntryToString(char *key,KMessageEntry *entry); - QString StringToEntry(QString str,KMessageEntry *entry); - bool AddString(QString s); - bool AddStringMsg(QString str); + void AddDataType(TQString key,int size,const char *data,KGM_TYPE type); + void AddData(TQString key,short data); + void AddData(TQString key,long data); + void AddData(TQString key,float data); + void AddData(TQString key,const char *data,int size=-1); + bool GetData(TQString key,short &s); + bool GetData(TQString key,long &l); + bool GetData(TQString key,float &f); + bool GetData(TQString key,char * &c,int &size); + bool HasKey(TQString key); + void Remove(TQString key); + KGM_TYPE QueryType(TQString key); + TQString ToString(); + TQString EntryToString(char *key,KMessageEntry *entry); + TQString StringToEntry(TQString str,KMessageEntry *entry); + bool AddString(TQString s); + bool AddStringMsg(TQString str); void RemoveAll(); ~KEMessage(); KEMessage(); diff --git a/lskat/lskatproc/KInputChildProcess.cpp b/lskat/lskatproc/KInputChildProcess.cpp index a821aa7a..13e00b93 100644 --- a/lskat/lskatproc/KInputChildProcess.cpp +++ b/lskat/lskatproc/KInputChildProcess.cpp @@ -9,7 +9,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <qstring.h> +#include <tqstring.h> #include "KInputChildProcess.h" #include "KInputChildProcess.moc" @@ -21,7 +21,7 @@ KInputChildProcess::~KInputChildProcess() delete childConnect; } KInputChildProcess::KInputChildProcess(int size_buffer) - : QObject(0,0) + : TQObject(0,0) { buffersize=size_buffer; if (buffersize<1) buffersize=1024; @@ -32,12 +32,12 @@ KInputChildProcess::KInputChildProcess(int size_buffer) bool KInputChildProcess::exec() { int pos; - QString s; + TQString s; childConnect=new KChildConnect; if (!childConnect) return false; - connect(childConnect,SIGNAL(signalReceiveMsg(KEMessage *,int)), - this,SLOT(slotReceiveMsg(KEMessage *,int))); + connect(childConnect,TQT_SIGNAL(signalReceiveMsg(KEMessage *,int)), + this,TQT_SLOT(slotReceiveMsg(KEMessage *,int))); do { // Wait for input diff --git a/lskat/lskatproc/KInputChildProcess.h b/lskat/lskatproc/KInputChildProcess.h index b4694df5..2f964e71 100644 --- a/lskat/lskatproc/KInputChildProcess.h +++ b/lskat/lskatproc/KInputChildProcess.h @@ -17,7 +17,7 @@ #ifndef _KINPUTCHILDPROCESS_H_ #define _KINPUTCHILDPROCESS_H_ -#include <qobject.h> +#include <tqobject.h> #include "KEMessage.h" #include "KChildConnect.h" @@ -28,7 +28,7 @@ class KInputChildProcess : public QObject private: char *buffer; - QString inputbuffer; + TQString inputbuffer; int buffersize; bool terminateChild; protected: diff --git a/lskat/lskatproc/lskatproc.cpp b/lskat/lskatproc/lskatproc.cpp index c1fdcfba..7f40bd69 100644 --- a/lskat/lskatproc/lskatproc.cpp +++ b/lskat/lskatproc/lskatproc.cpp @@ -379,17 +379,17 @@ short x,y; SendDebug("Receiv Msg"); // end of process - if (msg->HasKey(QCString("Terminate"))) + if (msg->HasKey(TQCString("Terminate"))) { Terminate(); } // Init of process - if (msg->HasKey(QCString("Init"))) + if (msg->HasKey(TQCString("Init"))) { // No init necessary } // Make a move - if (msg->HasKey(QCString("Cards"))) + if (msg->HasKey(TQCString("Cards"))) { SendDebug("Process HasKey(Cards)"); // new game object @@ -422,9 +422,9 @@ short x,y; // report move msg->RemoveAll(); - msg->AddData(QCString("Move"),game.currentplayer); - msg->AddData(QCString("MoveX"),x); - msg->AddData(QCString("MoveY"),y); + msg->AddData(TQCString("Move"),game.currentplayer); + msg->AddData(TQCString("MoveX"),x); + msg->AddData(TQCString("MoveY"),y); //timee=time(0); // Sleep a minimum amount to slow down moves @@ -451,29 +451,29 @@ int lgame::ExtractGame(KEMessage *msg) char *p; int size; - msg->GetData(QCString("Startplayer"),startplayer); - msg->GetData(QCString("CurrentPlayer"),currentplayer); - msg->GetData(QCString("Cards"),p,size); - msg->GetData(QCString("Level"),level); + msg->GetData(TQCString("Startplayer"),startplayer); + msg->GetData(TQCString("CurrentPlayer"),currentplayer); + msg->GetData(TQCString("Cards"),p,size); + msg->GetData(TQCString("Level"),level); level--; // start with level 0 for (i=0;i<NO_OF_CARDS;i++) { card[i]=((int *)p)[i]; } - msg->GetData(QCString("Height"),p,size); + msg->GetData(TQCString("Height"),p,size); for (i=0;i<NO_OF_TILES;i++) { cardheight[i]=((int *)p)[i]; } - msg->GetData(QCString("Trump"),tmp); + msg->GetData(TQCString("Trump"),tmp); trump=(CCOLOUR)tmp; short mm; - msg->GetData(QCString("CurrentMove"),mm); + msg->GetData(TQCString("CurrentMove"),mm); curmove[1-currentplayer]=(int)mm; curmove[currentplayer]=-1; - msg->GetData(QCString("No"),movenumber); - msg->GetData(QCString("Sc1"),score[0]); - msg->GetData(QCString("Sc2"),score[1]); + msg->GetData(TQCString("No"),movenumber); + msg->GetData(TQCString("Sc1"),score[0]); + msg->GetData(TQCString("Sc2"),score[1]); return 1; } @@ -586,7 +586,7 @@ int lskatproc::GetComputerMove(lgame game,short &x,short &y,int rek) void lskatproc::SendDebug(const char *s) { KEMessage *msg=new KEMessage; - msg->AddData(QCString("Debug"),s); + msg->AddData(TQCString("Debug"),s); // msg->AddData("KLogSendMsg","debug.log"); // DEBUG // SendMsg(msg); |