further enhancement, now all compilation warnings have been fixed. added

* gentest.py, testapi.c: further enhancement, now all
  compilation warnings have been fixed.
* xmlschemastypes.c: added NULL check for one function
diff --git a/ChangeLog b/ChangeLog
index eec7925..fd095c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Nov 14 22:23:18 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+	* gentest.py, testapi.c: further enhancement, now all
+	  compilation warnings have been fixed.
+	* xmlschemastypes.c: added NULL check for one function
+
 Fri Nov 12 23:58:14 HKT 2004 William Brack <wbrack@mmm.com.hk>
 
 	* xpath.c: trivial change (changed CHECK_CONTEXT to CHECK_CTXT
diff --git a/gentest.py b/gentest.py
index 5473a8d..b789133 100755
--- a/gentest.py
+++ b/gentest.py
@@ -12,7 +12,7 @@
     sys.exit(0)
 
 #
-# Modules we don't want skip in API test
+# Modules we want to skip in API test
 #
 skipped_modules = [ "SAX", "xlink", "threads", "globals",
   "xmlmemory", "xmlversion", "xmlexports",
@@ -96,7 +96,7 @@
 }
 
 #
-# Some function really need to be skipped for the tests.
+# Some functions really need to be skipped for the tests.
 #
 skipped_functions = [
 # block on I/O
@@ -156,7 +156,7 @@
 ]
 
 #
-# Those functions have side effect on the global state
+# These functions have side effects on the global state
 # and hence generate errors on memory allocation tests
 #
 skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias",
@@ -331,15 +331,15 @@
         if function == 'xmlIOHTTPOpenW':
 	    return('xmlNanoHTTPCtxtPtr')
 	if string.find(name, "data") != -1:
-	    return('userdata');
+	    return('userdata')
 	if string.find(name, "user") != -1:
-	    return('userdata');
+	    return('userdata')
     if res == 'xmlDoc_ptr':
-        res = 'xmlDocPtr';
+        res = 'xmlDocPtr'
     if res == 'xmlNode_ptr':
-        res = 'xmlNodePtr';
+        res = 'xmlNodePtr'
     if res == 'xmlDict_ptr':
-        res = 'xmlDictPtr';
+        res = 'xmlDictPtr'
     if res == 'xmlNodePtr' and pos != 0:
         if (function == 'xmlAddChild' and pos == 2) or \
 	   (function == 'xmlAddChildList' and pos == 2) or \
@@ -351,7 +351,7 @@
 	   (function == 'xmlAddPrevSibling' and pos == 2):
 	    return('xmlNodePtr_in');
     if res == 'const xmlBufferPtr':
-        res = 'xmlBufferPtr';
+        res = 'xmlBufferPtr'
     if res == 'xmlChar_ptr' and name == 'name' and \
        string.find(function, "EatName") != -1:
         return('eaten_name')
@@ -370,7 +370,7 @@
     if res == 'int' and name == 'options':
         if module == 'parser' or module == 'xmlreader':
 	    res = 'parseroptions'
-        
+
     return res
 
 known_param_types = []
@@ -474,17 +474,46 @@
 ctxt = doc.xpathNewContext()
 
 #
+# Generate a list of all function parameters and select only
+# those used in the api tests
+#
+argtypes = {}
+args = ctxt.xpathEval("/api/symbols/function/arg")
+for arg in args:
+    mod = arg.xpathEval('string(../@file)')
+    func = arg.xpathEval('string(../@name)')
+    if (mod not in skipped_modules) and (func not in skipped_functions):
+	type = arg.xpathEval('string(@type)')
+	if not argtypes.has_key(type):
+	    argtypes[type] = func
+
+# similarly for return types
+rettypes = {}
+rets = ctxt.xpathEval("/api/symbols/function/return")
+for ret in rets:
+    mod = ret.xpathEval('string(../@file)')
+    func = ret.xpathEval('string(../@name)')
+    if (mod not in skipped_modules) and (func not in skipped_functions):
+        type = ret.xpathEval('string(@type)')
+	if not rettypes.has_key(type):
+	    rettypes[type] = func
+
+#
 # Generate constructors and return type handling for all enums
+# which are used as function parameters
 #
 enums = ctxt.xpathEval("/api/symbols/typedef[@type='enum']")
 for enum in enums:
-    name = enum.xpathEval('string(@name)')
-    if name == None:
-        continue;
     module = enum.xpathEval('string(@file)')
+    name = enum.xpathEval('string(@name)')
+    #
+    # Skip any enums which are not in our filtered lists
+    #
+    if (name == None) or ((name not in argtypes) and (name not in rettypes)):
+        continue;
     define = 0
 
-    if is_known_param_type(name, name) == 0:
+    if argtypes.has_key(name) and is_known_param_type(name, name) == 0:
 	values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
 	i = 0
 	vals = []
@@ -497,7 +526,7 @@
 		break;
 	    vals.append(vname)
 	if vals == []:
-	    print "Didn't found any value for enum %s" % (name)
+	    print "Didn't find any value for enum %s" % (name)
 	    continue
 	if modules_defines.has_key(module):
 	    test.write("#ifdef %s\n" % (modules_defines[module]))
@@ -511,19 +540,21 @@
 	    i = i + 1
 	test.write("""    return(0);
 }
-""");
+
+static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
+}
+
+""" % (name, name));
 	known_param_types.append(name)
 
-    if is_known_return_type(name) == 0:
+    if (is_known_return_type(name) == 0) and (name in rettypes):
 	if define == 0 and modules_defines.has_key(module):
 	    test.write("#ifdef %s\n" % (modules_defines[module]))
 	    define = 1
-        test.write("""static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_%s(%s val ATTRIBUTE_UNUSED) {
+        test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) {
 }
 
