Marc Tardif provided a patch to use as much as 40 steps. A dynamic alloc
authorDaniel Veillard <veillard@src.gnome.org>
Tue, 27 Nov 2001 21:18:06 +0000 (21:18 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Tue, 27 Nov 2001 21:18:06 +0000 (21:18 +0000)
* libxslt/pattern.c: Marc Tardif provided a patch to use as
  much as 40 steps. A dynamic alloc would still be better
Daniel

ChangeLog
breakpoint/Makefile.am
libxslt/attributes.c
libxslt/pattern.c
libxslt/transform.c

index d66fe75..620b41f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov 27 22:16:50 CET 2001 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/pattern.c: Marc Tardif provided a patch to use as
+         much as 40 steps. A dynamic alloc would still be better
+
 Mon Nov 26 21:45:07 CET 2001 Daniel Veillard <daniel@veillard.com>
 
        * xsltproc/xsltproc.c: return useful code signaling error conditions
index c876df7..4dd0e6e 100644 (file)
@@ -14,7 +14,7 @@ libxsltbreakpoint_la_SOURCES =        \
        dbgmain.c       
 
 
-libxsltbreakpoint_la_LIBADD = -lxml2 $(M_LIBS)
+libxsltbreakpoint_la_LIBADD = @LIBXML_LIBS@
 libxsltbreakpoint_la_LDFLAGS = -version-info @LIBXSLT_VERSION_INFO@
 
 man_MANS = #breakpoint.4
index 3453a5f..c245c31 100644 (file)
@@ -46,6 +46,9 @@
 #include "imports.h"
 #include "transform.h"
 
+#ifdef WITH_DEBUGGER
+#include "../breakpoint/breakpoint.h"
+#endif
 #ifdef WITH_XSLT_DEBUG
 #define WITH_XSLT_DEBUG_ATTRIBUTES
 #endif
@@ -410,6 +413,14 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr node,
             "xsl:attribute : node already has children\n");
        return;
     }
+
+#ifdef WITH_DEBUGGER
+     /* --- break point code --- */
+     if (xslDebugStatus != DEBUG_NONE) {
+       xslHandleDebugger(inst, node, NULL, ctxt);
+     }
+#endif
+
     if (comp->name == NULL) {
        prop = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *)"name",
                                         XSLT_NAMESPACE);
@@ -551,6 +562,14 @@ 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 (values)       
+               xslHandleDebugger(values->attr->parent, node, NULL, ctxt);      
+           }
+#endif
            while (style != NULL) {
                values = xmlHashLookup2(style->attributeSets, ncname, prefix);
                while (values != NULL) {
index 1e4385a..c213434 100644 (file)
@@ -89,7 +89,7 @@ struct _xsltCompMatch {
     int maxStep;
     xmlNsPtr *nsList;          /* the namespaces in scope */
     int nsNr;                  /* the number of namespaces in scope */
-    xsltStepOp steps[20];        /* ops for computation */
+    xsltStepOp steps[40];        /* ops for computation */
 };
 
 typedef struct _xsltParserContext xsltParserContext;
@@ -128,7 +128,7 @@ xsltNewCompMatch(void) {
        return(NULL);
     }
     memset(cur, 0, sizeof(xsltCompMatch));
-    cur->maxStep = 20;
+    cur->maxStep = 40;
     cur->nsNr = 0;
     cur->nsList = NULL;
     return(cur);
@@ -237,7 +237,7 @@ xsltFreeParserContext(xsltParserContextPtr ctxt) {
 static int
 xsltCompMatchAdd(xsltCompMatchPtr comp, xsltOp op, xmlChar *value,
                 xmlChar *value2) {
-    if (comp->nbStep >= 20) {
+    if (comp->nbStep >= 40) {
        xsltPrintErrorContext(NULL, NULL, NULL); /* TODO */
         xsltGenericError(xsltGenericErrorContext,
                "xsltCompMatchAdd: overflow\n");
index 407c9bc..6707576 100644 (file)
@@ -1015,10 +1015,6 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
     }
 }
 
-#ifdef WITH_DEBUGGER
-
-/* make it eaier to reuse the code for handling checking of debug 
- status and breaking to debugger if needed */
 
 /**
  * xslHandleDebugger:
@@ -1032,56 +1028,11 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
  *   to the xslDebugBreak function
  */
 void
-xslHandleDebugger(xmlNodePtr cur, xmlNodePtr node,
-                  xsltTemplatePtr templ, xsltTransformContextPtr ctxt)
+xslHandleDebugger(xmlNodePtr cur ATTRIBUTE_UNUSED, xmlNodePtr node ATTRIBUTE_UNUSED,
+                  xsltTemplatePtr templ ATTRIBUTE_UNUSED, xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED)
 {
 
-    xslSetActiveBreakPoint(0);
-
-    switch (xslDebugStatus) {
-
-            /* A temparary stopping point */
-        case DEBUG_STOP:
-            xslDebugStatus = DEBUG_CONT;
-            /* only allow breakpoints at xml elements */
-            if (xmlGetLineNo(cur) != -1)
-                xslDebugBreak(cur, node, templ, ctxt);
-            break;
-
-        case DEBUG_STEP:
-            /* only allow breakpoints at xml elements */
-            if (xmlGetLineNo(cur) != -1)
-                xslDebugBreak(cur, node, templ, ctxt);
-            break;
-
-        case DEBUG_CONT:
-            {
-                int breakPoint = xslIsBreakPointNode(cur);
-
-                if (breakPoint) {
-                    if (xslIsBreakPointEnabled(breakPoint) == 1) {
-                        xslSetActiveBreakPoint(breakPoint);
-                        xslDebugBreak(cur, node, templ, ctxt);
-                    }
-                } else {
-                    breakPoint = xslIsBreakPointNode(node);
-                    if (xslIsBreakPointEnabled(breakPoint) == 1) {
-                        xslSetActiveBreakPoint(breakPoint);
-                        xslDebugBreak(cur, node, templ, ctxt);
-                    }
-                }
-            }
-            break;
-    }
 }
-#else
-void
-xslHandleDebugger(xmlNodePtr cur, xmlNodePtr node,
-                  xsltTemplatePtr templ, xsltTransformContextPtr ctxt)
-{
-}
-#endif
-
 
 /**
  * xsltApplyOneTemplate:
@@ -1132,9 +1083,10 @@ xsltApplyOneTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node,
 
         if (templ)
             xslHandleDebugger(templ->elem, node, templ, ctxt);
-        else
-            xslHandleDebugger(list, node, templ, ctxt);
-
+        else if (list)
+         xslHandleDebugger(list, node, templ, ctxt);
+       else if (ctxt->inst)
+         xslHandleDebugger(ctxt->inst, node, templ, ctxt);
     }
     /*  -- end --- */
 #endif