fixed a Relax-NG compilation/streaming bug introduced when fixing the

* relaxng.c: fixed a Relax-NG compilation/streaming bug introduced
  when fixing the previous Relax-NG bugs
* result/relaxng/*: This slightly changes the output messages of
  some regression tests.
* configure.in: added support of -with-fexceptions for nested C++
  support.
Daniel
diff --git a/ChangeLog b/ChangeLog
index fb650ed..bbb7d0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Jul 27 14:30:56 EDT 2003 Daniel Veillard <daniel@veillard.com>
+
+	* relaxng.c: fixed a Relax-NG compilation/streaming bug introduced
+	  when fixing the previous Relax-NG bugs
+	* result/relaxng/*: This slightly changes the output messages of
+	  some regression tests.
+	* configure.in: added support of -with-fexceptions for nested C++
+	  support.
+
 Thu Jul 24 15:46:02 MDT 2003 John Fleck <jfleck@inkstain.net>
 
 	* doc/tutorial/apa.html
diff --git a/configure.in b/configure.in
index 5ced7d7..e45a7c2 100644
--- a/configure.in
+++ b/configure.in
@@ -244,6 +244,8 @@
 XML_CFLAGS=""
 RDL_LIBS=""
 
+AC_ARG_WITH(fexceptions,
+[  --with-fexceptions      add GCC flag -fexceptions for C++ exceptions (off)])
 dnl
 dnl Workaround for native compilers
 dnl  HP  : http://bugs.gnome.org/db/31/3163.html
@@ -259,6 +261,15 @@
                ;;
     esac
 else
+    if test "$with_fexceptions" = "yes"
+    then
+        #
+	# Not activated by default because this inflates the code size
+	# Used to allow propagation of C++ exceptions through the library
+	#
+	CFLAGS="${CFLAGS} -fexceptions"
+    fi
+       
     CFLAGS="${CFLAGS} -Wall"
     case "${host}" in
           alpha*-*-linux* )
diff --git a/relaxng.c b/relaxng.c
index 054277c..afa04c8 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -2709,6 +2709,9 @@
 	    ret = 1;
 	    break;
         case XML_RELAXNG_ELEMENT:
+	    /*
+	     * Check if the element content is compileable
+	     */
 	    if (((def->dflags & IS_NOT_COMPILABLE) == 0) &&
 	        ((def->dflags & IS_COMPILABLE) == 0)) {
 		xmlRelaxNGDefinePtr list;
@@ -2721,12 +2724,31 @@
 		}
 		if (ret == 0) def->dflags |= IS_NOT_COMPILABLE;
 		if (ret == 1) def->dflags |= IS_COMPILABLE;
+#ifdef DEBUG_COMPILE
+		if (ret == 1) {
+		    xmlGenericError(xmlGenericErrorContext,
+				"element content for %s is compilable\n",
+				def->name);
+		} else if (ret == 0) {
+		    xmlGenericError(xmlGenericErrorContext,
+				"element content for %s is not compilable\n",
+				def->name);
+		} else {
+		    xmlGenericError(xmlGenericErrorContext,
+			    "Problem in RelaxNGIsCompileable for element %s\n",
+				def->name);
+		}
+#endif
 	    }
-	    if (ret == 1) {
-		if ((def->nameClass != NULL) || (def->name == NULL))
-		    ret = 0;
-	    }
-	    break;
+	    /*
+	     * All elements return a compileable status unless they
+	     * are generic like anyName
+	     */
+	    if ((def->nameClass != NULL) || (def->name == NULL))
+		ret = 0;
+	    else
+	        ret = 1;
+	    return(ret);
         case XML_RELAXNG_REF:
         case XML_RELAXNG_EXTERNALREF:
         case XML_RELAXNG_PARENTREF:
@@ -2778,6 +2800,21 @@
     }
     if (ret == 0) def->dflags |= IS_NOT_COMPILABLE;
     if (ret == 1) def->dflags |= IS_COMPILABLE;