-""" % (name, name, name, name))
+""" % (name, name))
 	known_return_types.append(name)
     if define == 1:
         test.write("#endif\n\n")
diff --git a/testapi.c b/testapi.c
index c5e7b02..c5773ae 100644
--- a/testapi.c
+++ b/testapi.c
@@ -692,6 +692,8 @@
 }
 static void desret_long(long val ATTRIBUTE_UNUSED) {
 }
+static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
+}
 static void desret_double(double val ATTRIBUTE_UNUSED) {
 }
 static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
@@ -771,7 +773,6 @@
 static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
     xmlFreeParserCtxt(val);
 }
-
 static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
     xmlFreeParserInputBuffer(val);
 }
@@ -892,6 +893,29 @@
 }
 #endif
 
+#define gen_nb_xmlElementContentPtr 1
+static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
+    return(NULL);
+}
+static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
+    if (val != NULL)
+        xmlFreeElementContent(val);
+}
+static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
+    if (val != NULL)
+        xmlFreeElementContent(val);
+}
+
+#define gen_nb_xmlParserNodeInfoSeqPtr 1
+static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
+    return(NULL);
+}
+static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
+}
+
+static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
+}
+
 /************************************************************************
  *									*
  *   WARNING: end of the manually maintained part of the test code	*
@@ -901,75 +925,11 @@
 
 /* CUT HERE: everything below that line is generated */
 #ifdef LIBXML_HTML_ENABLED
-#define gen_nb_htmlParserOption 4
-static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(HTML_PARSE_NOBLANKS);
-    if (no == 2) return(HTML_PARSE_NOERROR);
-    if (no == 3) return(HTML_PARSE_NONET);
-    if (no == 4) return(HTML_PARSE_NOWARNING);
-    return(0);
-}
-static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_HTML_ENABLED
-#define gen_nb_htmlStatus 4
-static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(HTML_DEPRECATED);
-    if (no == 2) return(HTML_INVALID);
-    if (no == 3) return(HTML_NA);
-    if (no == 4) return(HTML_REQUIRED);
-    return(0);
-}
-static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
 static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
 }
 
 #endif
 
