[rkward-cvs] rkward/rkward/scriptbackends phpbackend.cpp,1.4,1.5
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Thu Sep 29 13:24:50 UTC 2005
- Previous message: [rkward-cvs] rkward/po es.po,1.6,1.7 fr.po,1.9,1.10 it.po,1.13,1.14 pl.po,1.5,1.6 rkward.pot,1.7,1.8
- Next message: [rkward-cvs] rkward/rkward/rbackend rembedinternal.cpp,1.21,1.22 rinterface.cpp,1.29,1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/rkward/rkward/rkward/scriptbackends
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31991/rkward/scriptbackends
Modified Files:
phpbackend.cpp
Log Message:
Code cleanups, focus: wrap debug-output in RK_DO, add RK_TRACEs
Index: phpbackend.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/scriptbackends/phpbackend.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** phpbackend.cpp 22 Apr 2005 13:56:16 -0000 1.4
--- phpbackend.cpp 29 Sep 2005 13:24:48 -0000 1.5
***************
*** 26,31 ****
--- 26,34 ----
#include "../settings/rksettingsmodulephp.h"
#include "../settings/rksettingsmodulelogfiles.h"
+ #include "../debug.h"
PHPBackend::PHPBackend() {
+ RK_TRACE (PHP);
+
php_process = 0;
eot_string="#RKEND#\n";
***************
*** 36,45 ****
PHPBackend::~PHPBackend() {
destroy ();
}
bool PHPBackend::initialize (const QString &filename) {
if (php_process && php_process->isRunning ()) {
! qDebug ("another template is already openend in this backend");
return false;
}
--- 39,51 ----
PHPBackend::~PHPBackend() {
+ RK_TRACE (PHP);
destroy ();
}
bool PHPBackend::initialize (const QString &filename) {
+ RK_TRACE (PHP);
+
if (php_process && php_process->isRunning ()) {
! RK_DO (qDebug ("another template is already openend in this backend"), PHP, DL_ERROR);
return false;
}
***************
*** 70,73 ****
--- 76,81 ----
void PHPBackend::destroy () {
+ RK_TRACE (PHP);
+
if (php_process) php_process->kill ();
delete php_process;
***************
*** 88,92 ****
void PHPBackend::callFunction (const QString &function, int flags) {
! qDebug ("callFunction %s", function.latin1 ());
KTempFile *file = new KTempFile ();
*(file->textStream ()) << "<? " << function << " ?>\n";
--- 96,102 ----
void PHPBackend::callFunction (const QString &function, int flags) {
! RK_TRACE (PHP);
! RK_DO (qDebug ("callFunction %s", function.latin1 ()), PHP, DL_DEBUG);
!
KTempFile *file = new KTempFile ();
*(file->textStream ()) << "<? " << function << " ?>\n";
***************
*** 101,104 ****
--- 111,116 ----
void PHPBackend::tryNextFunction () {
+ RK_TRACE (PHP);
+
if ((!busy_writing) && php_process && php_process->isRunning () && (!busy) && command_stack.count ()) {
/// clean up previous command if applicable
***************
*** 112,116 ****
}
! qDebug ("submitting PHP code: " + command_stack.first ()->file->name ());
current_command = command_stack.first ()->file->name () + eot_string;
php_process->writeStdin (current_command.latin1 (), current_command.length ());
--- 124,128 ----
}
! RK_DO (qDebug ("submitting PHP code: %s", command_stack.first ()->file->name ().latin1 ()), PHP, DL_DEBUG);
current_command = command_stack.first ()->file->name () + eot_string;
php_process->writeStdin (current_command.latin1 (), current_command.length ());
***************
*** 122,125 ****
--- 134,138 ----
void PHPBackend::writeData (const QString &data) {
+ RK_TRACE (PHP);
data_stack.append (data + eot_string);
tryWriteData ();
***************
*** 127,132 ****
void PHPBackend::tryWriteData () {
if ((!busy_writing) && php_process && php_process->isRunning () && busy && (data_stack.count ())) {
! qDebug ("submitting data: " + data_stack.first ());
php_process->writeStdin (data_stack.first ().latin1 (), data_stack.first ().length ());
busy_writing = true;
--- 140,147 ----
void PHPBackend::tryWriteData () {
+ RK_TRACE (PHP);
+
if ((!busy_writing) && php_process && php_process->isRunning () && busy && (data_stack.count ())) {
! RK_DO (qDebug ("submitting data: %s", data_stack.first ().latin1 ()), PHP, DL_DEBUG);
php_process->writeStdin (data_stack.first ().latin1 (), data_stack.first ().length ());
busy_writing = true;
***************
*** 136,139 ****
--- 151,156 ----
void PHPBackend::doneWriting (KProcess *proc) {
+ RK_TRACE (PHP);
+
busy_writing = false;
if (!doing_command) data_stack.pop_front ();
***************
*** 142,145 ****
--- 159,164 ----
void PHPBackend::gotOutput (KProcess *proc, char* buf, int len) {
+ RK_TRACE (PHP);
+
QString output = buf;
QString request;
***************
*** 162,166 ****
data = output;
}
! qDebug ("request: %s\ndata: %s", request.latin1 (), data.latin1 ());
// pending data is always first in a stream, so process it first, too
--- 181,185 ----
data = output;
}
! RK_DO (qDebug ("request: %s\ndata: %s", request.latin1 (), data.latin1 ()), PHP, DL_DEBUG);
// pending data is always first in a stream, so process it first, too
***************
*** 189,193 ****
} else if (request.startsWith ("requesting data:")) {
QString requested_object = request.remove ("requesting data:");
! qDebug ("requested data: \"%s\"", requested_object.latin1 ());
emit (requestValue (requested_object));
busy = true;
--- 208,212 ----
} else if (request.startsWith ("requesting data:")) {
QString requested_object = request.remove ("requesting data:");
! RK_DO (qDebug ("requested data: \"%s\"", requested_object.latin1 ()), PHP, DL_DEBUG);
emit (requestValue (requested_object));
busy = true;
***************
*** 195,199 ****
} else if (request.startsWith ("requesting rcall:")) {
QString requested_call = request.remove ("requesting rcall:");
! qDebug ("requested rcall: \"%s\"", requested_call.latin1 ());
emit (requestRCall (requested_call));
busy = true;
--- 214,218 ----
} else if (request.startsWith ("requesting rcall:")) {
QString requested_call = request.remove ("requesting rcall:");
! RK_DO (qDebug ("requested rcall: \"%s\"", requested_call.latin1 ()), PHP, DL_DEBUG);
emit (requestRCall (requested_call));
busy = true;
***************
*** 201,205 ****
} else if (request.startsWith ("requesting rvector:")) {
QString requested_call = request.remove ("requesting rvector:");
! qDebug ("requested rvector: \"%s\"", requested_call.latin1 ());
emit (requestRVector (requested_call));
busy = true;
--- 220,224 ----
} else if (request.startsWith ("requesting rvector:")) {
QString requested_call = request.remove ("requesting rvector:");
! RK_DO (qDebug ("requested rvector: \"%s\"", requested_call.latin1 ()), PHP, DL_DEBUG);
emit (requestRVector (requested_call));
busy = true;
***************
*** 215,216 ****
--- 234,237 ----
}
}
+
+ #include "phpbackend.moc"
- Previous message: [rkward-cvs] rkward/po es.po,1.6,1.7 fr.po,1.9,1.10 it.po,1.13,1.14 pl.po,1.5,1.6 rkward.pot,1.7,1.8
- Next message: [rkward-cvs] rkward/rkward/rbackend rembedinternal.cpp,1.21,1.22 rinterface.cpp,1.29,1.30
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the rkward-tracker
mailing list