+#ifdef DEBUG_COMPILE
+    if (ret == 1) {
+	xmlGenericError(xmlGenericErrorContext,
+	            "RelaxNGIsCompileable %s : true\n",
+	            xmlRelaxNGDefName(def));
+    } else if (ret == 0) {
+	xmlGenericError(xmlGenericErrorContext,
+	            "RelaxNGIsCompileable %s : false\n",
+	            xmlRelaxNGDefName(def));
+    } else {
+	xmlGenericError(xmlGenericErrorContext,
+	            "Problem in RelaxNGIsCompileable %s\n",
+	            xmlRelaxNGDefName(def));
+    }
+#endif
     return(ret);
 }
 
diff --git a/result/relaxng/tutor10_7_3.err b/result/relaxng/tutor10_7_3.err
index ebbc9aa..bc3d6ac 100644
--- a/result/relaxng/tutor10_7_3.err
+++ b/result/relaxng/tutor10_7_3.err
@@ -1,2 +1,2 @@
 RNG validity error: file ./test/relaxng/tutor10_7_3.xml line 2 element card
-Element addressBook has extra content: card
+Element card failed to validate attributes
diff --git a/result/relaxng/tutor10_8_3.err b/result/relaxng/tutor10_8_3.err
index 34eb5e9..06229bf 100644
--- a/result/relaxng/tutor10_8_3.err
+++ b/result/relaxng/tutor10_8_3.err
@@ -1,2 +1,2 @@
 RNG validity error: file ./test/relaxng/tutor10_8_3.xml line 2 element card
-Element addressBook has extra content: card
+Element card failed to validate attributes
diff --git a/result/relaxng/tutor3_5_2.err b/result/relaxng/tutor3_5_2.err
index ed09a33..80acb18 100644
--- a/result/relaxng/tutor3_5_2.err
+++ b/result/relaxng/tutor3_5_2.err
@@ -1,2 +1,4 @@
-RNG validity error: file ./test/relaxng/tutor3_5_2.xml line 2 element card
-Element addressBook has extra content: card
+RNG validity error: file ./test/relaxng/tutor3_5_2.xml line 2 element email
+Expecting element name, got email
+RNG validity error: file ./test/relaxng/tutor3_5_2.xml line 2 element email
+Element card failed to validate content
diff --git a/result/relaxng/tutor9_5_2.err b/result/relaxng/tutor9_5_2.err
index 650ca98..ede3b45 100644
--- a/result/relaxng/tutor9_5_2.err
+++ b/result/relaxng/tutor9_5_2.err
@@ -1,2 +1,4 @@
 RNG validity error: file ./test/relaxng/tutor9_5_2.xml line 2 element card
-Element addressBook has extra content: card
+Invalid sequence in interleave
+RNG validity error: file ./test/relaxng/tutor9_5_2.xml line 2 element card
+Element card failed to validate attributes
diff --git a/result/relaxng/tutor9_5_3.err b/result/relaxng/tutor9_5_3.err
index eee06c7..4566bcc 100644
--- a/result/relaxng/tutor9_5_3.err
+++ b/result/relaxng/tutor9_5_3.err
@@ -1,2 +1,2 @@
 RNG validity error: file ./test/relaxng/tutor9_5_3.xml line 2 element card
-Element addressBook has extra content: card
+Invalid attribute error for element card
diff --git a/result/relaxng/tutor9_6_2.err b/result/relaxng/tutor9_6_2.err
index 259cb07..1a10f1b 100644
--- a/result/relaxng/tutor9_6_2.err
+++ b/result/relaxng/tutor9_6_2.err
@@ -1,2 +1,2 @@
 RNG validity error: file ./test/relaxng/tutor9_6_2.xml line 2 element card
-Element addressBook has extra content: card
+Element card failed to validate attributes
diff --git a/result/relaxng/tutor9_6_3.err b/result/relaxng/tutor9_6_3.err
index 2157e52..e92c5f1 100644
--- a/result/relaxng/tutor9_6_3.err
+++ b/result/relaxng/tutor9_6_3.err
@@ -1,2 +1,2 @@
 RNG validity error: file ./test/relaxng/tutor9_6_3.xml line 2 element card
-Element addressBook has extra content: card
+Invalid attribute error for element card