-#define gen_nb_xlinkActuate 3
-static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XLINK_ACTUATE_AUTO);
-    if (no == 2) return(XLINK_ACTUATE_NONE);
-    if (no == 3) return(XLINK_ACTUATE_ONREQUEST);
-    return(0);
-}
-static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) {
-}
-
-#define gen_nb_xlinkShow 4
-static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XLINK_SHOW_EMBED);
-    if (no == 2) return(XLINK_SHOW_NEW);
-    if (no == 3) return(XLINK_SHOW_NONE);
-    if (no == 4) return(XLINK_SHOW_REPLACE);
-    return(0);
-}
-static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) {
-}
-
-#define gen_nb_xlinkType 4
-static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XLINK_TYPE_EXTENDED);
-    if (no == 2) return(XLINK_TYPE_EXTENDED_SET);
-    if (no == 3) return(XLINK_TYPE_NONE);
-    if (no == 4) return(XLINK_TYPE_SIMPLE);
-    return(0);
-}
-static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) {
-}
-
 #define gen_nb_xmlAttributeDefault 4
 static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
     if (no == 1) return(XML_ATTRIBUTE_FIXED);
@@ -978,10 +938,9 @@
     if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
     return(0);
 }
+
 static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
-static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) {
-}
 
 #define gen_nb_xmlAttributeType 4
 static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
@@ -991,10 +950,9 @@
     if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
     return(0);
 }
+
 static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
-static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) {
-}
 
 #define gen_nb_xmlBufferAllocationScheme 3
 static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
@@ -1003,8 +961,10 @@
     if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
     return(0);
 }
+
 static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
+
 static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
 }
 
@@ -1017,8 +977,10 @@
     if (no == 4) return(XML_CATA_ALLOW_NONE);
     return(0);
 }
+
 static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
+
 static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
 }
 
@@ -1032,26 +994,15 @@
     if (no == 3) return(XML_CATA_PREFER_SYSTEM);
     return(0);
 }
+
 static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
+
 static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
 }
 
 #endif
 
-#define gen_nb_xmlElementContentOccur 4
-static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_ELEMENT_CONTENT_MULT);
-    if (no == 2) return(XML_ELEMENT_CONTENT_ONCE);
-    if (no == 3) return(XML_ELEMENT_CONTENT_OPT);
-    if (no == 4) return(XML_ELEMENT_CONTENT_PLUS);
-    return(0);
-}
-static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) {
-}
-
 #define gen_nb_xmlElementContentType 4
 static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
     if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
@@ -1060,22 +1011,8 @@
     if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
     return(0);
 }
-static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) {
-}
 
-#define gen_nb_xmlElementType 4
-static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_ATTRIBUTE_DECL);
-    if (no == 2) return(XML_ATTRIBUTE_NODE);
-    if (no == 3) return(XML_CDATA_SECTION_NODE);
-    if (no == 4) return(XML_COMMENT_NODE);
-    return(0);
-}
-static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) {
+static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
 
 #define gen_nb_xmlElementTypeVal 4
@@ -1086,213 +1023,13 @@
     if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
     return(0);
 }
+
 static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
-static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) {
-}
 
-#define gen_nb_xmlEntityType 4
-static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY);
-    if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY);
-    if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY);
-    if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY);
-    return(0);
-}
-static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) {
-}
-
-#define gen_nb_xmlErrorDomain 4
-static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_FROM_C14N);
-    if (no == 2) return(XML_FROM_CATALOG);
-    if (no == 3) return(XML_FROM_CHECK);
-    if (no == 4) return(XML_FROM_DATATYPE);
-    return(0);
-}
-static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) {
-}
-
-#define gen_nb_xmlErrorLevel 4
-static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_ERR_ERROR);
-    if (no == 2) return(XML_ERR_FATAL);
-    if (no == 3) return(XML_ERR_NONE);
-    if (no == 4) return(XML_ERR_WARNING);
-    return(0);
-}
-static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) {
-}
-
-#define gen_nb_xmlParserErrors 4
-static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_C14N_CREATE_CTXT);
-    if (no == 2) return(XML_C14N_CREATE_STACK);
-    if (no == 3) return(XML_C14N_INVALID_NODE);
-    if (no == 4) return(XML_C14N_REQUIRES_UTF8);
-    return(0);
-}
-static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
 static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
 }
 
