diff options
-rw-r--r-- | doc/reference.html | 38 | ||||
-rw-r--r-- | lib/expat.h | 7 | ||||
-rw-r--r-- | lib/xmlparse.c | 21 | ||||
-rwxr-xr-x | xmlwf/xmlwf.c | 14 |
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")); } } |