summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfdrake <fdrake>2002-09-05 01:48:24 +0000
committerfdrake <fdrake>2002-09-05 01:48:24 +0000
commit605ace7791f9965f4eb3cb42d297fc26043ec6a5 (patch)
treea9dd22b77a9e6c2b5a2b6ebdb352a6d888ee196b
parentc582f9d5203f649f7d46e9bc9562d2968a09e9df (diff)
downloadlibexpat-605ace7791f9965f4eb3cb42d297fc26043ec6a5.tar.gz
Elaborate the XML_GetFeatureList() API a bit, and add additional info
that may be needed by a hughly flexible client. (Or at least used to check that the Expat that it links to matches client expectations.)
-rw-r--r--doc/reference.html38
-rw-r--r--lib/expat.h7
-rw-r--r--lib/xmlparse.c21
-rwxr-xr-xxmlwf/xmlwf.c14
4 files changed, 61 insertions, 19 deletions
diff --git a/doc/reference.html b/doc/reference.html
index 1d422c7..fda752f 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -1712,12 +1712,17 @@ enum XML_FeatureEnum {
XML_FEATURE_END = 0,
XML_FEATURE_UNICODE,
XML_FEATURE_UNICODE_WCHAR_T,
- XML_FEATURE_DTD
+ XML_FEATURE_DTD,
+ XML_FEATURE_CONTEXT_BYTES,
+ XML_FEATURE_MIN_SIZE,
+ XML_FEATURE_SIZEOF_XML_CHAR,
+ XML_FEATURE_SIZEOF_XML_LCHAR
};
typedef struct {
enum XML_FeatureEnum feature;
XML_LChar *name;
+ long int value;
} XML_Feature;
</pre>
<div class="fcndef">
@@ -1730,12 +1735,31 @@ check these features to do so at runtime.</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>
+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_FEATURE_SIZEOF_XML_CHAR</code> and
+<code>XML_FEATURE_SIZEOF_XML_LCHAR</code> will be located at the
+beginning of the list, followed by <code>XML_FEATURE_UNICODE</code>
+and <code>XML_FEATURE_UNICODE_WCHAR_T</code>, if they are present at
+all.</p>
+
+<p>Some features have an associated value. If there isn't an
+associated value, the <code>value</code> field is set to 0. At this
+time, the following features have been defined to have values:</p>
+
+<dl>
+ <dt><code>XML_FEATURE_SIZEOF_XML_CHAR</code></dt>
+ <dd>The number of bytes occupied by one <code>XML_Char</code>
+ character.</dd>
+ <dt><code>XML_FEATURE_SIZEOF_XML_LCHAR</code></dt>
+ <dd>The number of bytes occupied by one <code>XML_LChar</code>
+ character.</dd>
+ <dt><code>XML_FEATURE_CONTEXT_BYTES</code></dt>
+ <dd>The maximum number of characters of context which can be
+ reported by <code><a href= "#XML_GetInputContext"
+ >XML_GetInputContext</a></code>.</dd>
+</dl>
</div>
<hr />
diff --git a/lib/expat.h b/lib/expat.h
index 63c0852..d69211e 100644
--- a/lib/expat.h
+++ b/lib/expat.h
@@ -875,13 +875,18 @@ enum XML_FeatureEnum {
XML_FEATURE_END = 0,
XML_FEATURE_UNICODE,
XML_FEATURE_UNICODE_WCHAR_T,
- XML_FEATURE_DTD
+ XML_FEATURE_DTD,
+ XML_FEATURE_CONTEXT_BYTES,
+ XML_FEATURE_MIN_SIZE,
+ XML_FEATURE_SIZEOF_XML_CHAR,
+ XML_FEATURE_SIZEOF_XML_LCHAR
/* Additional features must be added to the end of this enum. */
};
typedef struct {
enum XML_FeatureEnum feature;
XML_LChar *name;
+ long int value;
} XML_Feature;
XMLPARSEAPI(const XML_Feature *)
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
index db15eae..0488f41 100644
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -1607,19 +1607,30 @@ XML_ExpatVersionInfo(void)
const XML_Feature *
XML_GetFeatureList(void)
{
- static const XML_Feature features[] = {
+ static XML_Feature features[] = {
+ {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)")},
+ {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)")},
#ifdef XML_UNICODE
- {XML_FEATURE_UNICODE, XML_L("XML_UNICODE")},
+ {XML_FEATURE_UNICODE, XML_L("XML_UNICODE")},
#endif
#ifdef XML_UNICODE_WCHAR_T
- {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T")},
+ {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T")},
#endif
#ifdef XML_DTD
- {XML_FEATURE_DTD, XML_L("XML_DTD")},
+ {XML_FEATURE_DTD, XML_L("XML_DTD")},
#endif
- {XML_FEATURE_END, NULL}
+#ifdef XML_CONTEXT_BYTES
+ {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"),
+ XML_CONTEXT_BYTES},
+#endif
+#ifdef XML_MIN_SIZE
+ {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE")},
+#endif
+ {XML_FEATURE_END, NULL}
};
+ features[0].value = sizeof(XML_Char);
+ features[1].value = sizeof(XML_LChar);
return features;
}
diff --git a/xmlwf/xmlwf.c b/xmlwf/xmlwf.c
index 34149c3..8a8056e 100755
--- a/xmlwf/xmlwf.c
+++ b/xmlwf/xmlwf.c
@@ -609,17 +609,19 @@ showVersion(XML_Char *prog)
prog = s + 1;
++s;
}
- ftprintf(stdout, T("%s using %s"), prog, XML_ExpatVersion());
- if (features == NULL || features[0].feature == XML_FEATURE_END)
- ftprintf(stdout, T("\n"));
- else {
+ ftprintf(stdout, T("%s using %s\n"), prog, XML_ExpatVersion());
+ if (features != NULL && features[0].feature != XML_FEATURE_END) {
int i = 1;
- ftprintf(stdout, T(" (%s"), features[0].name);
+ ftprintf(stdout, T("%s"), features[0].name);
+ if (features[0].value)
+ ftprintf(stdout, T("=%ld"), features[0].value);
while (features[i].feature != XML_FEATURE_END) {
ftprintf(stdout, T(", %s"), features[i].name);
+ if (features[i].value)
+ ftprintf(stdout, T("=%ld"), features[i].value);
++i;
}
- ftprintf(stdout, T(")\n"));
+ ftprintf(stdout, T("\n"));
}
}