-#define gen_nb_xmlParserInputState 4
-static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE);
-    if (no == 2) return(XML_PARSER_CDATA_SECTION);
-    if (no == 3) return(XML_PARSER_COMMENT);
-    if (no == 4) return(XML_PARSER_CONTENT);
-    return(0);
-}
-static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) {
-}
-
-#define gen_nb_xmlParserMode 4
-static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_PARSE_DOM);
-    if (no == 2) return(XML_PARSE_PUSH_DOM);
-    if (no == 3) return(XML_PARSE_PUSH_SAX);
-    if (no == 4) return(XML_PARSE_READER);
-    return(0);
-}
-static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) {
-}
-
-#define gen_nb_xmlParserOption 4
-static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_PARSE_DTDATTR);
-    if (no == 2) return(XML_PARSE_DTDLOAD);
-    if (no == 3) return(XML_PARSE_DTDVALID);
-    if (no == 4) return(XML_PARSE_NOBLANKS);
-    return(0);
-}
-static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) {
-}
-
-#ifdef LIBXML_READER_ENABLED
-#define gen_nb_xmlParserProperties 4
-static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_PARSER_DEFAULTATTRS);
-    if (no == 2) return(XML_PARSER_LOADDTD);
-    if (no == 3) return(XML_PARSER_SUBST_ENTITIES);
-    if (no == 4) return(XML_PARSER_VALIDATE);
-    return(0);
-}
-static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_READER_ENABLED
-#define gen_nb_xmlParserSeverities 4
-static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_PARSER_SEVERITY_ERROR);
-    if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR);
-    if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING);
-    if (no == 4) return(XML_PARSER_SEVERITY_WARNING);
-    return(0);
-}
-static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_READER_ENABLED
-#define gen_nb_xmlReaderTypes 4
-static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_READER_TYPE_ATTRIBUTE);
-    if (no == 2) return(XML_READER_TYPE_CDATA);
-    if (no == 3) return(XML_READER_TYPE_COMMENT);
-    if (no == 4) return(XML_READER_TYPE_DOCUMENT);
-    return(0);
-}
-static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-#define gen_nb_xmlRelaxNGParserFlag 3
-static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_RELAXNGP_CRNG);
-    if (no == 2) return(XML_RELAXNGP_FREE_DOC);
-    if (no == 3) return(XML_RELAXNGP_NONE);
-    return(0);
-}
-static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-#define gen_nb_xmlRelaxNGValidErr 4
-static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS);
-    if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME);
-    if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS);
-    if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID);
-    return(0);
-}
-static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-#define gen_nb_xmlSchemaContentType 4
-static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_SCHEMA_CONTENT_ANY);
-    if (no == 2) return(XML_SCHEMA_CONTENT_BASIC);
-    if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS);
-    if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY);
-    return(0);
-}
-static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-#define gen_nb_xmlSchemaTypeType 4
-static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION);
-    if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS);
-    if (no == 3) return(XML_SCHEMA_FACET_LENGTH);
-    if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE);
-    return(0);
-}
-static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
 #ifdef LIBXML_SCHEMAS_ENABLED
 #define gen_nb_xmlSchemaValType 4
 static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
@@ -1302,87 +1039,9 @@
     if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
     return(0);
 }
+
 static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
 }
