Not much: - libxslt/xslt.c : small cleanup - configure.in
authorDaniel Veillard <veillard@src.gnome.org>
Mon, 8 Jan 2001 18:57:17 +0000 (18:57 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Mon, 8 Jan 2001 18:57:17 +0000 (18:57 +0000)
Not much:
- libxslt/xslt.c : small cleanup
- configure.in libxslt/xsltconfig.h.in: add memory debug and
  mechanism for compile-time options
Daniel

ChangeLog
configure.in
libxslt/xslt.c
libxslt/xsltconfig.h.in [new file with mode: 0644]

index 6e6ea7d..08f0e62 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Jan  8 19:55:18 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+       * libxslt/xslt.c : small cleanup
+       * configure.in libxslt/xsltconfig.h.in: add memory debug and
+         mechanism for compile-time options
+
 Sun Jan  7 22:53:12 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
        * libxslt/xslt.[ch]: started parsing templates
index 86e9dc6..7f6b287 100644 (file)
@@ -8,6 +8,24 @@ AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
 AM_MAINTAINER_MODE
 
 dnl
+dnl Debug for DV
+dnl
+if test "${LOGNAME}" = "veillard" ; then
+    if test "${with_mem_debug}" = "" ; then
+       with_mem_debug="yes"
+    fi
+    CFLAGS="-Wall -g -pedantic"
+fi
+AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
+if test "$with_mem_debug" = "yes" ; then
+    echo Enabling memory debug support
+    WITH_MEM_DEBUG=1
+else    
+    WITH_MEM_DEBUG=0
+fi
+AC_SUBST(WITH_MEM_DEBUG)
+
+dnl
 dnl The following new parameters were added to offer
 dnl the ability to specify the location of the libxml
 dnl library during linking and compilation.
@@ -100,6 +118,7 @@ AC_SUBST(XSLT_LIBS)
 AC_OUTPUT([
 Makefile
 libxslt/Makefile
+libxslt/xsltconfig.h
 tests/Makefile
 xslt-config
 ])
index 5c06080..f4886be 100644 (file)
@@ -9,14 +9,16 @@
  * Daniel.Veillard@imag.fr
  */
 
+#include "xsltconfig.h"
+
 #include <string.h>
 
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libxml/xmlerror.h>
-#include <libxslt/xslt.h>
-#include <libxslt/xsltInternals.h>
+#include "xslt.h"
+#include "xsltInternals.h"
 
 #define DEBUG_PARSING
 
@@ -123,7 +125,7 @@ void
 xsltFreeTemplateList(xsltTemplatePtr template) {
     xsltTemplatePtr cur;
 
-    while (template == NULL) {
+    while (template != NULL) {
        cur = template;
        template = template->next;
        xsltFreeTemplate(cur);
@@ -202,21 +204,48 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) {
      * Find and handle the params
      */
     while (cur != NULL) {
+       /*
+        * Remove Blank nodes found at this level.
+        */
        if (IS_BLANK_NODE(cur)) {
+           xmlNodePtr blank = cur;
+
             cur = cur->next;
+           xmlUnlinkNode(blank);
+           xmlFreeNode(blank);
            continue;
        }
-       if (!(IS_XSLT_ELEM(cur))) {
-#ifdef DEBUG_PARSING
-           xsltGenericError(xsltGenericErrorContext,
-                   "xsltParseStylesheetTop : found foreign element %s\n",
-                   cur->name);
-#endif
+       if ((IS_XSLT_ELEM(cur)) && (xmlStrEqual(cur->name, "param"))) {
+           TODO /* Handle param */
+       } else
+           break;
+       cur = cur->next;
+    }
+
+    /*
+     * Browse the remaining of the template
+     */
+    while (cur != NULL) {
+       /*
+        * Remove Blank nodes found at this level.
+        */
+       if (IS_BLANK_NODE(cur)) {
+           xmlNodePtr blank = cur;
+
             cur = cur->next;
+           xmlUnlinkNode(blank);
+           xmlFreeNode(blank);
            continue;
        }
-       if (xmlStrEqual(cur->name, "param")) {
-           TODO /* Handle param */
+       if ((IS_XSLT_ELEM(cur)) && (xmlStrEqual(cur->name, "param"))) {
+           xmlNodePtr param = cur;
+
+            cur = cur->next;
+           xsltGenericError(xsltGenericErrorContext,
+               "xsltParseStylesheetTop: ignoring misplaced param element\n");
+           xmlUnlinkNode(param);
+           xmlFreeNode(param);
+           continue;
        } else
            break;
        cur = cur->next;
diff --git a/libxslt/xsltconfig.h.in b/libxslt/xsltconfig.h.in
new file mode 100644 (file)
index 0000000..f8421f6
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * xsltconfig.h: compile-time version informations for the XSLT engine
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_XSLTCONFIG_H__
+#define __XML_XSLTCONFIG_H__
+
+#include "config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if @WITH_MEM_DEBUG@
+#define DEBUG_MEMORY
+#define DEBUG_MEMORY_LOCATION
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_XSLTCONFIG_H__ */