summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/reference.html30
-rw-r--r--lib/expat.h16
-rw-r--r--lib/xmlparse.c17
-rwxr-xr-xxmlwf/xmlwf.c10
4 files changed, 53 insertions, 20 deletions
diff --git a/doc/reference.html b/doc/reference.html
index 7d1d009..1cef79b 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -1703,20 +1703,38 @@ particular parts of the Expat API are available.
</div>
<pre class="fcndec" id="XML_GetFeatureList">
-const char **
+const XML_Feature *
XML_GetFeatureList();
</pre>
+<pre class="signature">
+enum XML_FeatureEnum {
+ XML_FEATURE_END = 0,
+ XML_FEATURE_UNICODE,
+ XML_FEATURE_UNICODE_WCHAR_T,
+ XML_FEATURE_DTD
+};
+
+typedef struct {
+ enum XML_FeatureEnum feature;
+ XML_Char *name;
+} XML_Feature;
+</pre>
<div class="fcndef">
-<p>Returns a list of "feature" identifiers that provide details on how
+<p>Returns a list of "feature" records, providing details on how
Expat was configured at compile time. Most applications should not
need to worry about this, but this information is otherwise not
available from Expat. This function allows code that does need to
check these features to do so at runtime.</p>
-<p>The return value is an array of strings, terminated by NULL,
-identifying the feature-test macros Expat was compiled with. Common
-features which may be found in this list include
-<code>"XML_DTD"</code> and <code>"XML_UNICODE"</code>.</p>
+<p>The return value is an array of <code>XML_Feature</code>,
+terminated by a record with a <code>feature</code> of
+<code>XML_FEATURE_END</code> and <code>name</code> of NULL,
+identifying the feature-test macros Expat was compiled with. Since
+an application that requires this kind of information needs to
+determine the type of character the <code>name</code> points to,
+records for the <code>XML_UNICODE</code> and
+<code>XML_UNICODE_WCHAR_T</code> features will be located at the
+beginning of the list, if they are present at all.</p>
</div>
<hr />
diff --git a/lib/expat.h b/lib/expat.h
index ef0180a..5a8054e 100644
--- a/lib/expat.h
+++ b/lib/expat.h
@@ -870,7 +870,21 @@ typedef struct {
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);
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
index 2d6ac3d..2b4251d 100644
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -1604,21 +1604,22 @@ XML_ExpatVersionInfo(void)
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;
}
diff --git a/xmlwf/xmlwf.c b/xmlwf/xmlwf.c
index 36d8f25..34149c3 100755
--- a/xmlwf/xmlwf.c
+++ b/xmlwf/xmlwf.c
@@ -599,7 +599,7 @@ showVersion(XML_Char *prog)
{
XML_Char *s = prog;
XML_Char ch;
- const char **features = XML_GetFeatureList();
+ const XML_Feature *features = XML_GetFeatureList();
while ((ch = *s) != 0) {
if (ch == '/'
#ifdef WIN32
@@ -610,13 +610,13 @@ showVersion(XML_Char *prog)
++s;
}
ftprintf(stdout, T("%s using %s"), prog, XML_ExpatVersion());
- if (features[0] == NULL)
+ if (features == NULL || features[0].feature == XML_FEATURE_END)
ftprintf(stdout, T("\n"));
else {
int i = 1;
- ftprintf(stdout, T(" (%s"), features[0]);
- while (features[i] != NULL) {
- ftprintf(stdout, T(", %s"), features[i]);
+ ftprintf(stdout, T(" (%s"), features[0].name);
+ while (features[i].feature != XML_FEATURE_END) {
+ ftprintf(stdout, T(", %s"), features[i].name);
++i;
}
ftprintf(stdout, T(")\n"));