-static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-#define gen_nb_xmlSchemaValidError 4
-static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_SCHEMAS_ERR_);
-    if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID);
-    if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN);
-    if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT);
-    return(0);
-}
-static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_SCHEMAS_ENABLED
-#define gen_nb_xmlSchemaValidOption 1
-static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE);
-    return(0);
-}
-static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_READER_ENABLED
-#define gen_nb_xmlTextReaderMode 4
-static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XML_TEXTREADER_MODE_CLOSED);
-    if (no == 2) return(XML_TEXTREADER_MODE_EOF);
-    if (no == 3) return(XML_TEXTREADER_MODE_ERROR);
-    if (no == 4) return(XML_TEXTREADER_MODE_INITIAL);
-    return(0);
-}
-static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_XPATH_ENABLED
-#define gen_nb_xmlXPathError 4
-static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XPATH_ENCODING_ERROR);
-    if (no == 2) return(XPATH_EXPRESSION_OK);
-    if (no == 3) return(XPATH_EXPR_ERROR);
-    if (no == 4) return(XPATH_INVALID_ARITY);
-    return(0);
-}
-static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) {
-}
-
-#endif
-
-#ifdef LIBXML_XPATH_ENABLED
-#define gen_nb_xmlXPathObjectType 4
-static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) {
-    if (no == 1) return(XPATH_BOOLEAN);
-    if (no == 2) return(XPATH_LOCATIONSET);
-    if (no == 3) return(XPATH_NODESET);
-    if (no == 4) return(XPATH_NUMBER);
-    return(0);
-}
-static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) {
-}
 
 #endif
 
@@ -4156,13 +3815,6 @@
 }
 
 
-#define gen_nb_xmlElementContentPtr 1
-static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-    return(NULL);
-}
-static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-
 static int
 test_xmlSAX2ElementDecl(void) {
     int test_ret = 0;
@@ -12835,13 +12487,6 @@
 }
 
 
-#define gen_nb_xmlParserNodeInfoSeqPtr 1
-static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-    return(NULL);
-}
-static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
-}
-
 static int
 test_xmlClearNodeInfoSeq(void) {
     int test_ret = 0;
@@ -14446,8 +14091,37 @@
 test_xmlParserFindNodeInfo(void) {
     int test_ret = 0;
 
+    int mem_base;
+    const xmlParserNodeInfo * ret_val;
+    xmlParserCtxtPtr ctx; /* an XML parser context */
+    int n_ctx;
+    xmlNodePtr node; /* an XML node within the tree */
+    int n_node;
 
-    /* missing type support */
+    for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
+    for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
+        mem_base = xmlMemBlocks();
+        ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
+        node = gen_const_xmlNodePtr(n_node, 1);
+
+        ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
+        desret_const_xmlParserNodeInfo_ptr(ret_val);
+        call_tests++;
+        des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
+        des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in xmlParserFindNodeInfo",
+	           xmlMemBlocks() - mem_base);
+	    test_ret++;
+            printf(" %d", n_ctx);
+            printf(" %d", n_node);
+            printf("\n");
+        }
+    }
+    }
+    function_tests++;
+
     return(test_ret);
 }
 
@@ -14463,8 +14137,37 @@
 test_xmlParserFindNodeInfoIndex(void) {
     int test_ret = 0;
 
+    int mem_base;
+    unsigned long ret_val;
+    xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
+    int n_seq;
+    xmlNodePtr node; /* an XML node pointer */
+    int n_node;
 
-    /* missing type support */
+    for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
+    for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
+        mem_base = xmlMemBlocks();
+        seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
+        node = gen_const_xmlNodePtr(n_node, 1);
+
+        ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
+        desret_unsigned_long(ret_val);
+        call_tests++;
+        des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
+        des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
+	           xmlMemBlocks() - mem_base);
+	    test_ret++;
+            printf(" %d", n_seq);
+            printf(" %d", n_node);
+            printf("\n");
+        }
+    }
+    }
+    function_tests++;
+
     return(test_ret);
 }
 
