[Expat-checkins] expat/lib expat.h,1.38,1.39 xmlparse.c,1.80,1.81

Fred L. Drake fdrake@users.sourceforge.net
Wed, 28 Aug 2002 21:54:06 -0700


Update of /cvsroot/expat/expat/lib
In directory usw-pr-cvs1:/tmp/cvs-serv6368/lib

Modified Files:
	expat.h xmlparse.c 
Log Message:
Revise the XML_GetFeatureList() function signature so that we maintain the
behavior that all strings returned from Expat are affected by the XML_UNICODE
and XML_UNICODE_WCHAR_T feature-test macros, and ensure that an application
that needs to determine what type of character data is returned can do so
with reasonable ease.


Index: expat.h
===================================================================
RCS file: /cvsroot/expat/expat/lib/expat.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- expat.h	27 Aug 2002 22:57:59 -0000	1.38
+++ expat.h	29 Aug 2002 04:54:04 -0000	1.39
@@ -870,7 +870,21 @@
 XMLPARSEAPI(XML_Expat_Version)
 XML_ExpatVersionInfo(void);
 
-XMLPARSEAPI(const char **)
+/* Added in Expat 1.95.5. */
+enum XML_FeatureEnum {
+  XML_FEATURE_END = 0,
+  XML_FEATURE_UNICODE,
+  XML_FEATURE_UNICODE_WCHAR_T,
+  XML_FEATURE_DTD
+  /* Additional features must be added to the end of this enum. */
+};
+
+typedef struct {
+  enum XML_FeatureEnum  feature;
+  XML_Char             *name;
+} XML_Feature;
+
+XMLPARSEAPI(const XML_Feature *)
 XML_GetFeatureList(void);
 
 

Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- xmlparse.c	27 Aug 2002 22:58:25 -0000	1.80
+++ xmlparse.c	29 Aug 2002 04:54:04 -0000	1.81
@@ -1604,21 +1604,22 @@
   return version;
 }
 
-const char **
+const XML_Feature *
 XML_GetFeatureList(void)
 {
-  static const char *features[] = {
-#ifdef XML_DTD
-    "XML_DTD",
-#endif
+  static const XML_Feature features[] = {
 #ifdef XML_UNICODE
-    "XML_UNICODE",
+    {XML_FEATURE_UNICODE,         XML_L("XML_UNICODE")},
 #endif
 #ifdef XML_UNICODE_WCHAR_T
-    "XML_UNICODE_WCHAR_T",
+    {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T")},
 #endif
-    NULL
+#ifdef XML_DTD
+    {XML_FEATURE_DTD,             XML_L("XML_DTD")},
+#endif
+    {XML_FEATURE_END,             NULL}
   };
+
   return features;
 }