mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-05 23:35:48 +03:00
revamped the mechanism to hook a debuger to use a callback setup function,
* libxslt/attributes.c libxslt/transform.c libxslt/xsltutils.c libxslt/xsltutils.h: revamped the mechanism to hook a debuger to use a callback setup function, deprecating libxsltbreakpoint * xsltproc/Makefile.am configure.in breakpoint/Makefile.am: removing dependancies on libxsltbreakpoint Daniel
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
Fri Nov 30 12:59:05 CET 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* libxslt/attributes.c libxslt/transform.c libxslt/xsltutils.c
|
||||
libxslt/xsltutils.h: revamped the mechanism to hook a debuger
|
||||
to use a callback setup function, deprecating libxsltbreakpoint
|
||||
* xsltproc/Makefile.am configure.in breakpoint/Makefile.am: removing
|
||||
dependancies on libxsltbreakpoint
|
||||
|
||||
Thu Nov 29 09:52:38 CET 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
Build patch from Peter Williams <peterw@ximian.com>
|
||||
|
@@ -15,7 +15,7 @@ libxsltbreakpoint_la_SOURCES = \
|
||||
|
||||
|
||||
libxsltbreakpoint_la_LIBADD = @LIBXML_LIBS@
|
||||
libxsltbreakpoint_la_LDFLAGS = -version-info @LIBXSLT_VERSION_INFO@
|
||||
libxsltbreakpoint_la_LDFLAGS = -version-info @LIBXSLTBREAK_VERSION_INFO@
|
||||
|
||||
man_MANS = #breakpoint.4
|
||||
|
||||
|
35
configure.in
35
configure.in
@@ -42,6 +42,30 @@ AC_SUBST(LIBEXSLT_VERSION)
|
||||
AC_SUBST(LIBEXSLT_VERSION_INFO)
|
||||
AC_SUBST(LIBEXSLT_VERSION_NUMBER)
|
||||
|
||||
dnl
|
||||
dnl libxsltbreakpoint is a compatibility obsoleted library
|
||||
dnl it's blocked at 1.0.8 and should be removed in default build in the
|
||||
dnl future
|
||||
dnl
|
||||
|
||||
LIBXSLTBREAK_MAJOR_VERSION=1
|
||||
LIBXSLTBREAK_MINOR_VERSION=0
|
||||
LIBXSLTBREAK_MICRO_VERSION=8
|
||||
|
||||
LIBXSLTBREAK_VERSION=$LIBXSLTBREAK_MAJOR_VERSION.$LIBXSLTBREAK_MINOR_VERSION.$LIBXSLTBREAK_MICRO_VERSION
|
||||
LIBXSLTBREAK_VERSION_INFO=`expr $LIBXSLTBREAK_MAJOR_VERSION + $LIBXSLTBREAK_MINOR_VERSION`:$LIBXSLTBREAK_MICRO_VERSION:$LIBXSLTBREAK_MINOR_VERSION
|
||||
|
||||
LIBXSLTBREAK_VERSION_NUMBER=`expr $LIBXSLTBREAK_MAJOR_VERSION \* 10000 + $LIBXSLTBREAK_MINOR_VERSION \* 100 + $LIBXSLTBREAK_MICRO_VERSION`
|
||||
|
||||
AC_SUBST(LIBXSLTBREAK_MAJOR_VERSION)
|
||||
AC_SUBST(LIBXSLTBREAK_MINOR_VERSION)
|
||||
AC_SUBST(LIBXSLTBREAK_MICRO_VERSION)
|
||||
AC_SUBST(LIBXSLTBREAK_VERSION)
|
||||
AC_SUBST(LIBXSLTBREAK_VERSION_INFO)
|
||||
AC_SUBST(LIBXSLTBREAK_VERSION_NUMBER)
|
||||
|
||||
|
||||
|
||||
|
||||
VERSION=${LIBXSLT_VERSION}
|
||||
|
||||
@@ -136,7 +160,7 @@ AC_SUBST(WITH_MEM_DEBUG)
|
||||
dnl
|
||||
dnl Is debugger support requested
|
||||
dnl
|
||||
AC_ARG_WITH(with_debugger, [ --with-debugger Add the debugging module (off)])
|
||||
AC_ARG_WITH(with_debugger, [ --with-debugger Add the debugging support (on)])
|
||||
if test "$with_debugger" = "no" ; then
|
||||
echo Disabling debugger
|
||||
WITH_DEBUGGER=0
|
||||
@@ -260,13 +284,8 @@ case ${host} in
|
||||
esac
|
||||
|
||||
XSLT_INCLUDEDIR='-I${includedir}'
|
||||
if test "${WITH_DEBUGGER}" = "1" ; then
|
||||
XSLT_LIBS="-lxslt -lxsltbreakpoint $LIBXML_LIBS $M_LIBS"
|
||||
EXTRA_LIBS='$(top_builddir)/breakpoint/libxsltbreakpoint.la'" $LIBXML_LIBS $M_LIBS"
|
||||
else
|
||||
XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
|
||||
EXTRA_LIBS="$LIBXML_LIBS $M_LIBS"
|
||||
fi
|
||||
XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
|
||||
EXTRA_LIBS="$LIBXML_LIBS $M_LIBS"
|
||||
|
||||
AC_SUBST(XSLT_LIBDIR)
|
||||
AC_SUBST(XSLT_INCLUDEDIR)
|
||||
|
@@ -46,9 +46,6 @@
|
||||
#include "imports.h"
|
||||
#include "transform.h"
|
||||
|
||||
#ifdef WITH_DEBUGGER
|
||||
#include "../breakpoint/breakpoint.h"
|
||||
#endif
|
||||
#ifdef WITH_XSLT_DEBUG
|
||||
#define WITH_XSLT_DEBUG_ATTRIBUTES
|
||||
#endif
|
||||
@@ -383,7 +380,9 @@ error:
|
||||
*/
|
||||
static void
|
||||
xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp, int fromset) {
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp,
|
||||
int fromset)
|
||||
{
|
||||
xmlChar *prop = NULL;
|
||||
xmlChar *ncname = NULL, *name, *namespace;
|
||||
xmlChar *prefix = NULL;
|
||||
@@ -402,7 +401,8 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
|
||||
if ((ctxt == NULL) || (node == NULL) || (inst == NULL)
|
||||
|| (comp == NULL))
|
||||
return;
|
||||
if (!comp->has_name) {
|
||||
return;
|
||||
@@ -413,16 +413,15 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
"xsl:attribute : node already has children\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef WITH_DEBUGGER
|
||||
/* --- break point code --- */
|
||||
if (xslDebugStatus != DEBUG_NONE) {
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE) {
|
||||
xslHandleDebugger(inst, node, NULL, ctxt);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (comp->name == NULL) {
|
||||
prop = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *)"name",
|
||||
prop =
|
||||
xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *) "name",
|
||||
XSLT_NAMESPACE);
|
||||
if (prop == NULL) {
|
||||
xsltPrintErrorContext(ctxt, NULL, inst);
|
||||
@@ -441,7 +440,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
} else {
|
||||
name = ncname;
|
||||
}
|
||||
if (!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3)) {
|
||||
if (!xmlStrncasecmp(prefix, (xmlChar *) "xml", 3)) {
|
||||
#ifdef WITH_XSLT_DEBUG_PARSING
|
||||
xsltGenericDebug(xsltGenericDebugContext,
|
||||
"xsltAttribute: xml prefix forbidden\n");
|
||||
@@ -450,7 +449,8 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
}
|
||||
if ((comp->ns == NULL) && (comp->has_ns)) {
|
||||
namespace = xsltEvalAttrValueTemplate(ctxt, inst,
|
||||
(const xmlChar *)"namespace", XSLT_NAMESPACE);
|
||||
(const xmlChar *)
|
||||
"namespace", XSLT_NAMESPACE);
|
||||
if (namespace != NULL) {
|
||||
ns = xsltGetSpecialNamespace(ctxt, inst, namespace, prefix,
|
||||
ctxt->insert);
|
||||
@@ -461,7 +461,8 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
if (ns == NULL) {
|
||||
xsltPrintErrorContext(ctxt, NULL, inst);
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"xsl:attribute : no namespace bound to prefix %s\n", prefix);
|
||||
"xsl:attribute : no namespace bound to prefix %s\n",
|
||||
prefix);
|
||||
} else {
|
||||
ns = xsltGetNamespace(ctxt, inst, ns, ctxt->insert);
|
||||
}
|
||||
@@ -479,9 +480,10 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
if (value == NULL) {
|
||||
if (ns) {
|
||||
attr = xmlSetNsProp(ctxt->insert, ns, name,
|
||||
(const xmlChar *)"");
|
||||
(const xmlChar *) "");
|
||||
} else {
|
||||
attr = xmlSetProp(ctxt->insert, name, (const xmlChar *)"");
|
||||
attr =
|
||||
xmlSetProp(ctxt->insert, name, (const xmlChar *) "");
|
||||
}
|
||||
} else {
|
||||
if (ns) {
|
||||
@@ -492,7 +494,7 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
error:
|
||||
if (prop != NULL)
|
||||
xmlFree(prop);
|
||||
if (ncname != NULL)
|
||||
@@ -530,7 +532,9 @@ xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
|
||||
void
|
||||
xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst ATTRIBUTE_UNUSED, xmlChar *attributes) {
|
||||
xmlNodePtr inst ATTRIBUTE_UNUSED,
|
||||
xmlChar * attributes)
|
||||
{
|
||||
xmlChar *ncname = NULL;
|
||||
xmlChar *prefix = NULL;
|
||||
xmlChar *attrib, *endattr;
|
||||
@@ -543,11 +547,13 @@ xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
|
||||
attrib = attributes;
|
||||
while (*attrib != 0) {
|
||||
while (IS_BLANK(*attrib)) attrib++;
|
||||
while (IS_BLANK(*attrib))
|
||||
attrib++;
|
||||
if (*attrib == 0)
|
||||
break;
|
||||
endattr = attrib;
|
||||
while ((*endattr != 0) && (!IS_BLANK(*endattr))) endattr++;
|
||||
while ((*endattr != 0) && (!IS_BLANK(*endattr)))
|
||||
endattr++;
|
||||
attrib = xmlStrndup(attrib, endattr - attrib);
|
||||
if (attrib) {
|
||||
#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
|
||||
@@ -563,15 +569,17 @@ xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
|
||||
style = ctxt->style;
|
||||
#ifdef WITH_DEBUGGER
|
||||
/* --- break point code --- */
|
||||
if (style && (xslDebugStatus != DEBUG_NONE)) {
|
||||
values = xmlHashLookup2(style->attributeSets, ncname, prefix);
|
||||
if (style && (xslDebugStatus != XSLT_DEBUG_NONE)) {
|
||||
values =
|
||||
xmlHashLookup2(style->attributeSets, ncname, prefix);
|
||||
if (values)
|
||||
xslHandleDebugger(values->attr->parent, node, NULL, ctxt);
|
||||
xslHandleDebugger(values->attr->parent, node, NULL,
|
||||
ctxt);
|
||||
}
|
||||
#endif
|
||||
while (style != NULL) {
|
||||
values = xmlHashLookup2(style->attributeSets, ncname, prefix);
|
||||
values =
|
||||
xmlHashLookup2(style->attributeSets, ncname, prefix);
|
||||
while (values != NULL) {
|
||||
if (values->attr != NULL) {
|
||||
xsltAttributeInternal(ctxt, node, values->attr,
|
||||
|
@@ -61,11 +61,6 @@ static int xsltGetHTMLIDs(const xmlChar *version, const xmlChar **publicID,
|
||||
const xmlChar **systemID);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_DEBUGGER
|
||||
#include "../breakpoint/breakpoint.h"
|
||||
int xslDebugStatus;
|
||||
#endif
|
||||
|
||||
int xsltMaxDepth = 5000;
|
||||
|
||||
/*
|
||||
@@ -1016,24 +1011,6 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xslHandleDebugger:
|
||||
* @cur : source node being executed
|
||||
* @node : data node being processed
|
||||
* @templ : temlate that applies to node
|
||||
* @ctxt : the xslt transform context
|
||||
*
|
||||
* If either cur or node are a breakpoint, or xslDebugStatus in state
|
||||
* where debugging must occcur at this time then transfer control
|
||||
* to the xslDebugBreak function
|
||||
*/
|
||||
void
|
||||
xslHandleDebugger(xmlNodePtr cur ATTRIBUTE_UNUSED, xmlNodePtr node ATTRIBUTE_UNUSED,
|
||||
xsltTemplatePtr templ ATTRIBUTE_UNUSED, xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltApplyOneTemplate:
|
||||
* @ctxt: a XSLT process context
|
||||
@@ -1064,8 +1041,7 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
long start = 0;
|
||||
|
||||
#ifdef WITH_DEBUGGER
|
||||
/* --- break point code --- */
|
||||
if (xslDebugStatus != DEBUG_NONE) {
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE) {
|
||||
if (templ) {
|
||||
addCallResult = xslAddCall(templ, templ->elem);
|
||||
} else {
|
||||
@@ -1074,8 +1050,8 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
|
||||
switch (xslDebugStatus) {
|
||||
|
||||
case DEBUG_RUN_RESTART:
|
||||
case DEBUG_QUIT:
|
||||
case XSLT_DEBUG_RUN_RESTART:
|
||||
case XSLT_DEBUG_QUIT:
|
||||
if (addCallResult)
|
||||
xslDropCall();
|
||||
return;
|
||||
@@ -1088,7 +1064,6 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
else if (ctxt->inst)
|
||||
xslHandleDebugger(ctxt->inst, node, templ, ctxt);
|
||||
}
|
||||
/* -- end --- */
|
||||
#endif
|
||||
|
||||
if ((ctxt == NULL) || (list == NULL))
|
||||
@@ -1125,8 +1100,7 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
#ifdef WITH_XSLT_DEBUG_PROCESS
|
||||
if (templ->name != NULL)
|
||||
xsltGenericDebug(xsltGenericDebugContext,
|
||||
"applying template '%s'\n",
|
||||
templ->name);
|
||||
"applying template '%s'\n", templ->name);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1137,14 +1111,12 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
while (cur != NULL) {
|
||||
ctxt->inst = cur;
|
||||
#ifdef WITH_DEBUGGER
|
||||
/* --- break point code --- */
|
||||
switch (xslDebugStatus) {
|
||||
case DEBUG_RUN_RESTART:
|
||||
case DEBUG_QUIT:
|
||||
case XSLT_DEBUG_RUN_RESTART:
|
||||
case XSLT_DEBUG_QUIT:
|
||||
break;
|
||||
|
||||
}
|
||||
/* --- end --- */
|
||||
#endif
|
||||
/*
|
||||
* test, we must have a valid insertion point
|
||||
@@ -1157,7 +1129,7 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
goto error;
|
||||
}
|
||||
#ifdef WITH_DEBUGGER
|
||||
if (xslDebugStatus != DEBUG_NONE)
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE)
|
||||
xslHandleDebugger(cur, node, templ, ctxt);
|
||||
#endif
|
||||
|
||||
@@ -1238,7 +1210,7 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
function = (xsltTransformFunction)
|
||||
xsltExtElementLookup(ctxt, cur->name, cur->ns->href);
|
||||
else
|
||||
function = ((xsltElemPreCompPtr)cur->_private)->func;
|
||||
function = ((xsltElemPreCompPtr) cur->_private)->func;
|
||||
|
||||
if (function == NULL) {
|
||||
xmlNodePtr child;
|
||||
@@ -1304,10 +1276,11 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
int i;
|
||||
xmlNsPtr ns, ret;
|
||||
|
||||
for (i = 0;i < ctxt->templ->inheritedNsNr;i++) {
|
||||
for (i = 0; i < ctxt->templ->inheritedNsNr; i++) {
|
||||
ns = ctxt->templ->inheritedNs[i];
|
||||
if (ctxt->style->nsAliases != NULL) {
|
||||
const xmlChar *URI;
|
||||
|
||||
URI = (const xmlChar *)
|
||||
xmlHashLookup(ctxt->style->nsAliases,
|
||||
ns->href);
|
||||
@@ -1364,7 +1337,7 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
}
|
||||
} while (cur != NULL);
|
||||
}
|
||||
error:
|
||||
error:
|
||||
ctxt->node = oldCurrent;
|
||||
ctxt->inst = oldInst;
|
||||
ctxt->insert = oldInsert;
|
||||
@@ -1372,6 +1345,7 @@ error:
|
||||
xsltFreeStackElemList(varsPop(ctxt));
|
||||
else {
|
||||
xsltStackElemPtr p, tmp = varsPop(ctxt);
|
||||
|
||||
if (tmp != params) {
|
||||
p = tmp;
|
||||
while ((p != NULL) && (p->next != params))
|
||||
@@ -1409,13 +1383,12 @@ error:
|
||||
}
|
||||
}
|
||||
#ifdef WITH_DEBUGGER
|
||||
if (xslDebugStatus != DEBUG_NONE && addCallResult) {
|
||||
if ((xslDebugStatus != XSLT_DEBUG_NONE) && (addCallResult)) {
|
||||
xslDropCall();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* XSLT-1.1 extensions *
|
||||
@@ -2522,7 +2495,7 @@ xsltCallTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
cur = inst->children;
|
||||
while (cur != NULL) {
|
||||
#ifdef WITH_DEBUGGER
|
||||
if (xslDebugStatus != DEBUG_NONE)
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE)
|
||||
xslHandleDebugger(cur, node, comp->templ, ctxt);
|
||||
#endif
|
||||
if (ctxt->state == XSLT_STATE_STOPPED) break;
|
||||
@@ -2722,7 +2695,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
cur = inst->children;
|
||||
while (cur!=NULL) {
|
||||
#ifdef WITH_DEBUGGER
|
||||
if (xslDebugStatus != DEBUG_NONE)
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE)
|
||||
xslHandleDebugger(cur, node, comp->templ, ctxt);
|
||||
#endif
|
||||
if (ctxt->state == XSLT_STATE_STOPPED) break;
|
||||
@@ -2856,7 +2829,7 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
|
||||
|
||||
#ifdef WITH_DEBUGGER
|
||||
if (xslDebugStatus != DEBUG_NONE)
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE)
|
||||
xslHandleDebugger(when, node, comp->templ, ctxt);
|
||||
#endif
|
||||
|
||||
@@ -2912,7 +2885,7 @@ xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
}
|
||||
if (IS_XSLT_ELEM(replacement) && (IS_XSLT_NAME(replacement, "otherwise"))) {
|
||||
#ifdef WITH_DEBUGGER
|
||||
if (xslDebugStatus != DEBUG_NONE)
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE)
|
||||
xslHandleDebugger(replacement, node, comp->templ, ctxt);
|
||||
#endif
|
||||
|
||||
@@ -3101,7 +3074,7 @@ xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
sorts[nbsorts++] = replacement;
|
||||
}
|
||||
#ifdef WITH_DEBUGGER
|
||||
if (xslDebugStatus != DEBUG_NONE)
|
||||
if (xslDebugStatus != XSLT_DEBUG_NONE)
|
||||
xslHandleDebugger(replacement, node, NULL, ctxt);
|
||||
#endif
|
||||
replacement = replacement->next;
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "templates.h"
|
||||
#include "xsltInternals.h"
|
||||
#include "imports.h"
|
||||
#include "transform.h"
|
||||
|
||||
/* gettimeofday on Windows ??? */
|
||||
#ifdef WIN32
|
||||
@@ -1246,3 +1247,103 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
|
||||
xmlFree(templates);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Hooks for the debugger *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/*
|
||||
* There is currently only 3 debugging callback defined
|
||||
* Debugger callbacks are disabled by default
|
||||
*/
|
||||
#define XSLT_CALLBACK_NUMBER 3
|
||||
|
||||
typedef struct _xsltDebuggerCallbacks xsltDebuggerCallbacks;
|
||||
typedef xsltDebuggerCallbacks *xsltDebuggerCallbacksPtr;
|
||||
struct _xsltDebuggerCallbacks {
|
||||
xsltHandleDebuggerCallback handler;
|
||||
xsltAddCallCallback add;
|
||||
xsltDropCallCallback drop;
|
||||
};
|
||||
|
||||
static xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks = {
|
||||
NULL, /* handler */
|
||||
NULL, /* add */
|
||||
NULL /* drop */
|
||||
};
|
||||
|
||||
int xslDebugStatus;
|
||||
|
||||
/**
|
||||
* xslSetDebuggerCallbacks:
|
||||
* @no : number of callbacks
|
||||
* @block : the block of callbacks
|
||||
*
|
||||
* This function allow to plug a debugger into the XSLT library
|
||||
* @block points to a block of memory containing the address of @no
|
||||
* callback routines.
|
||||
*
|
||||
* Returns 0 in case of success and -1 in case of error
|
||||
*/
|
||||
int
|
||||
xsltSetDebuggerCallbacks(int no, void *block)
|
||||
{
|
||||
xsltDebuggerCallbacksPtr callbacks;
|
||||
|
||||
if ((block == NULL) || (no != 1))
|
||||
return(-1);
|
||||
|
||||
callbacks = (xsltDebuggerCallbacksPtr) block;
|
||||
xsltDebuggerCurrentCallbacks.handler = callbacks->handler;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xslHandleDebugger:
|
||||
* @cur : source node being executed
|
||||
* @node : data node being processed
|
||||
* @templ : temlate that applies to node
|
||||
* @ctxt : the xslt transform context
|
||||
*
|
||||
* If either cur or node are a breakpoint, or xslDebugStatus in state
|
||||
* where debugging must occcur at this time then transfer control
|
||||
* to the xslDebugBreak function
|
||||
*/
|
||||
void
|
||||
xslHandleDebugger(xmlNodePtr cur, xmlNodePtr node, xsltTemplatePtr templ,
|
||||
xsltTransformContextPtr ctxt)
|
||||
{
|
||||
if (xsltDebuggerCurrentCallbacks.handler != NULL)
|
||||
xsltDebuggerCurrentCallbacks.handler(cur, node, templ, ctxt);
|
||||
}
|
||||
|
||||
/**
|
||||
* xslAddCall:
|
||||
* @templ : current template being applied
|
||||
* @source : the source node being processed
|
||||
*
|
||||
* Add template "call" to call stack
|
||||
* Returns : 1 on sucess 0 otherwise an error may be printed if
|
||||
* WITH_XSLT_DEBUG_BREAKPOINTS is defined
|
||||
*/
|
||||
int
|
||||
xslAddCall(xsltTemplatePtr templ, xmlNodePtr source)
|
||||
{
|
||||
if (xsltDebuggerCurrentCallbacks.add != NULL)
|
||||
return(xsltDebuggerCurrentCallbacks.add(templ, source));
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xslDropCall :
|
||||
*
|
||||
* Drop the topmost item off the call stack
|
||||
*/
|
||||
void
|
||||
xslDropCall(void)
|
||||
{
|
||||
if (xsltDebuggerCurrentCallbacks.drop != NULL)
|
||||
xsltDebuggerCurrentCallbacks.drop();
|
||||
}
|
||||
|
||||
|
@@ -154,6 +154,35 @@ void xsltCalibrateAdjust (long delta);
|
||||
|
||||
#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
|
||||
|
||||
/*
|
||||
* Hooks for the debugger
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
XSLT_DEBUG_NONE = 0, /* no debugging allowed */
|
||||
XSLT_DEBUG_INIT,
|
||||
XSLT_DEBUG_STEP,
|
||||
XSLT_DEBUG_STEPOUT,
|
||||
XSLT_DEBUG_NEXT,
|
||||
XSLT_DEBUG_STOP,
|
||||
XSLT_DEBUG_CONT,
|
||||
XSLT_DEBUG_RUN,
|
||||
XSLT_DEBUG_RUN_RESTART,
|
||||
XSLT_DEBUG_QUIT
|
||||
} xsltDebugStatusCodes;
|
||||
|
||||
LIBXSLT_PUBLIC extern int xslDebugStatus;
|
||||
|
||||
typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
|
||||
xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
|
||||
typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
|
||||
typedef void (*xsltDropCallCallback) (void);
|
||||
|
||||
int xsltSetDebuggerCallbacks (int no, void *block);
|
||||
int xslAddCall (xsltTemplatePtr templ,
|
||||
xmlNodePtr source);
|
||||
void xslDropCall (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -11,22 +11,9 @@ xsltproc_LDFLAGS =
|
||||
xsltproc_DEPENDENCIES = $(DEPS)
|
||||
xsltproc_LDADD = $(LDADDS)
|
||||
|
||||
if WITH_DEBUGGER
|
||||
DEPS = $(top_builddir)/libxslt/libxslt.la \
|
||||
$(top_builddir)/breakpoint/libxsltbreakpoint.la \
|
||||
$(top_builddir)/libexslt/libexslt.la
|
||||
else
|
||||
DEPS = $(top_builddir)/libxslt/libxslt.la \
|
||||
$(top_builddir)/libexslt/libexslt.la
|
||||
endif
|
||||
|
||||
if WITH_DEBUGGER
|
||||
LDADDS = $(top_builddir)/libxslt/libxslt.la \
|
||||
$(top_builddir)/libexslt/libexslt.la \
|
||||
$(top_builddir)/breakpoint/libxsltbreakpoint.la \
|
||||
@LIBXML_LIBS@ $(EXTRA_LIBS)
|
||||
else
|
||||
LDADDS = $(top_builddir)/libxslt/libxslt.la \
|
||||
$(top_builddir)/libexslt/libexslt.la \
|
||||
@LIBXML_LIBS@ $(EXTRA_LIBS)
|
||||
endif
|
||||
|
Reference in New Issue
Block a user