@@ -15495,7 +15198,7 @@
 test_parser(void) {
     int test_ret = 0;
 
-    if (quiet == 0) printf("Testing parser : 58 of 69 functions ...\n");
+    if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
     test_ret += test_xmlByteConsumed();
     test_ret += test_xmlClearNodeInfoSeq();
     test_ret += test_xmlClearParserCtxt();
@@ -23835,8 +23538,30 @@
 test_xmlCopyElementContent(void) {
     int test_ret = 0;
 
+    int mem_base;
+    xmlElementContentPtr ret_val;
+    xmlElementContentPtr cur; /* An element content pointer. */
+    int n_cur;
 
-    /* missing type support */
+    for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
+        mem_base = xmlMemBlocks();
+        cur = gen_xmlElementContentPtr(n_cur, 0);
+
+        ret_val = xmlCopyElementContent(cur);
+        desret_xmlElementContentPtr(ret_val);
+        call_tests++;
+        des_xmlElementContentPtr(n_cur, cur, 0);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in xmlCopyElementContent",
+	           xmlMemBlocks() - mem_base);
+	    test_ret++;
+            printf(" %d", n_cur);
+            printf("\n");
+        }
+    }
+    function_tests++;
+
     return(test_ret);
 }
 
@@ -24528,8 +24253,37 @@
 test_xmlNewElementContent(void) {
     int test_ret = 0;
 
+    int mem_base;
+    xmlElementContentPtr ret_val;
+    xmlChar * name; /* the subelement name or NULL */
+    int n_name;
+    xmlElementContentType type; /* the type of element content decl */
+    int n_type;
 
-    /* missing type support */
+    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
+    for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
+        mem_base = xmlMemBlocks();
+        name = gen_const_xmlChar_ptr(n_name, 0);
+        type = gen_xmlElementContentType(n_type, 1);
+
+        ret_val = xmlNewElementContent((const xmlChar *)name, type);
+        desret_xmlElementContentPtr(ret_val);
+        call_tests++;
+        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
+        des_xmlElementContentType(n_type, type, 1);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in xmlNewElementContent",
+	           xmlMemBlocks() - mem_base);
+	    test_ret++;
+            printf(" %d", n_name);
+            printf(" %d", n_type);
+            printf("\n");
+        }
+    }
+    }
+    function_tests++;
+
     return(test_ret);
 }
 
@@ -25963,7 +25717,7 @@
 test_valid(void) {
     int test_ret = 0;
 
-    if (quiet == 0) printf("Testing valid : 46 of 67 functions ...\n");
+    if (quiet == 0) printf("Testing valid : 48 of 67 functions ...\n");
     test_ret += test_xmlAddAttributeDecl();
     test_ret += test_xmlAddElementDecl();
     test_ret += test_xmlAddID();
@@ -32466,8 +32220,32 @@
 test_xmlSchemaGetFacetValueAsULong(void) {
     int test_ret = 0;
 
+#ifdef LIBXML_SCHEMAS_ENABLED
+    int mem_base;
+    unsigned long ret_val;
+    xmlSchemaFacetPtr facet; /* an schemas type facet */
+    int n_facet;
 
-    /* missing type support */
+    for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
+        mem_base = xmlMemBlocks();
+        facet = gen_xmlSchemaFacetPtr(n_facet, 0);
+
+        ret_val = xmlSchemaGetFacetValueAsULong(facet);
+        desret_unsigned_long(ret_val);
+        call_tests++;
+        des_xmlSchemaFacetPtr(n_facet, facet, 0);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
+	           xmlMemBlocks() - mem_base);
+	    test_ret++;
+            printf(" %d", n_facet);
+            printf("\n");
+        }
+    }
+    function_tests++;
+#endif
+
     return(test_ret);
 }
 
@@ -32924,7 +32702,7 @@
 test_xmlschemastypes(void) {
     int test_ret = 0;
 
-    if (quiet == 0) printf("Testing xmlschemastypes : 15 of 19 functions ...\n");
+    if (quiet == 0) printf("Testing xmlschemastypes : 16 of 19 functions ...\n");
     test_ret += test_xmlSchemaCheckFacet();
     test_ret += test_xmlSchemaCleanupTypes();
     test_ret += test_xmlSchemaCollapseString();
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 84556b7..4d9be10 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -3814,6 +3814,8 @@
     /*
     * TODO: Check if this is a decimal.
     */
+    if (facet == NULL)
+        return 0;
     return ((unsigned long) facet->val->value.decimal.lo);
 }