Thread usage
A quick summary of how to use xsldbg as a thread..
Please not this is alpha quality code so you should ensure that you don't override any existing xsldbg installation
Requirements
libraries "-lpthread" and "-lqt" are available
download xsldbg's cvs release taged xsldbg-rel-0-9-7 or later (http://sourceforge.net/cvs/?group_id=35673)
configure xsldbg with at least
--enable-shared=no --enable-xsldbgthread=yes --enable-debug=yes --prefix=<SOME/SAFE/PLACE>
install as normal
download xsldbgkpart
(http://sourceforge.net/cvs/?group_id=35673)
configure as normal but may need to specify where you install xsldbg
--with-xsldbg-prefix=<SOME/SAFE/PLACE> --enable-debug=yes
install as normal as the configure script should find the xsldbg installation :-)
Header files to be used
src/libxsldbg/xsldbgthread.h
src/libxsldbg/xsldbgmsg.h
src/libxsldbg/cmds.h
src/libqtnotifier/qtnotifier.h
Pseudo code for typical usage
-----------------------------
function myApplicationInit(){
application specific intialization ...
if (xslgbgThreadInit() = 0 )
report error and quit
}
function myApplicationQuit(){
application specific clean up...
xsldbgThreadFree();
}
function myApplicationXsldbgCmd(){
::fakeInput()
}
Typical event stream
-------------------------------------------
application's xsldbg's thread activities
outgoing messages
notifyXsldbgApp(XSLDBG_MSG_LINE_CHANGED, NULL); // notifiy that we got to a new line
setInputStatus(XSLDBG_MSG_AWAITING_INPUT);
notifyXsldbgApp(XSLDBG_MSG_AWAITING_INPUT, NULL); // tell the application that we are waiting
some time later (asked execute command). . . . . . . .
fakeInput(<COMMAND TEXT>)
setInputStatus(XSLDBG_MSG_READ_INPUT);
inputReadBuff = getFakeInput();
if(inputReadBuff){
notifyXsldbgApp(XSLDBG_MSG_READ_INPUT, inputReadBuff);
a little while later ...
notifyXsldbgApp(XSLDBG_MSG_PROCESSING_INPUT, NULL);
a little while later ...
if something when wrong executing <COMMAND TEXT>
notifyStateXsldbgApp(XSLDBG_MSG_PROCESSING_RESULT, commandId , 0 , NULL);
get more commands and processes them ...
Application event application processing
----------------------------
The application will need to connect to the xsldbg's thread by using
QTNotifier::connectNotifier(<MY_QT_OBJECT>)
xsldbg will send it's messages to <MY_QT_OBJECT>