summaryrefslogtreecommitdiffstats
path: root/kxsldbg/kxsldbgpart/libqtnotfier
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2018-09-28 21:49:27 +0900
committerMichele Calgaro <[email protected]>2018-09-28 21:49:27 +0900
commit484b77efdfb0d374f3a16fd3cbabd398175ef11e (patch)
tree901d4f47a03df346786e8c0f5e879f9db1e0556f /kxsldbg/kxsldbgpart/libqtnotfier
parent115054739a609644494fff6f57056f6a4e8d1d39 (diff)
downloadtdewebdev-484b77efdfb0d374f3a16fd3cbabd398175ef11e.tar.gz
tdewebdev-484b77efdfb0d374f3a16fd3cbabd398175ef11e.zip
Fixed FTBFS caused by qt->tqt renaming.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'kxsldbg/kxsldbgpart/libqtnotfier')
-rw-r--r--kxsldbg/kxsldbgpart/libqtnotfier/Makefile.am9
-rw-r--r--kxsldbg/kxsldbgpart/libqtnotfier/qtnotifier2.cpp62
-rw-r--r--kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.cpp93
-rw-r--r--kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.h148
-rw-r--r--kxsldbg/kxsldbgpart/libqtnotfier/xsldbgevent.cpp857
-rw-r--r--kxsldbg/kxsldbgpart/libqtnotfier/xsldbgnotifier.cpp33
-rw-r--r--kxsldbg/kxsldbgpart/libqtnotfier/xsldbgthread.cpp360
7 files changed, 0 insertions, 1562 deletions
diff --git a/kxsldbg/kxsldbgpart/libqtnotfier/Makefile.am b/kxsldbg/kxsldbgpart/libqtnotfier/Makefile.am
deleted file mode 100644
index caebc3f4..00000000
--- a/kxsldbg/kxsldbgpart/libqtnotfier/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-noinst_LTLIBRARIES = libtqtnotfier.la
-
-libtqtnotfier_la_LIBADD = $(LIBXSLT_LIBS)
-libtqtnotfier_la_METASOURCES = AUTO
-
-libtqtnotfier_la_SOURCES = xsldbgthread.cpp xsldbgnotifier.cpp xsldbgevent.cpp xsldbgdebuggerbase.cpp qtnotifier2.cpp
-
-INCLUDES = $(XSLDBG_CFLAGS) $(all_includes)
-CXXFLAGS += $(ICU_CXXFLAGS)
diff --git a/kxsldbg/kxsldbgpart/libqtnotfier/qtnotifier2.cpp b/kxsldbg/kxsldbgpart/libqtnotfier/qtnotifier2.cpp
deleted file mode 100644
index 0db9d1f0..00000000
--- a/kxsldbg/kxsldbgpart/libqtnotfier/qtnotifier2.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/***************************************************************************
- qtnotifier2.cpp - description
- -------------------
- begin : Sun Dec 23 2001
- copyright : (C) 2001 by keith
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include <tqapplication.h>
-
-#include "../libxsldbg/xsldbgevent.h"
-#include "../libxsldbg/qtnotifier2.h"
-#include "xsldbgdebuggerbase.h"
-#include "../libxsldbg/xsldbgthread.h"
-
-XsldbgDebuggerBase *_debugger = 0L;
-
-int qtNotifyXsldbgApp(XsldbgMessageEnum type, const void *data)
-{
- int result = 0;
- if (::getThreadStatus() == XSLDBG_MSG_THREAD_NOTUSED){
- return 1;
- }
-
- /* clear the input ready flag as quickly as possible*/
- if ( ::getInputStatus() == XSLDBG_MSG_READ_INPUT)
- ::setInputReady(0);
-
- /* state of the thread */
- if (_debugger != 0L){
- XsldbgEvent *e = new XsldbgEvent(type, data);
- if (e != 0L) {
- /* The application will now have this event in its event queue
- that all that is needed from here*/
- TQApplication::postEvent(_debugger, e);
- }
- }
-
- if (::getThreadStatus() == XSLDBG_MSG_THREAD_STOP)
- ::xsldbgThreadCleanup(); /* thread has died so cleanup after it */
-
- result++; /* at the moment this function will always work */
-
- return result;
-}
-
-
-
-void connectNotifier(XsldbgDebuggerBase *debugger){
- _debugger = debugger;
-}
-
-
diff --git a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.cpp b/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.cpp
deleted file mode 100644
index 518aca00..00000000
--- a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/***************************************************************************
- xsldbgdebuggerbase.cpp - The base class from
- which a debugger
- could be built
-
- -------------------
- begin : Fri Feb 1 2001
- copyright : (C) 2001 by Keith Isdale
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include <tqapplication.h>
-#include <tqglobal.h>
-#include <tqstringlist.h>
-#include <kurl.h>
-
-#include "xsldbgdebuggerbase.h"
-
-XsldbgDebuggerBase::XsldbgDebuggerBase()
- : TQObject(0L, "XsldbgDebuggerBase")
-{
- initialized = false;
- updateTimerID = -1;
-}
-
-
-XsldbgDebuggerBase::~XsldbgDebuggerBase()
-{
- /* empty*/
-}
-
-
-
-TQString XsldbgDebuggerBase::fromUTF8(const char *text)
-{
- TQString result;
- if (text != 0L)
- result = (const char*)text;
- return result;
-}
-
-
-TQString XsldbgDebuggerBase::fromUTF8(const xmlChar *text)
-{
- TQString result;
- if (text != 0L)
- result = TQString::fromUtf8((const char*)text);
- return result;
-}
-
-
-TQString XsldbgDebuggerBase::fromUTF8FileName(const char *text)
-{
- TQString result;
- if (text != 0L){
- KURL url(((const char*)text));
- if (url.isLocalFile())
- result = TQString("file:") + url.path();
- else
- result = url.prettyURL();
- }
- return result;
-}
-
-
-TQString XsldbgDebuggerBase::fromUTF8FileName(const xmlChar *text)
-{
- TQString result;
- if (text != 0L){
- KURL url(TQString::fromUtf8((const char*)text));
- if (url.isLocalFile())
- result = TQString("file:") + url.path();
- else
- result = url.prettyURL();
- }
- return result;
-}
-
-
-void XsldbgDebuggerBase::queueMessage(const TQString &text)
-{
- updateText += text;
-}
-#include "xsldbgdebuggerbase.moc"
diff --git a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.h b/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.h
deleted file mode 100644
index 78dcbf3c..00000000
--- a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgdebuggerbase.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/***************************************************************************
- xsldbgdebuggerbase.h - The base class from
- which a debugger
- could be built
-
- -------------------
- begin : Fri Feb 1 2001
- copyright : (C) 2001 by Keith Isdale
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-
-#ifndef XSLDBGDEBUGGERBASE_H
-#define XSLDBGDEBUGGERBASE_H
-
-#if defined WIN32
-# include <libxsldbg/xsldbgwin32config.h>
-#else
-# ifndef XSLDBG_SO_API
-# define XSLDBG_SO_API
-# endif
-#endif
-
-#include <tqobject.h>
-#include <tqstringlist.h>
-#include <libxml/tree.h>
-
-class XsldbgEvent;
-class TQApplication;
-class TQStringList;
-
-/**
- We delegate the task of emitting our signals to XsldbgEvent , so
- Xsldbg must become our friend
-*/
-class XsldbgDebuggerBase : public TQObject
-{
- Q_OBJECT
-
-
- friend class XsldbgEvent;
-
- public:
- XsldbgDebuggerBase(void);
- ~XsldbgDebuggerBase(void);
-
- void setInitialized(bool state) {initialized = state; };
- bool getInitialized(void) {return initialized ;};
-
- void setUpdateTimerID(int ID) { updateTimerID = ID;};
- int getUpdateTimerID(void) {return updateTimerID ;};
-
-
- /** Convert from libxslt UTF8 to a TQString */
- static TQString fromUTF8(const char *text);
- static TQString fromUTF8FileName(const char *text);
-
- /** Convert from libxslt UTF8 to a TQString */
- static TQString fromUTF8(const xmlChar *text);
- static TQString fromUTF8FileName(const xmlChar *text);
-
- /* list of command yet to be processed */
- TQStringList commandQueue(void) {return _commandQueue ;};
-
- void queueMessage(const TQString &text);
-
-protected:
- TQString updateText;
-
- private:
- bool initialized;
- int updateTimerID;
- TQStringList _commandQueue;
-
- signals: // Signals
- /** line number and/or file name changed */
- void lineNoChanged(TQString /* fileName */, int /* lineNumber */, bool /* breakpoint */);
-
- /** Show a message in debugger window */
- void showMessage(TQString /* msg*/);
-
- /** Add breakpoint to view, First parameter is TQString()
- to indicate start of breakpoint list notfication */
- void breakpointItem(TQString /* fileName*/, int /* lineNumber */,
- TQString /*templateName*/, TQString /* modeName */,
- bool /* enabled */, int /* id */);
-
- /** Add global variable to view, First parameter is TQString()
- to indicate start of global variable list notfication */
- void globalVariableItem(TQString /* name */, TQString /* fileName */, int /* lineNumber */);
-
- /** Add local variable to view, First parameter is TQString()
- to indicate start of local variable list notfication */
- void localVariableItem(TQString /*name */, TQString /* templateContext*/,
- TQString /* fileName */, int /*lineNumber */);
-
- /** Add a variable to view, First parameter is TQString()
- to indicate start of local variable list notfication */
- void variableItem(TQString /*name */, TQString /* templateContext*/,
- TQString /* fileName */, int /*lineNumber */,
- TQString /* select XPath */, int /* is it a local variable */);
-
- /** Add template to view, First parameter is TQString()
- to indicate start of template list notfication */
- void templateItem(TQString /* name*/, TQString /*mode*/, TQString /* fileName */, int /* lineNumber */);
-
- /** Add source to view, First parameter is TQString()
- to indicate start of source list notfication */
- void sourceItem(TQString /* fileName */, TQString /* parentFileName */, int /*lineNumber */);
-
- /** Add parameter to view, First parameter is TQString()
- to indicate start of parameter list notfication */
- void parameterItem(TQString /* name*/, TQString /* value */);
-
- /** Add callStack to view, First parameter is TQString()
- to indicate start of callstack list notfication */
- void callStackItem(TQString /* tempalteName*/, TQString /* fileName */, int /* lineNumber */);
-
- /** Add entity to view, First parameter is TQString()
- to indicate start of entity list notfication */
- void entityItem(TQString /*SystemID*/, TQString /*PublicID*/);
-
- /* Show the URI for SystemID or PublicID requested */
- void resolveItem(TQString /*URI*/);
-
- /* Display a integer option value First parameter is TQString()
- to indicate start of option list notification */
- void intOptionItem(TQString /* name*/, int /* value */);
-
- /* Display a string option value. First parameter is TQString()
- to indicate start of option list notification */
- void stringOptionItem(TQString /* name*/, TQString /* value */);
-
- /* Cause the names for source, data and output files to be reload from xsldbg */
- void fileDetailsChanged();
-
-};
-
-#endif
diff --git a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgevent.cpp b/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgevent.cpp
deleted file mode 100644
index 0f377dbb..00000000
--- a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgevent.cpp
+++ /dev/null
@@ -1,857 +0,0 @@
-
-/***************************************************************************
- xsldbgevent.c - event to notify app of
- data from xsldbg
- -------------------
- begin : Fri Feb 1 2001
- copyright : (C) 2001 by Keith Isdale
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include <tqapplication.h>
-#include <tqtimer.h>
-#include <tqfile.h>
-#include <kurl.h>
-#include <tqtextstream.h>
-
-#include <libxslt/xsltInternals.h>
-
-#include "../libxsldbg/xsldbgevent.h"
-#include "xsldbgdebuggerbase.h"
-#include "../libxsldbg/arraylist.h"
-#include "../libxsldbg/breakpoint.h"
-#include "../libxsldbg/xsldbgmsg.h"
-#include "../libxsldbg/xsldbgthread.h"
-#include "../libxsldbg/options.h"
-#include "../libxsldbg/files.h"
-
-TQString updateText;
-
-XsldbgEventData::XsldbgEventData()
-{
- int column;
-
- for (column = 0; column < XSLDBGEVENT_COLUMNS; column++){
- textValues[column] = TQString();
- }
-
- for (column = 0; column < XSLDBGEVENT_COLUMNS; column++){
- intValues[column] = -1;
- }
-
-}
-
-XsldbgEventData::~XsldbgEventData()
-{
-}
-
-void XsldbgEventData::setText(int column, TQString text)
-{
- if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
- textValues[column] = text;
-}
-
-
-TQString XsldbgEventData::getText(int column)
-{
- if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
- return textValues[column];
- else
- return TQString();
-}
-
-
-void XsldbgEventData::setInt(int column, int value)
-{
- if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
- intValues[column] = value;
-}
-
-
-int XsldbgEventData::getInt(int column)
-{
- if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
- return intValues[column];
- else
- return -1;
-}
-
-
-XsldbgEvent::XsldbgEvent(XsldbgMessageEnum type, const void *data)
- : TQEvent(TQEvent::User)
-{
- XsldbgEventData *eventData;
- this->data = data;
- debugger = 0L;
- beenCreated = false;
-
- if (type == XSLDBG_MSG_LIST){ /* 23 : As list of messages */
- notifyMessageListPtr msgList = (notifyMessageListPtr)data;
- void *msgData;
- /* If this is an included source message, which just continues a source message,
- we don't need to add an empty XsldbgEventData */
- if (msgList->type != XSLDBG_MSG_INCLUDED_SOURCE_CHANGED){
- /* add an empty event data item which indicates the start of a list */
- eventData = new XsldbgEventData();
- if (eventData != 0L)
- list.append(eventData);
- }
- for (int index = 0; index < arrayListCount(msgList->list); index++){
- msgData = ::arrayListGet(msgList->list, index);
- eventData = createEventData(msgList->type, msgData);
- if (eventData != 0L)
- list.append(eventData);
- }
- ::arrayListFree(msgList->list);
- msgList->list = 0L;
- itemType = msgList->type;
- }else{
- eventData = createEventData(type, data);
- if (eventData != 0L)
- list.append(eventData);
- itemType = type;
- }
-
- beenCreated = true;
- /* remove any knowledge of orginal data */
- this->data = 0L;
-}
-
-
-XsldbgEvent::~XsldbgEvent()
-{
-}
-
-
-XsldbgEventData *XsldbgEvent::createEventData(XsldbgMessageEnum type, const void *msgData)
-{
- XsldbgEventData *result = new XsldbgEventData();
-
- if (result == 0L)
- return result;
-
- switch (type){
-
- case XSLDBG_MSG_THREAD_NOTUSED: /* 0: Thread are not to be used */
- case XSLDBG_MSG_THREAD_INIT: /* 1: The xsldbg thread is initializing */
- case XSLDBG_MSG_THREAD_RUN: /* 2: The xsldbg thread is running */
- case XSLDBG_MSG_THREAD_STOP: /* 3: The xsldbg thread is about to die */
- case XSLDBG_MSG_THREAD_DEAD: /* 4: The xsldbg thread died */
- /* we don't need to do anything extra with this message */
- break;
-
- /* input status ( once thread is running) */
- case XSLDBG_MSG_AWAITING_INPUT: /* 5: Waiting for user input */
- /* we don't need to do anything extra with this message */
- break;
-
- case XSLDBG_MSG_READ_INPUT: /* 6: Read user input */
- /* we don't need to do anything extra with this message */
- break;
-
- case XSLDBG_MSG_PROCESSING_INPUT: /* 7: Processing user's request */
- /* we don't need to do anything extra with this message */
- break;
-
- /* provide more informatiom about state of xsldbg (optional) */
- case XSLDBG_MSG_PROCESSING_RESULT: /* 8: An error occured performing command
- * requested command */
- if (msgData != 0L){
- xsldbgErrorMsgPtr msg = (xsldbgErrorMsgPtr)msgData;
- if (msg->text)
- result->setText(0, XsldbgDebuggerBase::fromUTF8(msg->text));
- }
- break;
-
- case XSLDBG_MSG_LINE_CHANGED: /* 9: Changed to new line number
- * ie a step */
- handleLineNoChanged(result, msgData);
- break;
-
- case XSLDBG_MSG_FILE_CHANGED: /* 10: Changed selection for source/data/output file */
- // not used
- break;
-
- case XSLDBG_MSG_BREAKPOINT_CHANGED: /* 11: Response to a showbreak command */
- handleBreakpointItem(result, msgData);
- break;
-
- case XSLDBG_MSG_PARAMETER_CHANGED: /* 12: Response to showparam command */
- handleParameterItem(result, msgData);
- break;
-
- case XSLDBG_MSG_TEXTOUT: /* 13 : Free form text from xsldg */
- /* this is going to be most common and its so simple we can handle
- it here */
- result->setText(0, XsldbgDebuggerBase::fromUTF8((xmlChar*)msgData));
- break;
-
- case XSLDBG_MSG_FILEOUT: /* 14 : Response to cat commmand, ie
- * Free form text in file */
- /* this is actualy the file to load */
- {
- KURL url(XsldbgDebuggerBase::fromUTF8FileName((xmlChar*)msgData));
- if (!url.isLocalFile()){
- tqDebug("Remote path to temp file %s unsupported, unable to read message from xsldbg", url.prettyURL().local8Bit().data());
- break;
- }
-
- TQString fileName = url.path();
- TQString outputText;
- if (!fileName.isNull()){
- TQFile file (fileName);
- if (file.open(IO_ReadOnly)){
- TQTextStream textFile(&file);
- TQString textIn = "";
- textFile.setEncoding(TQTextStream::UnicodeUTF8);
- while (1){
- textIn = textFile.readLine();
- if (textIn.isNull())
- break;
- outputText.append(textIn).append("\n");
- }
- file.close();
- }
- outputText.append("\n");
- result->setText(0, outputText);
- }
- }
- break;
-
- case XSLDBG_MSG_LOCALVAR_CHANGED: /* 15 : Response to locals command ie a
- * local variable */
- handleLocalVariableItem(result, msgData);
- break;
-
- case XSLDBG_MSG_GLOBALVAR_CHANGED: /* 16 : Response to globals command
- * ie a global variable */
- handleGlobalVariableItem(result, msgData);
- break;
-
- case XSLDBG_MSG_TEMPLATE_CHANGED: /* 17 : Response to templates commmand
- * ie template details */
- handleTemplateItem(result, msgData);
- break;
-
- case XSLDBG_MSG_SOURCE_CHANGED: /* 18 : Response to stylesheets command,
- * a normal stylesheet */
- handleSourceItem(result, msgData);
- break;
-
- case XSLDBG_MSG_INCLUDED_SOURCE_CHANGED: /* 19: Response to stylesheets
- * command, a xmlNodeptr of
- * a included stylesheet */
- handleIncludedSourceItem(result, msgData);
- break;
-
- case XSLDBG_MSG_CALLSTACK_CHANGED: /* 20: Response to where command,
- * ie a item on the call stack */
- handleCallStackItem(result, msgData);
- break;
-
- case XSLDBG_MSG_ENTITIY_CHANGED: /* 21: Response to entities
- * command */
- handleEntityItem(result, msgData);
- break;
-
- case XSLDBG_MSG_RESOLVE_CHANGE: /* 22: Response to system or
- * public command */
- handleResolveItem(result, msgData);
- break;
-
- default:
- tqDebug("Unhandled type in createEventData %d", type);
-
- }
- return result;
-}
-
-void XsldbgEvent::emitMessage(XsldbgDebuggerBase *debugger)
-{
- XsldbgEventData *eventData;
-
- this->debugger = debugger;
-
- for (eventData = list.first(); eventData != 0L; eventData = list.next()){
- emitMessage(eventData);
- }
-
- /* make sure that we only temporarily set the value for debugger*/
- this->debugger = 0L;
-}
-
-
-void XsldbgEvent::emitMessage(XsldbgEventData *eventData)
-{
-
- if ((eventData == 0L) || (debugger == 0L)){
- tqDebug("emitMessage failed");
- if (eventData == 0L)
- tqDebug("Event data == NULL");
- if (debugger == 0L)
- tqDebug("Debugger == NULL");
- return;
- }
-
- /*
- Method use will end up like
-
- emit debugger->lineNoChanged("", 1, false);
-
- */
-
- switch (itemType){
-
- case XSLDBG_MSG_THREAD_NOTUSED: /* 0: Thread are not to be used */
- case XSLDBG_MSG_THREAD_INIT: /* 1: The xsldbg thread is initializing */
- case XSLDBG_MSG_THREAD_RUN: /* 2: The xsldbg thread is running */
- /* we don't need to do anything extra with this message */
- break;
-
- case XSLDBG_MSG_THREAD_STOP: /* 3: The xsldbg thread is about to die */
- case XSLDBG_MSG_THREAD_DEAD: /* 4: The xsldbg thread died */
- /* the debugger has stopped is about to stop */
- debugger->setInitialized(false);
- break;
-
- /* input status ( once thread is running) */
- case XSLDBG_MSG_AWAITING_INPUT: /* 5: Waiting for user input */
- if ((getInputReady() == 0) && (debugger->commandQueue().count() > 0)){
- tqDebug("Command queue not empty");
- TQTimerEvent *e = new TQTimerEvent(debugger->getUpdateTimerID());
- TQApplication::postEvent(debugger, e);
- }
- if (!updateText.isEmpty()){
- debugger->queueMessage(updateText);
- updateText = "";
- }
- break;
-
- case XSLDBG_MSG_READ_INPUT: /* 6: Read user input */
- /* we don't need to do anything extra with this message */
- break;
-
- case XSLDBG_MSG_PROCESSING_INPUT: /* 7: Processing user's request */
- /* we don't need to do anything extra with this message */
- break;
-
- /* provide more informatiom about state of xsldbg (optional) */
- case XSLDBG_MSG_PROCESSING_RESULT: /* 8: An error occured performing command
- * requested command */
- if (!eventData->getText(0).isNull())
- updateText.append(eventData->getText(0));
- break;
-
- case XSLDBG_MSG_LINE_CHANGED: /* 9: Changed to new line number
- * ie a step */
- handleLineNoChanged(eventData, 0L);
- break;
-
- case XSLDBG_MSG_FILE_CHANGED: /* 10: Loaded source/data file */
- if (beenCreated == false){
- /* Empty data */
- }else{
- emit debugger->fileDetailsChanged();
- }
- break;
-
- case XSLDBG_MSG_BREAKPOINT_CHANGED: /* 11: Response to a showbreak command */
- handleBreakpointItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_PARAMETER_CHANGED: /* 12: Response to showparam command */
- handleParameterItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_TEXTOUT: /* 13 : Free form text from xsldg */
- /* this is going to be most common and its so simple we can handle
- it here */
- /*
- emit debugger->showMessage(eventData->getText(0));
- */
- if (!eventData->getText(0).isNull())
- updateText.append(eventData->getText(0));
- break;
-
- case XSLDBG_MSG_FILEOUT: /* 14 : Response to cat commmand */
- if (!eventData->getText(0).isNull())
- updateText.append(eventData->getText(0));
- break;
-
- case XSLDBG_MSG_LOCALVAR_CHANGED: /* 15 : Response to locals command ie a
- * local variable */
- handleLocalVariableItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_GLOBALVAR_CHANGED: /* 16 : Response to globals command
- * ie a global variable */
- handleGlobalVariableItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_TEMPLATE_CHANGED: /* 17 : Response to templates commmand
- * ie template details */
- handleTemplateItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_SOURCE_CHANGED: /* 18 : Response to stylesheets command,
- * a normal stylesheet */
- handleSourceItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_INCLUDED_SOURCE_CHANGED: /* 19: Response to stylesheets
- * command, a xmlNodeptr of
- * a included stylesheet */
- handleIncludedSourceItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_CALLSTACK_CHANGED: /* 20: Response to where command,
- * ie a item on the call stack */
- handleCallStackItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_ENTITIY_CHANGED: /* 21: Response to entities
- * command */
- handleEntityItem(eventData, 0L);
- break;
-
- case XSLDBG_MSG_RESOLVE_CHANGE: /* 22: Response to system or
- * public command */
- handleResolveItem(eventData, 0L);
- break;
-
- default:
- tqDebug("Unhandled type in emitMessage %d", itemType);
- }
-}
-
-
-void XsldbgEvent::handleLineNoChanged(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (xsldbgUrl() != 0L){
- eventData->setText(0, XsldbgDebuggerBase::fromUTF8FileName(xsldbgUrl()));
- eventData->setInt(0, xsldbgLineNo());
- eventData->setInt(1, msgData != 0L);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->lineNoChanged(eventData->getText(0), eventData->getInt(0),
- eventData->getInt(1));
- }
- }
-}
-
-
-void XsldbgEvent::handleShowMessage(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- eventData->setText(0, XsldbgDebuggerBase::fromUTF8((xmlChar*)msgData));
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->showMessage(eventData->getText(0));
- }
- }
-}
-
-
-void XsldbgEvent::handleBreakpointItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- breakPointPtr breakItem = (breakPointPtr)msgData;
- /* set the file name*/
- eventData->setText(0, XsldbgDebuggerBase::fromUTF8FileName(breakItem->url));
- /* line number*/
- eventData->setInt(0, (int)breakItem->lineNo);
-
- /* templateName */
- eventData->setText(1, XsldbgDebuggerBase::fromUTF8(breakItem->templateName));
-
- /* modeName */
- eventData->setText(2, XsldbgDebuggerBase::fromUTF8(breakItem->modeName));
- /* enabled state */
- eventData->setInt(1, (int)(breakItem->flags & BREAKPOINT_ENABLED));
-
- /* id value */
- eventData->setInt(2, (int)breakItem->id);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->breakpointItem(eventData->getText(0), /* file name*/
- eventData->getInt(0), /* line number*/
- eventData->getText(1), /* template name */
- eventData->getText(2), /* mode name */
- eventData->getInt(1), /* enabled state*/
- eventData->getInt(2) /* id*/);
- }
- }
-}
-
-
-void XsldbgEvent::handleGlobalVariableItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- xsltStackElemPtr item = (xsltStackElemPtr)msgData;
- TQString name, fileName, selectXPath;
- int lineNumber = -1;
-
- /* variable name*/
- if (item->nameURI)
- name = (XsldbgDebuggerBase::fromUTF8FileName(item->nameURI)).append(":");
- name.append(XsldbgDebuggerBase::fromUTF8(item->name));
-
-
-
- if (item->computed && item->comp && item->comp->inst && item->comp->inst->doc){
- fileName = XsldbgDebuggerBase::fromUTF8FileName(item->comp->inst->doc->URL);
- lineNumber= xmlGetLineNo(item->comp->inst);
- }
-
- if (item->select)
- selectXPath = XsldbgDebuggerBase::fromUTF8(item->select);
-
- eventData->setText(0, name);
- eventData->setText(1, "");
- eventData->setText(2, fileName);
- eventData->setText(3, selectXPath);
- eventData->setInt(0, lineNumber);
- eventData->setInt(1, 0);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->variableItem(eventData->getText(0), /* variable name*/
- eventData->getText(1), /* templatecontext*/
- eventData->getText(2), /* file name */
- eventData->getInt(0), /* line number */
- eventData->getText(3), /* select XPath */
- eventData->getInt(1) /* Is this a local variable */ );
- }
- }
-}
-
-
-void XsldbgEvent::handleLocalVariableItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- xsltStackElemPtr item = (xsltStackElemPtr)msgData;
- TQString name, templateContext, fileName, selectXPath;
- int lineNumber = -1;
- xmlNodePtr varXmlNode;
-
- /* variable name */
- if (item->nameURI)
- name = (XsldbgDebuggerBase::fromUTF8FileName(item->nameURI)).append(":");
- name.append(XsldbgDebuggerBase::fromUTF8(item->name));
-
- if (item->computed && item->comp && item->comp->inst){
- varXmlNode = item->comp->inst;
-
- /* try to find out what template this variable belongs to */
- if (varXmlNode->parent && IS_XSLT_NAME(varXmlNode->parent, "template")) {
- xmlChar* value = xmlGetProp(varXmlNode->parent, (xmlChar *) "name");
- if (value) {
- templateContext = XsldbgDebuggerBase::fromUTF8(value);
- xmlFree(value);
- }else{
- value = xmlGetProp(varXmlNode->parent, (xmlChar *) "match");
- if (value) {
- templateContext = XsldbgDebuggerBase::fromUTF8(value);
- xmlFree(value);
- }
- }
- }
-
- if (varXmlNode->doc) {
- fileName = XsldbgDebuggerBase::fromUTF8FileName(varXmlNode->doc->URL);
- lineNumber = xmlGetLineNo(varXmlNode);
- }
-
- if (item->select)
- selectXPath = XsldbgDebuggerBase::fromUTF8(item->select);
-
- eventData->setText(0, name);
- eventData->setText(1, templateContext);
- eventData->setText(2, fileName);
- eventData->setText(3, selectXPath);
- eventData->setInt(0, lineNumber);
- eventData->setInt(1, 1);
- }
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->variableItem(eventData->getText(0), /* variable name*/
- eventData->getText(1), /* templatecontext*/
- eventData->getText(2), /* file name */
- eventData->getInt(0), /* line number */
- eventData->getText(3), /* select XPath */
- eventData->getInt(1) /* Is this a local variable */ );
- }
- }
-}
-
-
-void XsldbgEvent::handleTemplateItem(XsldbgEventData *eventData, const void *msgData)
-{
-if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if(msgData != 0L){
- xsltTemplatePtr item = (xsltTemplatePtr)msgData;
- TQString name, mode, fileName;
- int lineNumber = -1;
-
- if (item->nameURI)
- name.append(XsldbgDebuggerBase::fromUTF8FileName(item->nameURI)).append(":");
-
- if (item->name)
- name.append(XsldbgDebuggerBase::fromUTF8(item->name));
- else if (item->match)
- name.append(XsldbgDebuggerBase::fromUTF8(item->match));
-
- mode = XsldbgDebuggerBase::fromUTF8(item->mode);
-
- if (item->elem && item->elem->doc){
- fileName = XsldbgDebuggerBase::fromUTF8FileName(item->elem->doc->URL);
- lineNumber = xmlGetLineNo(item->elem);
- }
- eventData->setText(0, name);
- eventData->setText(1, mode);
- eventData->setText(2, fileName);
- eventData->setInt(0, lineNumber);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->templateItem(eventData->getText(0), /* tempalte name*/
- eventData->getText(1), /* mode*/
- eventData->getText(2), /* file name*/
- eventData->getInt(0) /* line number*/);
- }
- }
-
-}
-
-
-void XsldbgEvent::handleIncludedSourceItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- xmlNodePtr item = (xmlNodePtr)msgData;
- TQString name, fileName;
- int lineNumber = -1;
-
- if (item->doc)
- name = XsldbgDebuggerBase::fromUTF8FileName(item->doc->URL);
-
- if (item->parent && item->parent->doc){
- fileName = XsldbgDebuggerBase::fromUTF8FileName(item->parent->doc->URL);
- lineNumber = xmlGetLineNo((xmlNodePtr)item->parent->doc);
- }
- eventData->setText(0, name);
- eventData->setText(1, fileName);
- eventData->setInt(0, lineNumber);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->sourceItem(eventData->getText(0), /* file name*/
- eventData->getText(1), /* parent file name*/
- eventData->getInt(0) /* parent line number*/);
- }
- }
-}
-
-void XsldbgEvent::handleSourceItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- xsltStylesheetPtr item = (xsltStylesheetPtr)msgData;
- TQString name, fileName;
- int lineNumber = -1;
-
- if (item->doc)
- name = XsldbgDebuggerBase::fromUTF8FileName(item->doc->URL);
-
- if (item->parent && item->parent->doc){
- fileName = XsldbgDebuggerBase::fromUTF8FileName(item->parent->doc->URL);
- lineNumber = xmlGetLineNo((xmlNodePtr)item->parent->doc);
- }
-
- eventData->setText(0, name);
- eventData->setText(1, fileName);
- eventData->setInt(0, lineNumber);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->sourceItem(eventData->getText(0), /* name*/
- eventData->getText(1), /* parent file name*/
- eventData->getInt(0) /* parent line number*/);
- }
- }
-}
-
-void XsldbgEvent::handleParameterItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- parameterItemPtr paramItem = (parameterItemPtr)msgData;
- TQString name, value;
-
- name = XsldbgDebuggerBase::fromUTF8(paramItem->name);
- value = XsldbgDebuggerBase::fromUTF8(paramItem->value);
-
- eventData->setText(0, name);
- eventData->setText(1, value);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->parameterItem(eventData->getText(0), /* param name*/
- eventData->getText(1) /* param value*/);
- }
- }
-}
-
-
-void XsldbgEvent::handleCallStackItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- callPointPtr item = (callPointPtr)msgData;
- TQString templateName, fileName;
- int lineNumber = -1;
-
- /* template name */
- if (item->info){
- templateName = XsldbgDebuggerBase::fromUTF8(item->info->templateName);
- fileName = XsldbgDebuggerBase::fromUTF8FileName(item->info->url);
- lineNumber = item->lineNo;
- }
-
- eventData->setText(0, templateName);
- eventData->setText(1, fileName);
- eventData->setInt(0, lineNumber);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->callStackItem(eventData->getText(0), /* template name*/
- eventData->getText(1), /* fileName */
- eventData->getInt(0) /* line number*/);
- }
- }
-}
-
-
-void XsldbgEvent::handleEntityItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- TQString SystemID, PublicID;
-
- entityInfoPtr info = (entityInfoPtr)msgData;
- SystemID = XsldbgDebuggerBase::fromUTF8FileName(info->SystemID);
- PublicID = XsldbgDebuggerBase::fromUTF8(info->PublicID);
-
- eventData->setText(0, SystemID);
- eventData->setText(1, PublicID);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->entityItem(eventData->getText(0), /* SystemID*/
- eventData->getText(1) /* PublicID*/);
- }
- }
-}
-
-
-void XsldbgEvent::handleResolveItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- TQString URI = XsldbgDebuggerBase::fromUTF8FileName((const xmlChar*)msgData);
-
- eventData->setText(0, URI);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->resolveItem(eventData->getText(0) /* URI */);
- }
- }
-}
-
-
-void XsldbgEvent::handleIntOptionItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- parameterItemPtr paramItem = (parameterItemPtr)msgData;
- eventData->setText(0, XsldbgDebuggerBase::fromUTF8(paramItem->name));
- eventData->setInt(0, paramItem->intValue);
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->intOptionItem(eventData->getText(0), /* option name*/
- eventData->getInt(0) /* value*/);
- }
- }
-}
-
-
-void XsldbgEvent::handleStringOptionItem(XsldbgEventData *eventData, const void *msgData)
-{
- if (eventData != 0L){
- if (beenCreated == false){
- /* add our specific data to eventData*/
- if (msgData != 0L){
- parameterItemPtr paramItem = (parameterItemPtr)msgData;
- eventData->setText(0, XsldbgDebuggerBase::fromUTF8(paramItem->name));
- eventData->setText(1, XsldbgDebuggerBase::fromUTF8(paramItem->value));
- }
- }else{
- /* emit the event data via debugger*/
- emit debugger->stringOptionItem(eventData->getText(0), /* option name*/
- eventData->getText(1) /* value*/);
- }
- }
-}
-
-
-
-void XsldbgEventDataList::deleteItem( TQPtrCollection::Item d )
-{
- if ( del_item ) delete (XsldbgEventData *)d;
-}
diff --git a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgnotifier.cpp b/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgnotifier.cpp
deleted file mode 100644
index d76c6678..00000000
--- a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgnotifier.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************
- xsldbgnotifier.cpp - description
- -------------------
- begin : Thu Dec 20 2001
- copyright : (C) 2001 by keith
- email : keith@linux
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "../libxsldbg/xsldbgnotifier.h"
-
-XsldbgNotifier::XsldbgNotifier(void)
-{
-}
-
-
-XsldbgNotifier::~XsldbgNotifier(void)
-{
-}
-
-
-void XsldbgNotifier::doNotify(XsldbgMessageEnum /*type*/, const void * /*data*/)
-{
-}
-
diff --git a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgthread.cpp b/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgthread.cpp
deleted file mode 100644
index 29ff227e..00000000
--- a/kxsldbg/kxsldbgpart/libqtnotfier/xsldbgthread.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-/***************************************************************************
- xsldbgthread.cpp - description
- -------------------
- begin : Thu Dec 20 2001
- copyright : (C) 2001 by keith
- email : keith@linux
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-
-#include "config.h"
-#include <pthread.h> /* need to create/work with process thread */
-#include <errno.h> /* need for EAGAIN */
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdarg.h>
-
-#include <libxml/xmlerror.h>
-
-#include "../libxsldbg/breakpoint.h"
-#include "../libxsldbg/xsldbgmsg.h"
-#include "../libxsldbg/xsldbgthread.h"
-#include "../libxsldbg/qtnotifier2.h"
-
-#ifdef HAVE_READLINE
-#include <readline/readline.h>
-#ifdef HAVE_HISTORY
-#include <readline/history.h>
-#endif
-#endif
-
-#define DEBUG_BUFFER_SIZE 500
-
-static char inputBuffer[DEBUG_BUFFER_SIZE];
-static char outputBuffer[DEBUG_BUFFER_SIZE];
-
-/*the major structure to hold information about the process thread */
-pthread_t mythread;
-
-/* The reader for stdout */
-pthread_t stdoutReaderThread;
-
-FILE *stdoutIO = NULL;
-
-
-/* -----------------------------------------------
- private functions
- ---------------------------------------------------*/
-
-extern "C" {
-
-/**
- * xsldbgGenericErrorFunc:
- * @ctx: Is Valid
- * @msg: Is valid
- * @...: other parameters to use
- *
- * Handles print output from xsldbg and passes it to the application
- */
-void
-xsldbgGenericErrorFunc(void *ctx, const char *msg, ...);
-xmlChar * qtXslDbgShellReadline(xmlChar * prompt);
-
-}
-
-/* -----------------------------------------------
- end functions
- ---------------------------------------------------*/
-
-/* setup all application wide items */
-int
-xsldbgThreadInit(void)
-{
- int result = 0;
- fprintf(stderr, "mainInit()\n");
- xsltSetGenericErrorFunc(0, xsldbgGenericErrorFunc);
- setThreadStatus(XSLDBG_MSG_THREAD_INIT);
- xsldbgSetAppFunc(qtNotifyXsldbgApp);
- xsldbgSetAppStateFunc(qtNotifyStateXsldbgApp);
- xsldbgSetTextFunc(qtNotifyTextXsldbgApp);
- xsldbgSetReadlineFunc(qtXslDbgShellReadline);
-
-
- /* create the thread */
- if (pthread_create(&mythread, NULL, xsldbgThreadMain, NULL) != EAGAIN) {
- int counter;
- for (counter = 0; counter < 11; counter++){
- if (getThreadStatus() != XSLDBG_MSG_THREAD_INIT)
- break;
- usleep(250000); /*guess that it will take at most 2.5 seconds to startup */
- }
- /* xsldbg should have started by now if it can */
- if (getThreadStatus() == XSLDBG_MSG_THREAD_RUN){
- fprintf(stderr, "Created thread\n");
- result++;
- }else
- fprintf(stderr, "Thread did not start\n");
- } else {
- fprintf(stderr, "Failed to create thread\n");
- }
-
- return result;
-}
-
-
-/* tell the thread to stop and free that memory !*/
-void
-xsldbgThreadFree(void)
-{
- fprintf(stderr, "xsldbgThreadFree()\n");
- if (getThreadStatus() != XSLDBG_MSG_THREAD_DEAD)
- {
- int counter;
- fprintf(stderr, "Killing xsldbg thread\n");
- setThreadStatus(XSLDBG_MSG_THREAD_STOP);
- for (counter = 0; counter < 11; counter++){
- if (getThreadStatus() == XSLDBG_MSG_THREAD_DEAD)
- break;
- usleep(250000); /*guess that it will take at most 2.5 seconds to stop */
- }
- }
-
-}
-
-const char *getFakeInput()
-{
- return inputBuffer;
-}
-
-
-/* put text into standard input just like we had typed it */
-int
-fakeInput(const char *text)
-{
- int result = 0;
-
- if (!text || (getInputReady() == 1) || (getThreadStatus() != XSLDBG_MSG_THREAD_RUN))
- return result;
-
- // fprintf(stderr, "\nFaking input of \"%s\"\n", text);
- strncpy(inputBuffer, text, sizeof(inputBuffer));
- setInputReady(1);
- result++;
- return result;
-}
-
-
-/* use this function instead of the one that was in debugXSL.c */
-/**
- * qtXslDbgShellReadline:
- * @prompt: the prompt value
- *
- * Read a string
- *
- * Returns a copy of the text inputed or NULL if EOF in stdin found.
- * The caller is expected to free the returned string.
- */
-xmlChar *
-qtXslDbgShellReadline(xmlChar * prompt)
-{
-
- const char *inputReadBuff;
-
- static char last_read[DEBUG_BUFFER_SIZE] = { '\0' };
-
- if (getThreadStatus() != XSLDBG_MSG_THREAD_RUN)
- {
-#ifdef HAVE_READLINE
- xmlChar *line_read;
-
- /* Get a line from the user. */
- line_read = (xmlChar *) readline((char *) prompt);
-
- /* If the line has any text in it, save it on the history. */
- if (line_read && *line_read) {
- add_history((char *) line_read);
- strncpy((char*)last_read, (char*)line_read, DEBUG_BUFFER_SIZE - 1);
- } else {
- /* if only <Enter>is pressed then try last saved command line */
- line_read = (xmlChar *) xmlMemStrdup(last_read);
- }
- return (line_read);
-#else
- char line_read[DEBUG_BUFFER_SIZE];
-
- if (prompt != NULL)
- xsltGenericError(xsltGenericErrorContext, "%s", prompt);
- if (!fgets(line_read, DEBUG_BUFFER_SIZE - 1, stdin))
- return (NULL);
- line_read[DEBUG_BUFFER_SIZE - 1] = 0;
- /* if only <Enter>is pressed then try last saved command line */
- if ((strlen(line_read) == 0) || (line_read[0] == '\n')) {
- strcpy(line_read, last_read);
- } else {
- strcpy(last_read, line_read);
- }
- return (xmlChar *) xmlMemStrdup(line_read);
-#endif
-
- }
- else{
-
- setInputStatus(XSLDBG_MSG_AWAITING_INPUT);
- notifyXsldbgApp(XSLDBG_MSG_AWAITING_INPUT, NULL);
-
- while (getInputReady() == 0){
- usleep(10000);
- /* have we been told to die */
- if (getThreadStatus() == XSLDBG_MSG_THREAD_STOP){
- fprintf(stderr, "About to stop thread\n");
- xslDebugStatus = DEBUG_QUIT;
- return NULL;
- }
- }
-
- setInputStatus(XSLDBG_MSG_READ_INPUT);
- inputReadBuff = getFakeInput();
- if(inputReadBuff){
- notifyXsldbgApp(XSLDBG_MSG_READ_INPUT, inputReadBuff);
- return (xmlChar*)xmlMemStrdup(inputReadBuff);
- }else{
- return NULL;
- }
- }
-}
-
-
-xsldbgErrorMsg msg;
-xsldbgErrorMsgPtr msgPtr = &msg;
-xmlChar *msgText = NULL;
-
-int qtNotifyStateXsldbgApp(XsldbgMessageEnum type, int commandId,
- XsldbgCommandStateEnum commandState, const char *text)
-{
- int result = 0;
- msg.type = type;
- msg.commandId = commandId;
- msg.commandState = commandState;
- if (text != NULL)
- {
- msg.text = (xmlChar*)xmlMemStrdup(text);
- if (msg.text == NULL)
- return result; /* out of memory */
- }
- else
- msg.text = NULL;
-
- notifyXsldbgApp(XSLDBG_MSG_PROCESSING_RESULT, msgPtr);
- if (msg.text != NULL)
- {
- xmlFree(msg.text);
- msg.text = NULL;
- }
-
- result = 1;
- return result;
-}
-
-
-int qtNotifyTextXsldbgApp(XsldbgMessageEnum type, const char *text)
-{
- return qtNotifyStateXsldbgApp(type, -1, XSLDBG_COMMAND_NOTUSED, text);
-}
-
-char mainBuffer[DEBUG_BUFFER_SIZE];
-static void xsldbgThreadCleanupTQt(void);
-
-
-/* this is where the thread get to do all its work */
-void *
-xsldbgThreadMain(void *)
-{
- // int defaultArgc = 2;
- // char *defaultArgv[2];
- // int i;
-
- if (getThreadStatus() != XSLDBG_MSG_THREAD_INIT){
- fprintf(stderr, "xsldbg thread is not ready to be started. Or one is already running.\n");
- return NULL; /* we can't start more than one thread of xsldbg */
- }
-
-// defaultArgv[0] = xmlMemStrdup("xsldbg");
-// defaultArgv[1] = xmlMemStrdup("--shell");
- /*
- defaultArgv[2] = xmlMemStrdup("xsldoc.xsl");
- defaultArgv[3] = xmlMemStrdup("xsldoc.xml");
- */
-/* for (i = 0; i < defaultArgc; i++){
- if (defaultArgv[i] == NULL){
- fprintf(stderr, "Start thread failed. Unable to create xsldbg arguments\n");
- return NULL;
- }
- }
-*/
- xsldbgSetThreadCleanupFunc(xsldbgThreadCleanupTQt);
- setThreadStatus(XSLDBG_MSG_THREAD_RUN);
- setInputStatus(XSLDBG_MSG_AWAITING_INPUT);
- fprintf(stderr, "Starting thread\n");
-
- /* call the "main of xsldbg" found in debugXSL.c */
-// xsldbgMain(defaultArgc, defaultArgv);
- xsldbgMain(0,0);
- fprintf(stderr, "Stopping thread\n");
-/*
- for (i = 0; i < defaultArgc; i++){
- xmlFree(defaultArgv[i]);
- }
-*/
-
- setThreadStatus(XSLDBG_MSG_THREAD_DEAD);
- setInputStatus(XSLDBG_MSG_PROCESSING_INPUT);
- notifyXsldbgApp(XSLDBG_MSG_THREAD_DEAD, NULL);
- return NULL;
-}
-
-
-
-/* thread has died so cleanup after it not called directly but via
- notifyXsldbgApp*/
-void
-xsldbgThreadCleanupTQt(void)
-{
- fprintf(stderr, "Thread has finished\n");
- if (getThreadStatus() == XSLDBG_MSG_THREAD_RUN)
- {
- xsldbgThreadFree();
- }
- /* its safe to modify threadStatus as the thread is now dead */
- setThreadStatus(XSLDBG_MSG_THREAD_DEAD);
-}
-
-
-
-void *
-xsldbgThreadStdoutReader(void *data)
-{
- if (!stdoutIO)
- return data;
-
- while (getThreadStatus() == XSLDBG_MSG_THREAD_RUN){
- if (fgets(outputBuffer, sizeof(outputBuffer -1), stdoutIO)){
- usleep(10000);
- strcat(outputBuffer, "\n");
- notifyTextXsldbgApp(XSLDBG_MSG_TEXTOUT, outputBuffer);
- }else{
- fprintf(stderr, "Unable to read from stdout from xsldbg\n");
- break;
- }
- }
- return data;
-}