Home | History | Annotate | Download | only in src
      1 /*
      2  * testapi.c: libxml2 API tester program.
      3  *
      4  * Automatically generated by gentest.py from libxml2-api.xml
      5  *
      6  * See Copyright for the status of this software.
      7  *
      8  * daniel (at) veillard.com
      9  */
     10 
     11 #ifdef HAVE_CONFIG_H
     12 #include "libxml.h"
     13 #else
     14 #include <stdio.h>
     15 #endif
     16 
     17 #include <stdlib.h> /* for putenv() */
     18 #include <string.h>
     19 #include <libxml/xmlerror.h>
     20 #include <libxml/relaxng.h>
     21 
     22 #if defined(_WIN32) && !defined(__CYGWIN__)
     23 #define snprintf _snprintf
     24 #endif
     25 
     26 static int testlibxml2(void);
     27 static int test_module(const char *module);
     28 
     29 static int generic_errors = 0;
     30 static int call_tests = 0;
     31 static int function_tests = 0;
     32 
     33 static xmlChar chartab[1024];
     34 static int inttab[1024];
     35 static unsigned long longtab[1024];
     36 
     37 static xmlDocPtr api_doc = NULL;
     38 static xmlDtdPtr api_dtd = NULL;
     39 static xmlNodePtr api_root = NULL;
     40 static xmlAttrPtr api_attr = NULL;
     41 static xmlNsPtr api_ns = NULL;
     42 
     43 static void
     44 structured_errors(void *userData ATTRIBUTE_UNUSED,
     45                   xmlErrorPtr error ATTRIBUTE_UNUSED) {
     46     generic_errors++;
     47 }
     48 
     49 static void
     50 free_api_doc(void) {
     51     xmlFreeDoc(api_doc);
     52     api_doc = NULL;
     53     api_dtd = NULL;
     54     api_root = NULL;
     55     api_attr = NULL;
     56     api_ns = NULL;
     57 }
     58 
     59 static xmlDocPtr
     60 get_api_doc(void) {
     61     if (api_doc == NULL) {
     62         api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
     63 	api_root = NULL;
     64 	api_attr = NULL;
     65     }
     66     return(api_doc);
     67 }
     68 
     69 static xmlDtdPtr
     70 get_api_dtd(void) {
     71     if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
     72         get_api_doc();
     73 	if ((api_doc != NULL) && (api_doc->children != NULL) &&
     74 	    (api_doc->children->type == XML_DTD_NODE))
     75 	    api_dtd = (xmlDtdPtr) api_doc->children;
     76     }
     77     return(api_dtd);
     78 }
     79 
     80 static xmlNodePtr
     81 get_api_root(void) {
     82     if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
     83         get_api_doc();
     84 	if ((api_doc != NULL) && (api_doc->children != NULL) &&
     85 	    (api_doc->children->next != NULL) &&
     86 	    (api_doc->children->next->type == XML_ELEMENT_NODE))
     87 	    api_root = api_doc->children->next;
     88     }
     89     return(api_root);
     90 }
     91 
     92 static xmlNsPtr
     93 get_api_ns(void) {
     94     get_api_root();
     95     if (api_root != NULL)
     96         api_ns = api_root->nsDef;
     97     return(api_ns);
     98 }
     99 
    100 static xmlAttrPtr
    101 get_api_attr(void) {
    102 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
    103     static int nr = 0;
    104     xmlChar name[20];
    105 #endif
    106 
    107     if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
    108         get_api_root();
    109     }
    110     if (api_root == NULL)
    111         return(NULL);
    112     if (api_root->properties != NULL) {
    113         api_attr = api_root->properties;
    114         return(api_root->properties);
    115     }
    116     api_attr = NULL;
    117 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
    118     snprintf((char *) name, 20, "foo%d", nr++);
    119     api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
    120 #endif
    121     return(api_attr);
    122 }
    123 
    124 static int quiet = 0;
    125 
    126 int main(int argc, char **argv) {
    127     int ret;
    128     int blocks, mem;
    129 
    130     /* access to the proxy can slow up regression tests a lot */
    131     putenv((char *) "http_proxy=");
    132 
    133     memset(chartab, 0, sizeof(chartab));
    134     strncpy((char *) chartab, "  chartab\n", 20);
    135     memset(inttab, 0, sizeof(inttab));
    136     memset(longtab, 0, sizeof(longtab));
    137 
    138     xmlInitParser();
    139 #ifdef LIBXML_SCHEMAS_ENABLED
    140     xmlRelaxNGInitTypes();
    141 #endif
    142 
    143     LIBXML_TEST_VERSION
    144 
    145     xmlSetStructuredErrorFunc(NULL, structured_errors);
    146 
    147     if (argc >= 2) {
    148         if (!strcmp(argv[1], "-q")) {
    149 	    quiet = 1;
    150 	    if (argc >= 3)
    151 	        ret = test_module(argv[2]);
    152 	    else
    153 		ret = testlibxml2();
    154         } else {
    155 	   ret = test_module(argv[1]);
    156 	}
    157     } else
    158 	ret = testlibxml2();
    159 
    160     xmlCleanupParser();
    161     blocks = xmlMemBlocks();
    162     mem = xmlMemUsed();
    163     if ((blocks != 0) || (mem != 0)) {
    164         printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
    165     }
    166     xmlMemoryDump();
    167 
    168     return (ret != 0);
    169 }
    170 
    171 #include <libxml/HTMLparser.h>
    172 #include <libxml/HTMLtree.h>
    173 #include <libxml/catalog.h>
    174 #include <libxml/chvalid.h>
    175 #include <libxml/dict.h>
    176 #include <libxml/encoding.h>
    177 #include <libxml/entities.h>
    178 #include <libxml/hash.h>
    179 #include <libxml/list.h>
    180 #include <libxml/nanoftp.h>
    181 #include <libxml/nanohttp.h>
    182 #include <libxml/parser.h>
    183 #include <libxml/parserInternals.h>
    184 #include <libxml/pattern.h>
    185 #include <libxml/relaxng.h>
    186 #include <libxml/schemasInternals.h>
    187 #include <libxml/schematron.h>
    188 #include <libxml/tree.h>
    189 #include <libxml/uri.h>
    190 #include <libxml/valid.h>
    191 #include <libxml/xinclude.h>
    192 #include <libxml/xmlIO.h>
    193 #include <libxml/xmlerror.h>
    194 #include <libxml/xmlreader.h>
    195 #include <libxml/xmlsave.h>
    196 #include <libxml/xmlschemas.h>
    197 #include <libxml/xmlschemastypes.h>
    198 #include <libxml/xmlstring.h>
    199 #include <libxml/xmlwriter.h>
    200 #include <libxml/xpath.h>
    201 #include <libxml/xpointer.h>
    202 #include <libxml/debugXML.h>
    203 
    204 /*
    205   We manually define xmlErrMemory because it's normal declaration
    206   is "hidden" by #ifdef IN_LIBXML
    207 */
    208 void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
    209 
    210 /*
    211  We need some "remote" addresses, but want to avoid getting into
    212  name resolution delays, so we use these
    213 */
    214 #define	REMOTE1GOOD	"http://localhost/"
    215 #define	REMOTE1BAD	"http:http://http"
    216 #define	REMOTE2GOOD	"ftp://localhost/foo"
    217 
    218 #define gen_nb_void_ptr 2
    219 
    220 static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    221     return(NULL);
    222 }
    223 static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    224 }
    225 
    226 #if 0
    227 #define gen_nb_const_void_ptr 2
    228 
    229 static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
    230     if (no == 0) return((const void *) "immutable string");
    231     return(NULL);
    232 }
    233 static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    234 }
    235 #endif
    236 
    237 #define gen_nb_userdata 3
    238 
    239 static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
    240     if (no == 0) return((void *) &call_tests);
    241     if (no == 1) return((void *) -1);
    242     return(NULL);
    243 }
    244 static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    245 }
    246 
    247 
    248 #define gen_nb_int 4
    249 
    250 static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
    251     if (no == 0) return(0);
    252     if (no == 1) return(1);
    253     if (no == 2) return(-1);
    254     if (no == 3) return(122);
    255     return(-1);
    256 }
    257 
    258 static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    259 }
    260 
    261 #define gen_nb_parseroptions 5
    262 
    263 static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
    264     if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
    265     if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
    266     if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
    267     if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
    268     return(XML_PARSE_SAX1);
    269 }
    270 
    271 static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    272 }
    273 
    274 #if 0
    275 #define gen_nb_long 5
    276 
    277 static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
    278     if (no == 0) return(0);
    279     if (no == 1) return(1);
    280     if (no == 2) return(-1);
    281     if (no == 3) return(122);
    282     return(-1);
    283 }
    284 
    285 static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    286 }
    287 #endif
    288 
    289 #define gen_nb_xmlChar 4
    290 
    291 static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
    292     if (no == 0) return('a');
    293     if (no == 1) return(' ');
    294     if (no == 2) return((xmlChar) '');
    295     return(0);
    296 }
    297 
    298 static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    299 }
    300 
    301 #define gen_nb_unsigned_int 3
    302 
    303 static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
    304     if (no == 0) return(0);
    305     if (no == 1) return(1);
    306     if (no == 2) return(122);
    307     return((unsigned int) -1);
    308 }
    309 
    310 static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    311 }
    312 
    313 #define gen_nb_unsigned_long 4
    314 
    315 static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
    316     if (no == 0) return(0);
    317     if (no == 1) return(1);
    318     if (no == 2) return(122);
    319     return((unsigned long) -1);
    320 }
    321 
    322 static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    323 }
    324 
    325 #define gen_nb_double 4
    326 
    327 static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
    328     if (no == 0) return(0);
    329     if (no == 1) return(-1.1);
    330 #if defined(LIBXML_XPATH_ENABLED)
    331     if (no == 2) return(xmlXPathNAN);
    332 #endif
    333     return(-1);
    334 }
    335 
    336 static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    337 }
    338 
    339 #define gen_nb_unsigned_long_ptr 2
    340 
    341 static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
    342     if (no == 0) return(&longtab[nr]);
    343     return(NULL);
    344 }
    345 
    346 static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    347 }
    348 
    349 #define gen_nb_int_ptr 2
    350 
    351 static int *gen_int_ptr(int no, int nr) {
    352     if (no == 0) return(&inttab[nr]);
    353     return(NULL);
    354 }
    355 
    356 static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    357 }
    358 
    359 #define gen_nb_const_char_ptr 4
    360 
    361 static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
    362     if (no == 0) return((char *) "foo");
    363     if (no == 1) return((char *) "<foo/>");
    364     if (no == 2) return((char *) "test/ent2");
    365     return(NULL);
    366 }
    367 static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    368 }
    369 
    370 #define gen_nb_xmlChar_ptr 2
    371 
    372 static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
    373     if (no == 0) return(&chartab[0]);
    374     return(NULL);
    375 }
    376 static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    377 }
    378 
    379 #define gen_nb_FILE_ptr 2
    380 
    381 static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
    382     if (no == 0) return(fopen("test.out", "a+"));
    383     return(NULL);
    384 }
    385 static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
    386     if (val != NULL) fclose(val);
    387 }
    388 
    389 #define gen_nb_debug_FILE_ptr 2
    390 static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    391     return(fopen("test.out", "a+"));
    392 }
    393 static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
    394     if (val != NULL) fclose(val);
    395 }
    396 
    397 #define gen_nb_const_xmlChar_ptr 5
    398 
    399 static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
    400     if (no == 0) return((xmlChar *) "foo");
    401     if (no == 1) return((xmlChar *) "<foo/>");
    402     if (no == 2) return((xmlChar *) "nne");
    403     if (no == 3) return((xmlChar *) " 2ab ");
    404     return(NULL);
    405 }
    406 static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    407 }
    408 
    409 #define gen_nb_filepath 8
    410 
    411 static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
    412     if (no == 0) return("missing.xml");
    413     if (no == 1) return("<foo/>");
    414     if (no == 2) return("test/ent2");
    415     if (no == 3) return("test/valid/REC-xml-19980210.xml");
    416     if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
    417     if (no == 5) return(REMOTE1GOOD);
    418     if (no == 6) return(REMOTE1BAD);
    419     return(NULL);
    420 }
    421 static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    422 }
    423 
    424 #define gen_nb_eaten_name 2
    425 
    426 static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
    427     if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
    428     return(NULL);
    429 }
    430 static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    431 }
    432 
    433 #define gen_nb_fileoutput 6
    434 
    435 static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
    436     if (no == 0) return("/missing.xml");
    437     if (no == 1) return("<foo/>");
    438     if (no == 2) return(REMOTE2GOOD);
    439     if (no == 3) return(REMOTE1GOOD);
    440     if (no == 4) return(REMOTE1BAD);
    441     return(NULL);
    442 }
    443 static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    444 }
    445 
    446 #define gen_nb_xmlParserCtxtPtr 3
    447 static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
    448     if (no == 0) return(xmlNewParserCtxt());
    449     if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
    450     return(NULL);
    451 }
    452 static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
    453     if (val != NULL)
    454         xmlFreeParserCtxt(val);
    455 }
    456 
    457 #define gen_nb_xmlSAXHandlerPtr 2
    458 static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
    459 #ifdef LIBXML_SAX1_ENABLED
    460     if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
    461 #endif
    462     return(NULL);
    463 }
    464 static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    465 }
    466 
    467 #define gen_nb_xmlValidCtxtPtr 2
    468 static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
    469 #ifdef LIBXML_VALID_ENABLED
    470     if (no == 0) return(xmlNewValidCtxt());
    471 #endif
    472     return(NULL);
    473 }
    474 static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
    475 #ifdef LIBXML_VALID_ENABLED
    476     if (val != NULL)
    477         xmlFreeValidCtxt(val);
    478 #endif
    479 }
    480 
    481 #define gen_nb_xmlParserInputBufferPtr 8
    482 
    483 static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
    484     if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
    485     if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
    486     if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
    487     if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
    488     if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
    489     if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE));
    490     if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE));
    491     return(NULL);
    492 }
    493 static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
    494     xmlFreeParserInputBuffer(val);
    495 }
    496 
    497 #define gen_nb_xmlDocPtr 4
    498 static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
    499     if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
    500     if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
    501     if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL, 0));
    502     return(NULL);
    503 }
    504 static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
    505     if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
    506         xmlFreeDoc(val);
    507 }
    508 
    509 #define gen_nb_xmlAttrPtr 2
    510 static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
    511     if (no == 0) return(get_api_attr());
    512     return(NULL);
    513 }
    514 static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    515     if (no == 0) free_api_doc();
    516 }
    517 
    518 #define gen_nb_xmlDictPtr 2
    519 static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
    520     if (no == 0) return(xmlDictCreate());
    521     return(NULL);
    522 }
    523 static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
    524     if (val != NULL)
    525         xmlDictFree(val);
    526 }
    527 
    528 #define gen_nb_xmlNodePtr 3
    529 static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
    530     if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
    531     if (no == 1) return(get_api_root());
    532     return(NULL);
    533 /*     if (no == 2) return((xmlNodePtr) get_api_doc()); */
    534 }
    535 static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
    536     if (no == 1) {
    537         free_api_doc();
    538     } else if (val != NULL) {
    539         xmlUnlinkNode(val);
    540         xmlFreeNode(val);
    541     }
    542 }
    543 
    544 #define gen_nb_xmlDtdPtr 3
    545 static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
    546     if (no == 0)
    547         return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
    548     if (no == 1) return(get_api_dtd());
    549     return(NULL);
    550 }
    551 static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
    552     if (no == 1) free_api_doc();
    553     else if (val != NULL) {
    554         xmlUnlinkNode((xmlNodePtr) val);
    555         xmlFreeNode((xmlNodePtr) val);
    556     }
    557 }
    558 
    559 #define gen_nb_xmlNsPtr 2
    560 static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
    561     if (no == 0) return(get_api_ns());
    562     return(NULL);
    563 }
    564 static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    565     if (no == 0) free_api_doc();
    566 }
    567 
    568 #define gen_nb_xmlNodePtr_in 3
    569 static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
    570     if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
    571     if (no == 0) return(xmlNewText(BAD_CAST "text"));
    572     return(NULL);
    573 }
    574 static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    575 }
    576 
    577 #ifdef LIBXML_WRITER_ENABLED
    578 #define gen_nb_xmlTextWriterPtr 2
    579 static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
    580     if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
    581     return(NULL);
    582 }
    583 static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
    584     if (val != NULL) xmlFreeTextWriter(val);
    585 }
    586 #endif
    587 
    588 #ifdef LIBXML_READER_ENABLED
    589 #define gen_nb_xmlTextReaderPtr 4
    590 static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
    591     if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
    592     if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
    593     if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
    594     return(NULL);
    595 }
    596 static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
    597     if (val != NULL) xmlFreeTextReader(val);
    598 }
    599 #endif
    600 
    601 #define gen_nb_xmlBufferPtr 3
    602 static const char *static_buf_content = "a static buffer";
    603 static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
    604     if (no == 0) return(xmlBufferCreate());
    605     if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13));
    606     return(NULL);
    607 }
    608 static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
    609     if (val != NULL) {
    610         xmlBufferFree(val);
    611     }
    612 }
    613 
    614 #define gen_nb_xmlListPtr 2
    615 static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
    616     if (no == 0) return(xmlListCreate(NULL, NULL));
    617     return(NULL);
    618 }
    619 static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
    620     if (val != NULL) {
    621         xmlListDelete(val);
    622     }
    623 }
    624 
    625 #define gen_nb_xmlHashTablePtr 2
    626 static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
    627     if (no == 0) return(xmlHashCreate(10));
    628     return(NULL);
    629 }
    630 static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
    631     if (val != NULL) {
    632         xmlHashFree(val, NULL);
    633     }
    634 }
    635 
    636 #include <libxml/xpathInternals.h>
    637 
    638 #ifdef LIBXML_XPATH_ENABLED
    639 #define gen_nb_xmlXPathObjectPtr 5
    640 static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
    641     if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
    642     if (no == 1) return(xmlXPathNewFloat(1.1));
    643     if (no == 2) return(xmlXPathNewBoolean(1));
    644     if (no == 3) return(xmlXPathNewNodeSet(NULL));
    645     return(NULL);
    646 }
    647 static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
    648     if (val != NULL) {
    649         xmlXPathFreeObject(val);
    650     }
    651 }
    652 #endif
    653 
    654 #ifdef LIBXML_OUTPUT_ENABLED
    655 #define gen_nb_xmlOutputBufferPtr 2
    656 static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
    657     if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
    658     return(NULL);
    659 }
    660 static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
    661     if (val != NULL) {
    662         xmlOutputBufferClose(val);
    663     }
    664 }
    665 #endif
    666 
    667 #ifdef LIBXML_FTP_ENABLED
    668 #define gen_nb_xmlNanoFTPCtxtPtr 4
    669 static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
    670     if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD));
    671     if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD));
    672     if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
    673     return(NULL);
    674 }
    675 static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
    676     if (val != NULL) {
    677         xmlNanoFTPFreeCtxt(val);
    678     }
    679 }
    680 #endif
    681 
    682 #ifdef LIBXML_HTTP_ENABLED
    683 #define gen_nb_xmlNanoHTTPCtxtPtr 1
    684 static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
    685     if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL));
    686     if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL));
    687     if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL));
    688     return(NULL);
    689 }
    690 static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
    691     if (val != NULL) {
    692 	xmlNanoHTTPClose(val);
    693     }
    694 }
    695 #endif
    696 
    697 #define gen_nb_xmlCharEncoding 4
    698 static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
    699     if (no == 0) return(XML_CHAR_ENCODING_UTF8);
    700     if (no == 1) return(XML_CHAR_ENCODING_NONE);
    701     if (no == 2) return(XML_CHAR_ENCODING_8859_1);
    702     return(XML_CHAR_ENCODING_ERROR);
    703 }
    704 static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    705 }
    706 
    707 #if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
    708 
    709 #define gen_nb_xmlExpCtxtPtr 1
    710 static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    711     return(NULL);
    712 }
    713 static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    714 }
    715 
    716 #define gen_nb_xmlExpNodePtr 1
    717 static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    718     return(NULL);
    719 }
    720 static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    721 }
    722 
    723 #endif
    724 
    725 #if defined(LIBXML_SCHEMAS_ENABLED)
    726 #define gen_nb_xmlSchemaPtr 1
    727 static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    728     return(NULL);
    729 }
    730 static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    731 }
    732 
    733 #define gen_nb_xmlSchemaValidCtxtPtr 1
    734 static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    735     return(NULL);
    736 }
    737 static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    738 }
    739 
    740 #endif /* LIBXML_SCHEMAS_ENABLED */
    741 
    742 #define gen_nb_xmlHashDeallocator 2
    743 static void
    744 test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
    745 }
    746 
    747 static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
    748     if (no == 0) return(test_xmlHashDeallocator);
    749     return(NULL);
    750 }
    751 static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    752 }
    753 
    754 
    755 static void desret_int(int val ATTRIBUTE_UNUSED) {
    756 }
    757 static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
    758 }
    759 static void desret_long(long val ATTRIBUTE_UNUSED) {
    760 }
    761 static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
    762 }
    763 static void desret_double(double val ATTRIBUTE_UNUSED) {
    764 }
    765 static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
    766 }
    767 #if 0
    768 static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
    769 }
    770 #endif
    771 static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
    772 }
    773 static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
    774 }
    775 static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
    776 }
    777 static void desret_xmlChar_ptr(xmlChar *val) {
    778     if (val != NULL)
    779 	xmlFree(val);
    780 }
    781 static void desret_xmlDocPtr(xmlDocPtr val) {
    782     if (val != api_doc)
    783 	xmlFreeDoc(val);
    784 }
    785 static void desret_xmlDictPtr(xmlDictPtr val) {
    786     xmlDictFree(val);
    787 }
    788 #ifdef LIBXML_OUTPUT_ENABLED
    789 static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
    790     xmlOutputBufferClose(val);
    791 }
    792 #endif
    793 #ifdef LIBXML_READER_ENABLED
    794 static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
    795     xmlFreeTextReader(val);
    796 }
    797 #endif
    798 static void desret_xmlNodePtr(xmlNodePtr val) {
    799     if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
    800 	xmlUnlinkNode(val);
    801 	xmlFreeNode(val);
    802     }
    803 }
    804 static void desret_xmlAttrPtr(xmlAttrPtr val) {
    805     if (val != NULL) {
    806 	xmlUnlinkNode((xmlNodePtr) val);
    807 	xmlFreeNode((xmlNodePtr) val);
    808     }
    809 }
    810 static void desret_xmlEntityPtr(xmlEntityPtr val) {
    811     if (val != NULL) {
    812 	xmlUnlinkNode((xmlNodePtr) val);
    813 	xmlFreeNode((xmlNodePtr) val);
    814     }
    815 }
    816 static void desret_xmlElementPtr(xmlElementPtr val) {
    817     if (val != NULL) {
    818 	xmlUnlinkNode((xmlNodePtr) val);
    819     }
    820 }
    821 static void desret_xmlAttributePtr(xmlAttributePtr val) {
    822     if (val != NULL) {
    823 	xmlUnlinkNode((xmlNodePtr) val);
    824     }
    825 }
    826 static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
    827 }
    828 static void desret_xmlDtdPtr(xmlDtdPtr val) {
    829     desret_xmlNodePtr((xmlNodePtr)val);
    830 }
    831 #ifdef LIBXML_XPATH_ENABLED
    832 static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
    833     xmlXPathFreeObject(val);
    834 }
    835 static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
    836     xmlXPathFreeNodeSet(val);
    837 }
    838 #endif
    839 static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
    840     xmlFreeParserCtxt(val);
    841 }
    842 static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
    843     xmlFreeParserInputBuffer(val);
    844 }
    845 static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
    846     xmlFreeInputStream(val);
    847 }
    848 #ifdef LIBXML_WRITER_ENABLED
    849 static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
    850     xmlFreeTextWriter(val);
    851 }
    852 #endif
    853 static void desret_xmlBufferPtr(xmlBufferPtr val) {
    854     xmlBufferFree(val);
    855 }
    856 #ifdef LIBXML_SCHEMAS_ENABLED
    857 static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
    858     xmlSchemaFreeParserCtxt(val);
    859 }
    860 static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
    861 }
    862 static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
    863     xmlRelaxNGFreeParserCtxt(val);
    864 }
    865 #endif
    866 #ifdef LIBXML_HTML_ENABLED
    867 static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
    868 }
    869 #endif
    870 #ifdef LIBXML_HTTP_ENABLED
    871 static void desret_xmlNanoHTTPCtxtPtr(void *val) {
    872     xmlNanoHTTPClose(val);
    873 }
    874 #endif
    875 #ifdef LIBXML_FTP_ENABLED
    876 static void desret_xmlNanoFTPCtxtPtr(void *val) {
    877     xmlNanoFTPClose(val);
    878 }
    879 #endif
    880 /* cut and pasted from autogenerated to avoid troubles */
    881 #define gen_nb_const_xmlChar_ptr_ptr 1
    882 static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    883     return(NULL);
    884 }
    885 static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    886 }
    887 
    888 #define gen_nb_unsigned_char_ptr 1
    889 static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    890     return(NULL);
    891 }
    892 static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    893 }
    894 
    895 #define gen_nb_const_unsigned_char_ptr 1
    896 static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    897     return(NULL);
    898 }
    899 static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    900 }
    901 
    902 #ifdef LIBXML_HTML_ENABLED
    903 #define gen_nb_const_htmlNodePtr 1
    904 static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    905     return(NULL);
    906 }
    907 static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    908 }
    909 #endif
    910 
    911 #ifdef LIBXML_HTML_ENABLED
    912 #define gen_nb_htmlDocPtr 3
    913 static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    914     if (no == 0) return(htmlNewDoc(NULL, NULL));
    915     if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
    916     return(NULL);
    917 }
    918 static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    919     if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
    920         xmlFreeDoc(val);
    921 }
    922 static void desret_htmlDocPtr(htmlDocPtr val) {
    923     if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
    924         xmlFreeDoc(val);
    925 }
    926 #define gen_nb_htmlParserCtxtPtr 3
    927 static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    928     if (no == 0) return(xmlNewParserCtxt());
    929     if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
    930     return(NULL);
    931 }
    932 static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    933     if (val != NULL)
    934         htmlFreeParserCtxt(val);
    935 }
    936 static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
    937     if (val != NULL)
    938         htmlFreeParserCtxt(val);
    939 }
    940 #endif
    941 
    942 #ifdef LIBXML_XPATH_ENABLED
    943 #define gen_nb_xmlNodeSetPtr 1
    944 static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    945     return(NULL);
    946 }
    947 static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    948 }
    949 #endif
    950 
    951 #ifdef LIBXML_DEBUG_ENABLED
    952 #ifdef LIBXML_XPATH_ENABLED
    953 #define gen_nb_xmlShellCtxtPtr 1
    954 static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    955     return(NULL);
    956 }
    957 static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    958 }
    959 #endif
    960 #endif
    961 
    962 #ifdef LIBXML_PATTERN_ENABLED
    963 #define gen_nb_xmlPatternPtr 1
    964 static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    965     return(NULL);
    966 }
    967 static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    968 }
    969 #endif
    970 
    971 #define gen_nb_xmlElementContentPtr 1
    972 static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    973     return(NULL);
    974 }
    975 static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
    976     if (val != NULL)
    977         xmlFreeElementContent(val);
    978 }
    979 static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
    980     if (val != NULL)
    981         xmlFreeElementContent(val);
    982 }
    983 
    984 #define gen_nb_xmlParserNodeInfoSeqPtr 1
    985 static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    986     return(NULL);
    987 }
    988 static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    989 }
    990 
    991 static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
    992 }
    993 
    994 #define gen_nb_void_ptr_ptr 1
    995 static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    996     return(NULL);
    997 }
    998 static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    999 }
   1000 
   1001 /************************************************************************
   1002  *									*
   1003  *   WARNING: end of the manually maintained part of the test code	*
   1004  *            do not remove or alter the CUT HERE line			*
   1005  *									*
   1006  ************************************************************************/
   1007 
   1008 /* CUT HERE: everything below that line is generated */
   1009 #ifdef LIBXML_HTML_ENABLED
   1010 static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
   1011 }
   1012 
   1013 #endif
   1014 
   1015 #define gen_nb_xmlAttributeDefault 4
   1016 static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
   1017     if (no == 1) return(XML_ATTRIBUTE_FIXED);
   1018     if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
   1019     if (no == 3) return(XML_ATTRIBUTE_NONE);
   1020     if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
   1021     return(0);
   1022 }
   1023 
   1024 static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1025 }
   1026 
   1027 #define gen_nb_xmlAttributeType 4
   1028 static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
   1029     if (no == 1) return(XML_ATTRIBUTE_CDATA);
   1030     if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
   1031     if (no == 3) return(XML_ATTRIBUTE_ENTITY);
   1032     if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
   1033     return(0);
   1034 }
   1035 
   1036 static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1037 }
   1038 
   1039 #define gen_nb_xmlBufferAllocationScheme 4
   1040 static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
   1041     if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
   1042     if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
   1043     if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
   1044     if (no == 4) return(XML_BUFFER_ALLOC_IO);
   1045     return(0);
   1046 }
   1047 
   1048 static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1049 }
   1050 
   1051 static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
   1052 }
   1053 
   1054 #ifdef LIBXML_CATALOG_ENABLED
   1055 #define gen_nb_xmlCatalogAllow 4
   1056 static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
   1057     if (no == 1) return(XML_CATA_ALLOW_ALL);
   1058     if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
   1059     if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
   1060     if (no == 4) return(XML_CATA_ALLOW_NONE);
   1061     return(0);
   1062 }
   1063 
   1064 static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1065 }
   1066 
   1067 static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
   1068 }
   1069 
   1070 #endif
   1071 
   1072 #ifdef LIBXML_CATALOG_ENABLED
   1073 #define gen_nb_xmlCatalogPrefer 3
   1074 static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
   1075     if (no == 1) return(XML_CATA_PREFER_NONE);
   1076     if (no == 2) return(XML_CATA_PREFER_PUBLIC);
   1077     if (no == 3) return(XML_CATA_PREFER_SYSTEM);
   1078     return(0);
   1079 }
   1080 
   1081 static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1082 }
   1083 
   1084 static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
   1085 }
   1086 
   1087 #endif
   1088 
   1089 #define gen_nb_xmlElementContentType 4
   1090 static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
   1091     if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
   1092     if (no == 2) return(XML_ELEMENT_CONTENT_OR);
   1093     if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
   1094     if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
   1095     return(0);
   1096 }
   1097 
   1098 static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1099 }
   1100 
   1101 #define gen_nb_xmlElementTypeVal 4
   1102 static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
   1103     if (no == 1) return(XML_ELEMENT_TYPE_ANY);
   1104     if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
   1105     if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
   1106     if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
   1107     return(0);
   1108 }
   1109 
   1110 static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1111 }
   1112 
   1113 #define gen_nb_xmlFeature 4
   1114 static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED) {
   1115     if (no == 1) return(XML_WITH_AUTOMATA);
   1116     if (no == 2) return(XML_WITH_C14N);
   1117     if (no == 3) return(XML_WITH_CATALOG);
   1118     if (no == 4) return(XML_WITH_DEBUG);
   1119     return(0);
   1120 }
   1121 
   1122 static void des_xmlFeature(int no ATTRIBUTE_UNUSED, xmlFeature val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1123 }
   1124 
   1125 static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
   1126 }
   1127 
   1128 #ifdef LIBXML_SCHEMAS_ENABLED
   1129 #define gen_nb_xmlSchemaValType 4
   1130 static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
   1131     if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
   1132     if (no == 2) return(XML_SCHEMAS_ANYTYPE);
   1133     if (no == 3) return(XML_SCHEMAS_ANYURI);
   1134     if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
   1135     return(0);
   1136 }
   1137 
   1138 static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1139 }
   1140 
   1141 static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
   1142 }
   1143 
   1144 #endif
   1145 
   1146 #ifdef LIBXML_SCHEMAS_ENABLED
   1147 #define gen_nb_xmlSchemaWhitespaceValueType 4
   1148 static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) {
   1149     if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
   1150     if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
   1151     if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
   1152     if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
   1153     return(0);
   1154 }
   1155 
   1156 static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1157 }
   1158 
   1159 #endif
   1160 
   1161 #include <libxml/HTMLparser.h>
   1162 #include <libxml/HTMLtree.h>
   1163 #include <libxml/SAX2.h>
   1164 #include <libxml/c14n.h>
   1165 #include <libxml/catalog.h>
   1166 #include <libxml/chvalid.h>
   1167 #include <libxml/debugXML.h>
   1168 #include <libxml/dict.h>
   1169 #include <libxml/encoding.h>
   1170 #include <libxml/entities.h>
   1171 #include <libxml/hash.h>
   1172 #include <libxml/list.h>
   1173 #include <libxml/nanoftp.h>
   1174 #include <libxml/nanohttp.h>
   1175 #include <libxml/parser.h>
   1176 #include <libxml/parserInternals.h>
   1177 #include <libxml/pattern.h>
   1178 #include <libxml/relaxng.h>
   1179 #include <libxml/schemasInternals.h>
   1180 #include <libxml/schematron.h>
   1181 #include <libxml/tree.h>
   1182 #include <libxml/uri.h>
   1183 #include <libxml/valid.h>
   1184 #include <libxml/xinclude.h>
   1185 #include <libxml/xmlIO.h>
   1186 #include <libxml/xmlautomata.h>
   1187 #include <libxml/xmlerror.h>
   1188 #include <libxml/xmlmodule.h>
   1189 #include <libxml/xmlreader.h>
   1190 #include <libxml/xmlregexp.h>
   1191 #include <libxml/xmlsave.h>
   1192 #include <libxml/xmlschemas.h>
   1193 #include <libxml/xmlschemastypes.h>
   1194 #include <libxml/xmlstring.h>
   1195 #include <libxml/xmlunicode.h>
   1196 #include <libxml/xmlwriter.h>
   1197 #include <libxml/xpath.h>
   1198 #include <libxml/xpathInternals.h>
   1199 #include <libxml/xpointer.h>
   1200 static int test_HTMLparser(void);
   1201 static int test_HTMLtree(void);
   1202 static int test_SAX2(void);
   1203 static int test_c14n(void);
   1204 static int test_catalog(void);
   1205 static int test_chvalid(void);
   1206 static int test_debugXML(void);
   1207 static int test_dict(void);
   1208 static int test_encoding(void);
   1209 static int test_entities(void);
   1210 static int test_hash(void);
   1211 static int test_list(void);
   1212 static int test_nanoftp(void);
   1213 static int test_nanohttp(void);
   1214 static int test_parser(void);
   1215 static int test_parserInternals(void);
   1216 static int test_pattern(void);
   1217 static int test_relaxng(void);
   1218 static int test_schemasInternals(void);
   1219 static int test_schematron(void);
   1220 static int test_tree(void);
   1221 static int test_uri(void);
   1222 static int test_valid(void);
   1223 static int test_xinclude(void);
   1224 static int test_xmlIO(void);
   1225 static int test_xmlautomata(void);
   1226 static int test_xmlerror(void);
   1227 static int test_xmlmodule(void);
   1228 static int test_xmlreader(void);
   1229 static int test_xmlregexp(void);
   1230 static int test_xmlsave(void);
   1231 static int test_xmlschemas(void);
   1232 static int test_xmlschemastypes(void);
   1233 static int test_xmlstring(void);
   1234 static int test_xmlunicode(void);
   1235 static int test_xmlwriter(void);
   1236 static int test_xpath(void);
   1237 static int test_xpathInternals(void);
   1238 static int test_xpointer(void);
   1239 
   1240 /**
   1241  * testlibxml2:
   1242  *
   1243  * Main entry point of the tester for the full libxml2 module,
   1244  * it calls all the tester entry point for each module.
   1245  *
   1246  * Returns the number of error found
   1247  */
   1248 static int
   1249 testlibxml2(void)
   1250 {
   1251     int test_ret = 0;
   1252 
   1253     test_ret += test_HTMLparser();
   1254     test_ret += test_HTMLtree();
   1255     test_ret += test_SAX2();
   1256     test_ret += test_c14n();
   1257     test_ret += test_catalog();
   1258     test_ret += test_chvalid();
   1259     test_ret += test_debugXML();
   1260     test_ret += test_dict();
   1261     test_ret += test_encoding();
   1262     test_ret += test_entities();
   1263     test_ret += test_hash();
   1264     test_ret += test_list();
   1265     test_ret += test_nanoftp();
   1266     test_ret += test_nanohttp();
   1267     test_ret += test_parser();
   1268     test_ret += test_parserInternals();
   1269     test_ret += test_pattern();
   1270     test_ret += test_relaxng();
   1271     test_ret += test_schemasInternals();
   1272     test_ret += test_schematron();
   1273     test_ret += test_tree();
   1274     test_ret += test_uri();
   1275     test_ret += test_valid();
   1276     test_ret += test_xinclude();
   1277     test_ret += test_xmlIO();
   1278     test_ret += test_xmlautomata();
   1279     test_ret += test_xmlerror();
   1280     test_ret += test_xmlmodule();
   1281     test_ret += test_xmlreader();
   1282     test_ret += test_xmlregexp();
   1283     test_ret += test_xmlsave();
   1284     test_ret += test_xmlschemas();
   1285     test_ret += test_xmlschemastypes();
   1286     test_ret += test_xmlstring();
   1287     test_ret += test_xmlunicode();
   1288     test_ret += test_xmlwriter();
   1289     test_ret += test_xpath();
   1290     test_ret += test_xpathInternals();
   1291     test_ret += test_xpointer();
   1292 
   1293     printf("Total: %d functions, %d tests, %d errors\n",
   1294            function_tests, call_tests, test_ret);
   1295     return(test_ret);
   1296 }
   1297 
   1298 
   1299 static int
   1300 test_UTF8ToHtml(void) {
   1301     int test_ret = 0;
   1302 
   1303 #if defined(LIBXML_HTML_ENABLED)
   1304     int mem_base;
   1305     int ret_val;
   1306     unsigned char * out; /* a pointer to an array of bytes to store the result */
   1307     int n_out;
   1308     int * outlen; /* the length of @out */
   1309     int n_outlen;
   1310     unsigned char * in; /* a pointer to an array of UTF-8 chars */
   1311     int n_in;
   1312     int * inlen; /* the length of @in */
   1313     int n_inlen;
   1314 
   1315     for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
   1316     for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
   1317     for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
   1318     for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
   1319         mem_base = xmlMemBlocks();
   1320         out = gen_unsigned_char_ptr(n_out, 0);
   1321         outlen = gen_int_ptr(n_outlen, 1);
   1322         in = gen_const_unsigned_char_ptr(n_in, 2);
   1323         inlen = gen_int_ptr(n_inlen, 3);
   1324 
   1325         ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
   1326         desret_int(ret_val);
   1327         call_tests++;
   1328         des_unsigned_char_ptr(n_out, out, 0);
   1329         des_int_ptr(n_outlen, outlen, 1);
   1330         des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
   1331         des_int_ptr(n_inlen, inlen, 3);
   1332         xmlResetLastError();
   1333         if (mem_base != xmlMemBlocks()) {
   1334             printf("Leak of %d blocks found in UTF8ToHtml",
   1335 	           xmlMemBlocks() - mem_base);
   1336 	    test_ret++;
   1337             printf(" %d", n_out);
   1338             printf(" %d", n_outlen);
   1339             printf(" %d", n_in);
   1340             printf(" %d", n_inlen);
   1341             printf("\n");
   1342         }
   1343     }
   1344     }
   1345     }
   1346     }
   1347     function_tests++;
   1348 #endif
   1349 
   1350     return(test_ret);
   1351 }
   1352 
   1353 #ifdef LIBXML_HTML_ENABLED
   1354 
   1355 #define gen_nb_const_htmlElemDesc_ptr 1
   1356 static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1357     return(NULL);
   1358 }
   1359 static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1360 }
   1361 #endif
   1362 
   1363 
   1364 static int
   1365 test_htmlAttrAllowed(void) {
   1366     int test_ret = 0;
   1367 
   1368 #if defined(LIBXML_HTML_ENABLED)
   1369     int mem_base;
   1370     htmlStatus ret_val;
   1371     htmlElemDesc * elt; /* HTML element */
   1372     int n_elt;
   1373     xmlChar * attr; /* HTML attribute */
   1374     int n_attr;
   1375     int legacy; /* whether to allow deprecated attributes */
   1376     int n_legacy;
   1377 
   1378     for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
   1379     for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
   1380     for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
   1381         mem_base = xmlMemBlocks();
   1382         elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
   1383         attr = gen_const_xmlChar_ptr(n_attr, 1);
   1384         legacy = gen_int(n_legacy, 2);
   1385 
   1386         ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
   1387         desret_htmlStatus(ret_val);
   1388         call_tests++;
   1389         des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
   1390         des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
   1391         des_int(n_legacy, legacy, 2);
   1392         xmlResetLastError();
   1393         if (mem_base != xmlMemBlocks()) {
   1394             printf("Leak of %d blocks found in htmlAttrAllowed",
   1395 	           xmlMemBlocks() - mem_base);
   1396 	    test_ret++;
   1397             printf(" %d", n_elt);
   1398             printf(" %d", n_attr);
   1399             printf(" %d", n_legacy);
   1400             printf("\n");
   1401         }
   1402     }
   1403     }
   1404     }
   1405     function_tests++;
   1406 #endif
   1407 
   1408     return(test_ret);
   1409 }
   1410 
   1411 #ifdef LIBXML_HTML_ENABLED
   1412 
   1413 #define gen_nb_htmlNodePtr 1
   1414 static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1415     return(NULL);
   1416 }
   1417 static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1418 }
   1419 #endif
   1420 
   1421 
   1422 static int
   1423 test_htmlAutoCloseTag(void) {
   1424     int test_ret = 0;
   1425 
   1426 #if defined(LIBXML_HTML_ENABLED)
   1427     int mem_base;
   1428     int ret_val;
   1429     htmlDocPtr doc; /* the HTML document */
   1430     int n_doc;
   1431     xmlChar * name; /* The tag name */
   1432     int n_name;
   1433     htmlNodePtr elem; /* the HTML element */
   1434     int n_elem;
   1435 
   1436     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
   1437     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   1438     for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
   1439         mem_base = xmlMemBlocks();
   1440         doc = gen_htmlDocPtr(n_doc, 0);
   1441         name = gen_const_xmlChar_ptr(n_name, 1);
   1442         elem = gen_htmlNodePtr(n_elem, 2);
   1443 
   1444         ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
   1445         desret_int(ret_val);
   1446         call_tests++;
   1447         des_htmlDocPtr(n_doc, doc, 0);
   1448         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   1449         des_htmlNodePtr(n_elem, elem, 2);
   1450         xmlResetLastError();
   1451         if (mem_base != xmlMemBlocks()) {
   1452             printf("Leak of %d blocks found in htmlAutoCloseTag",
   1453 	           xmlMemBlocks() - mem_base);
   1454 	    test_ret++;
   1455             printf(" %d", n_doc);
   1456             printf(" %d", n_name);
   1457             printf(" %d", n_elem);
   1458             printf("\n");
   1459         }
   1460     }
   1461     }
   1462     }
   1463     function_tests++;
   1464 #endif
   1465 
   1466     return(test_ret);
   1467 }
   1468 
   1469 
   1470 static int
   1471 test_htmlCreateMemoryParserCtxt(void) {
   1472     int test_ret = 0;
   1473 
   1474 #if defined(LIBXML_HTML_ENABLED)
   1475     int mem_base;
   1476     htmlParserCtxtPtr ret_val;
   1477     char * buffer; /* a pointer to a char array */
   1478     int n_buffer;
   1479     int size; /* the size of the array */
   1480     int n_size;
   1481 
   1482     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
   1483     for (n_size = 0;n_size < gen_nb_int;n_size++) {
   1484         mem_base = xmlMemBlocks();
   1485         buffer = gen_const_char_ptr(n_buffer, 0);
   1486         size = gen_int(n_size, 1);
   1487 
   1488         ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
   1489         desret_htmlParserCtxtPtr(ret_val);
   1490         call_tests++;
   1491         des_const_char_ptr(n_buffer, (const char *)buffer, 0);
   1492         des_int(n_size, size, 1);
   1493         xmlResetLastError();
   1494         if (mem_base != xmlMemBlocks()) {
   1495             printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
   1496 	           xmlMemBlocks() - mem_base);
   1497 	    test_ret++;
   1498             printf(" %d", n_buffer);
   1499             printf(" %d", n_size);
   1500             printf("\n");
   1501         }
   1502     }
   1503     }
   1504     function_tests++;
   1505 #endif
   1506 
   1507     return(test_ret);
   1508 }
   1509 
   1510 #ifdef LIBXML_HTML_ENABLED
   1511 
   1512 #define gen_nb_htmlSAXHandlerPtr 1
   1513 static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1514     return(NULL);
   1515 }
   1516 static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   1517 }
   1518 #endif
   1519 
   1520 
   1521 static int
   1522 test_htmlCreatePushParserCtxt(void) {
   1523     int test_ret = 0;
   1524 
   1525 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
   1526     int mem_base;
   1527     htmlParserCtxtPtr ret_val;
   1528     htmlSAXHandlerPtr sax; /* a SAX handler */
   1529     int n_sax;
   1530     void * user_data; /* The user data returned on SAX callbacks */
   1531     int n_user_data;
   1532     char * chunk; /* a pointer to an array of chars */
   1533     int n_chunk;
   1534     int size; /* number of chars in the array */
   1535     int n_size;
   1536     const char * filename; /* an optional file name or URI */
   1537     int n_filename;
   1538     xmlCharEncoding enc; /* an optional encoding */
   1539     int n_enc;
   1540 
   1541     for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
   1542     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
   1543     for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
   1544     for (n_size = 0;n_size < gen_nb_int;n_size++) {
   1545     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
   1546     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
   1547         mem_base = xmlMemBlocks();
   1548         sax = gen_htmlSAXHandlerPtr(n_sax, 0);
   1549         user_data = gen_userdata(n_user_data, 1);
   1550         chunk = gen_const_char_ptr(n_chunk, 2);
   1551         size = gen_int(n_size, 3);
   1552         filename = gen_fileoutput(n_filename, 4);
   1553         enc = gen_xmlCharEncoding(n_enc, 5);
   1554 
   1555         ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
   1556         desret_htmlParserCtxtPtr(ret_val);
   1557         call_tests++;
   1558         des_htmlSAXHandlerPtr(n_sax, sax, 0);
   1559         des_userdata(n_user_data, user_data, 1);
   1560         des_const_char_ptr(n_chunk, (const char *)chunk, 2);
   1561         des_int(n_size, size, 3);
   1562         des_fileoutput(n_filename, filename, 4);
   1563         des_xmlCharEncoding(n_enc, enc, 5);
   1564         xmlResetLastError();
   1565         if (mem_base != xmlMemBlocks()) {
   1566             printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
   1567 	           xmlMemBlocks() - mem_base);
   1568 	    test_ret++;
   1569             printf(" %d", n_sax);
   1570             printf(" %d", n_user_data);
   1571             printf(" %d", n_chunk);
   1572             printf(" %d", n_size);
   1573             printf(" %d", n_filename);
   1574             printf(" %d", n_enc);
   1575             printf("\n");
   1576         }
   1577     }
   1578     }
   1579     }
   1580     }
   1581     }
   1582     }
   1583     function_tests++;
   1584 #endif
   1585 
   1586     return(test_ret);
   1587 }
   1588 
   1589 
   1590 static int
   1591 test_htmlCtxtReadDoc(void) {
   1592     int test_ret = 0;
   1593 
   1594 #if defined(LIBXML_HTML_ENABLED)
   1595     int mem_base;
   1596     htmlDocPtr ret_val;
   1597     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   1598     int n_ctxt;
   1599     xmlChar * cur; /* a pointer to a zero terminated string */
   1600     int n_cur;
   1601     const char * URL; /* the base URL to use for the document */
   1602     int n_URL;
   1603     char * encoding; /* the document encoding, or NULL */
   1604     int n_encoding;
   1605     int options; /* a combination of htmlParserOption(s) */
   1606     int n_options;
   1607 
   1608     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   1609     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
   1610     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
   1611     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   1612     for (n_options = 0;n_options < gen_nb_int;n_options++) {
   1613         mem_base = xmlMemBlocks();
   1614         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   1615         cur = gen_const_xmlChar_ptr(n_cur, 1);
   1616         URL = gen_filepath(n_URL, 2);
   1617         encoding = gen_const_char_ptr(n_encoding, 3);
   1618         options = gen_int(n_options, 4);
   1619 
   1620         ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
   1621         desret_htmlDocPtr(ret_val);
   1622         call_tests++;
   1623         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   1624         des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
   1625         des_filepath(n_URL, URL, 2);
   1626         des_const_char_ptr(n_encoding, (const char *)encoding, 3);
   1627         des_int(n_options, options, 4);
   1628         xmlResetLastError();
   1629         if (mem_base != xmlMemBlocks()) {
   1630             printf("Leak of %d blocks found in htmlCtxtReadDoc",
   1631 	           xmlMemBlocks() - mem_base);
   1632 	    test_ret++;
   1633             printf(" %d", n_ctxt);
   1634             printf(" %d", n_cur);
   1635             printf(" %d", n_URL);
   1636             printf(" %d", n_encoding);
   1637             printf(" %d", n_options);
   1638             printf("\n");
   1639         }
   1640     }
   1641     }
   1642     }
   1643     }
   1644     }
   1645     function_tests++;
   1646 #endif
   1647 
   1648     return(test_ret);
   1649 }
   1650 
   1651 
   1652 static int
   1653 test_htmlCtxtReadFile(void) {
   1654     int test_ret = 0;
   1655 
   1656 #if defined(LIBXML_HTML_ENABLED)
   1657     htmlDocPtr ret_val;
   1658     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   1659     int n_ctxt;
   1660     const char * filename; /* a file or URL */
   1661     int n_filename;
   1662     char * encoding; /* the document encoding, or NULL */
   1663     int n_encoding;
   1664     int options; /* a combination of htmlParserOption(s) */
   1665     int n_options;
   1666 
   1667     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   1668     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
   1669     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   1670     for (n_options = 0;n_options < gen_nb_int;n_options++) {
   1671         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   1672         filename = gen_filepath(n_filename, 1);
   1673         encoding = gen_const_char_ptr(n_encoding, 2);
   1674         options = gen_int(n_options, 3);
   1675 
   1676         ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
   1677         desret_htmlDocPtr(ret_val);
   1678         call_tests++;
   1679         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   1680         des_filepath(n_filename, filename, 1);
   1681         des_const_char_ptr(n_encoding, (const char *)encoding, 2);
   1682         des_int(n_options, options, 3);
   1683         xmlResetLastError();
   1684     }
   1685     }
   1686     }
   1687     }
   1688     function_tests++;
   1689 #endif
   1690 
   1691     return(test_ret);
   1692 }
   1693 
   1694 
   1695 static int
   1696 test_htmlCtxtReadMemory(void) {
   1697     int test_ret = 0;
   1698 
   1699 #if defined(LIBXML_HTML_ENABLED)
   1700     int mem_base;
   1701     htmlDocPtr ret_val;
   1702     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   1703     int n_ctxt;
   1704     char * buffer; /* a pointer to a char array */
   1705     int n_buffer;
   1706     int size; /* the size of the array */
   1707     int n_size;
   1708     const char * URL; /* the base URL to use for the document */
   1709     int n_URL;
   1710     char * encoding; /* the document encoding, or NULL */
   1711     int n_encoding;
   1712     int options; /* a combination of htmlParserOption(s) */
   1713     int n_options;
   1714 
   1715     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   1716     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
   1717     for (n_size = 0;n_size < gen_nb_int;n_size++) {
   1718     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
   1719     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   1720     for (n_options = 0;n_options < gen_nb_int;n_options++) {
   1721         mem_base = xmlMemBlocks();
   1722         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   1723         buffer = gen_const_char_ptr(n_buffer, 1);
   1724         size = gen_int(n_size, 2);
   1725         URL = gen_filepath(n_URL, 3);
   1726         encoding = gen_const_char_ptr(n_encoding, 4);
   1727         options = gen_int(n_options, 5);
   1728 
   1729         ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
   1730         desret_htmlDocPtr(ret_val);
   1731         call_tests++;
   1732         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   1733         des_const_char_ptr(n_buffer, (const char *)buffer, 1);
   1734         des_int(n_size, size, 2);
   1735         des_filepath(n_URL, URL, 3);
   1736         des_const_char_ptr(n_encoding, (const char *)encoding, 4);
   1737         des_int(n_options, options, 5);
   1738         xmlResetLastError();
   1739         if (mem_base != xmlMemBlocks()) {
   1740             printf("Leak of %d blocks found in htmlCtxtReadMemory",
   1741 	           xmlMemBlocks() - mem_base);
   1742 	    test_ret++;
   1743             printf(" %d", n_ctxt);
   1744             printf(" %d", n_buffer);
   1745             printf(" %d", n_size);
   1746             printf(" %d", n_URL);
   1747             printf(" %d", n_encoding);
   1748             printf(" %d", n_options);
   1749             printf("\n");
   1750         }
   1751     }
   1752     }
   1753     }
   1754     }
   1755     }
   1756     }
   1757     function_tests++;
   1758 #endif
   1759 
   1760     return(test_ret);
   1761 }
   1762 
   1763 
   1764 static int
   1765 test_htmlCtxtReset(void) {
   1766     int test_ret = 0;
   1767 
   1768 #if defined(LIBXML_HTML_ENABLED)
   1769     int mem_base;
   1770     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   1771     int n_ctxt;
   1772 
   1773     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   1774         mem_base = xmlMemBlocks();
   1775         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   1776 
   1777         htmlCtxtReset(ctxt);
   1778         call_tests++;
   1779         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   1780         xmlResetLastError();
   1781         if (mem_base != xmlMemBlocks()) {
   1782             printf("Leak of %d blocks found in htmlCtxtReset",
   1783 	           xmlMemBlocks() - mem_base);
   1784 	    test_ret++;
   1785             printf(" %d", n_ctxt);
   1786             printf("\n");
   1787         }
   1788     }
   1789     function_tests++;
   1790 #endif
   1791 
   1792     return(test_ret);
   1793 }
   1794 
   1795 
   1796 static int
   1797 test_htmlCtxtUseOptions(void) {
   1798     int test_ret = 0;
   1799 
   1800 #if defined(LIBXML_HTML_ENABLED)
   1801     int mem_base;
   1802     int ret_val;
   1803     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   1804     int n_ctxt;
   1805     int options; /* a combination of htmlParserOption(s) */
   1806     int n_options;
   1807 
   1808     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   1809     for (n_options = 0;n_options < gen_nb_int;n_options++) {
   1810         mem_base = xmlMemBlocks();
   1811         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   1812         options = gen_int(n_options, 1);
   1813 
   1814         ret_val = htmlCtxtUseOptions(ctxt, options);
   1815         desret_int(ret_val);
   1816         call_tests++;
   1817         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   1818         des_int(n_options, options, 1);
   1819         xmlResetLastError();
   1820         if (mem_base != xmlMemBlocks()) {
   1821             printf("Leak of %d blocks found in htmlCtxtUseOptions",
   1822 	           xmlMemBlocks() - mem_base);
   1823 	    test_ret++;
   1824             printf(" %d", n_ctxt);
   1825             printf(" %d", n_options);
   1826             printf("\n");
   1827         }
   1828     }
   1829     }
   1830     function_tests++;
   1831 #endif
   1832 
   1833     return(test_ret);
   1834 }
   1835 
   1836 
   1837 static int
   1838 test_htmlElementAllowedHere(void) {
   1839     int test_ret = 0;
   1840 
   1841 #if defined(LIBXML_HTML_ENABLED)
   1842     int mem_base;
   1843     int ret_val;
   1844     htmlElemDesc * parent; /* HTML parent element */
   1845     int n_parent;
   1846     xmlChar * elt; /* HTML element */
   1847     int n_elt;
   1848 
   1849     for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
   1850     for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
   1851         mem_base = xmlMemBlocks();
   1852         parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
   1853         elt = gen_const_xmlChar_ptr(n_elt, 1);
   1854 
   1855         ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
   1856         desret_int(ret_val);
   1857         call_tests++;
   1858         des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
   1859         des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
   1860         xmlResetLastError();
   1861         if (mem_base != xmlMemBlocks()) {
   1862             printf("Leak of %d blocks found in htmlElementAllowedHere",
   1863 	           xmlMemBlocks() - mem_base);
   1864 	    test_ret++;
   1865             printf(" %d", n_parent);
   1866             printf(" %d", n_elt);
   1867             printf("\n");
   1868         }
   1869     }
   1870     }
   1871     function_tests++;
   1872 #endif
   1873 
   1874     return(test_ret);
   1875 }
   1876 
   1877 
   1878 static int
   1879 test_htmlElementStatusHere(void) {
   1880     int test_ret = 0;
   1881 
   1882 #if defined(LIBXML_HTML_ENABLED)
   1883     int mem_base;
   1884     htmlStatus ret_val;
   1885     htmlElemDesc * parent; /* HTML parent element */
   1886     int n_parent;
   1887     htmlElemDesc * elt; /* HTML element */
   1888     int n_elt;
   1889 
   1890     for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
   1891     for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
   1892         mem_base = xmlMemBlocks();
   1893         parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
   1894         elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
   1895 
   1896         ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
   1897         desret_htmlStatus(ret_val);
   1898         call_tests++;
   1899         des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
   1900         des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
   1901         xmlResetLastError();
   1902         if (mem_base != xmlMemBlocks()) {
   1903             printf("Leak of %d blocks found in htmlElementStatusHere",
   1904 	           xmlMemBlocks() - mem_base);
   1905 	    test_ret++;
   1906             printf(" %d", n_parent);
   1907             printf(" %d", n_elt);
   1908             printf("\n");
   1909         }
   1910     }
   1911     }
   1912     function_tests++;
   1913 #endif
   1914 
   1915     return(test_ret);
   1916 }
   1917 
   1918 
   1919 static int
   1920 test_htmlEncodeEntities(void) {
   1921     int test_ret = 0;
   1922 
   1923 #if defined(LIBXML_HTML_ENABLED)
   1924     int mem_base;
   1925     int ret_val;
   1926     unsigned char * out; /* a pointer to an array of bytes to store the result */
   1927     int n_out;
   1928     int * outlen; /* the length of @out */
   1929     int n_outlen;
   1930     unsigned char * in; /* a pointer to an array of UTF-8 chars */
   1931     int n_in;
   1932     int * inlen; /* the length of @in */
   1933     int n_inlen;
   1934     int quoteChar; /* the quote character to escape (' or ") or zero. */
   1935     int n_quoteChar;
   1936 
   1937     for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
   1938     for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
   1939     for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
   1940     for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
   1941     for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
   1942         mem_base = xmlMemBlocks();
   1943         out = gen_unsigned_char_ptr(n_out, 0);
   1944         outlen = gen_int_ptr(n_outlen, 1);
   1945         in = gen_const_unsigned_char_ptr(n_in, 2);
   1946         inlen = gen_int_ptr(n_inlen, 3);
   1947         quoteChar = gen_int(n_quoteChar, 4);
   1948 
   1949         ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
   1950         desret_int(ret_val);
   1951         call_tests++;
   1952         des_unsigned_char_ptr(n_out, out, 0);
   1953         des_int_ptr(n_outlen, outlen, 1);
   1954         des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
   1955         des_int_ptr(n_inlen, inlen, 3);
   1956         des_int(n_quoteChar, quoteChar, 4);
   1957         xmlResetLastError();
   1958         if (mem_base != xmlMemBlocks()) {
   1959             printf("Leak of %d blocks found in htmlEncodeEntities",
   1960 	           xmlMemBlocks() - mem_base);
   1961 	    test_ret++;
   1962             printf(" %d", n_out);
   1963             printf(" %d", n_outlen);
   1964             printf(" %d", n_in);
   1965             printf(" %d", n_inlen);
   1966             printf(" %d", n_quoteChar);
   1967             printf("\n");
   1968         }
   1969     }
   1970     }
   1971     }
   1972     }
   1973     }
   1974     function_tests++;
   1975 #endif
   1976 
   1977     return(test_ret);
   1978 }
   1979 
   1980 
   1981 static int
   1982 test_htmlEntityLookup(void) {
   1983     int test_ret = 0;
   1984 
   1985 #if defined(LIBXML_HTML_ENABLED)
   1986     int mem_base;
   1987     const htmlEntityDesc * ret_val;
   1988     xmlChar * name; /* the entity name */
   1989     int n_name;
   1990 
   1991     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   1992         mem_base = xmlMemBlocks();
   1993         name = gen_const_xmlChar_ptr(n_name, 0);
   1994 
   1995         ret_val = htmlEntityLookup((const xmlChar *)name);
   1996         desret_const_htmlEntityDesc_ptr(ret_val);
   1997         call_tests++;
   1998         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
   1999         xmlResetLastError();
   2000         if (mem_base != xmlMemBlocks()) {
   2001             printf("Leak of %d blocks found in htmlEntityLookup",
   2002 	           xmlMemBlocks() - mem_base);
   2003 	    test_ret++;
   2004             printf(" %d", n_name);
   2005             printf("\n");
   2006         }
   2007     }
   2008     function_tests++;
   2009 #endif
   2010 
   2011     return(test_ret);
   2012 }
   2013 
   2014 
   2015 static int
   2016 test_htmlEntityValueLookup(void) {
   2017     int test_ret = 0;
   2018 
   2019 #if defined(LIBXML_HTML_ENABLED)
   2020     int mem_base;
   2021     const htmlEntityDesc * ret_val;
   2022     unsigned int value; /* the entity's unicode value */
   2023     int n_value;
   2024 
   2025     for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
   2026         mem_base = xmlMemBlocks();
   2027         value = gen_unsigned_int(n_value, 0);
   2028 
   2029         ret_val = htmlEntityValueLookup(value);
   2030         desret_const_htmlEntityDesc_ptr(ret_val);
   2031         call_tests++;
   2032         des_unsigned_int(n_value, value, 0);
   2033         xmlResetLastError();
   2034         if (mem_base != xmlMemBlocks()) {
   2035             printf("Leak of %d blocks found in htmlEntityValueLookup",
   2036 	           xmlMemBlocks() - mem_base);
   2037 	    test_ret++;
   2038             printf(" %d", n_value);
   2039             printf("\n");
   2040         }
   2041     }
   2042     function_tests++;
   2043 #endif
   2044 
   2045     return(test_ret);
   2046 }
   2047 
   2048 
   2049 static int
   2050 test_htmlHandleOmittedElem(void) {
   2051     int test_ret = 0;
   2052 
   2053 #if defined(LIBXML_HTML_ENABLED)
   2054     int mem_base;
   2055     int ret_val;
   2056     int val; /* int 0 or 1 */
   2057     int n_val;
   2058 
   2059     for (n_val = 0;n_val < gen_nb_int;n_val++) {
   2060         mem_base = xmlMemBlocks();
   2061         val = gen_int(n_val, 0);
   2062 
   2063         ret_val = htmlHandleOmittedElem(val);
   2064         desret_int(ret_val);
   2065         call_tests++;
   2066         des_int(n_val, val, 0);
   2067         xmlResetLastError();
   2068         if (mem_base != xmlMemBlocks()) {
   2069             printf("Leak of %d blocks found in htmlHandleOmittedElem",
   2070 	           xmlMemBlocks() - mem_base);
   2071 	    test_ret++;
   2072             printf(" %d", n_val);
   2073             printf("\n");
   2074         }
   2075     }
   2076     function_tests++;
   2077 #endif
   2078 
   2079     return(test_ret);
   2080 }
   2081 
   2082 
   2083 static int
   2084 test_htmlIsAutoClosed(void) {
   2085     int test_ret = 0;
   2086 
   2087 #if defined(LIBXML_HTML_ENABLED)
   2088     int mem_base;
   2089     int ret_val;
   2090     htmlDocPtr doc; /* the HTML document */
   2091     int n_doc;
   2092     htmlNodePtr elem; /* the HTML element */
   2093     int n_elem;
   2094 
   2095     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
   2096     for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
   2097         mem_base = xmlMemBlocks();
   2098         doc = gen_htmlDocPtr(n_doc, 0);
   2099         elem = gen_htmlNodePtr(n_elem, 1);
   2100 
   2101         ret_val = htmlIsAutoClosed(doc, elem);
   2102         desret_int(ret_val);
   2103         call_tests++;
   2104         des_htmlDocPtr(n_doc, doc, 0);
   2105         des_htmlNodePtr(n_elem, elem, 1);
   2106         xmlResetLastError();
   2107         if (mem_base != xmlMemBlocks()) {
   2108             printf("Leak of %d blocks found in htmlIsAutoClosed",
   2109 	           xmlMemBlocks() - mem_base);
   2110 	    test_ret++;
   2111             printf(" %d", n_doc);
   2112             printf(" %d", n_elem);
   2113             printf("\n");
   2114         }
   2115     }
   2116     }
   2117     function_tests++;
   2118 #endif
   2119 
   2120     return(test_ret);
   2121 }
   2122 
   2123 
   2124 static int
   2125 test_htmlIsScriptAttribute(void) {
   2126     int test_ret = 0;
   2127 
   2128 #if defined(LIBXML_HTML_ENABLED)
   2129     int mem_base;
   2130     int ret_val;
   2131     xmlChar * name; /* an attribute name */
   2132     int n_name;
   2133 
   2134     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   2135         mem_base = xmlMemBlocks();
   2136         name = gen_const_xmlChar_ptr(n_name, 0);
   2137 
   2138         ret_val = htmlIsScriptAttribute((const xmlChar *)name);
   2139         desret_int(ret_val);
   2140         call_tests++;
   2141         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
   2142         xmlResetLastError();
   2143         if (mem_base != xmlMemBlocks()) {
   2144             printf("Leak of %d blocks found in htmlIsScriptAttribute",
   2145 	           xmlMemBlocks() - mem_base);
   2146 	    test_ret++;
   2147             printf(" %d", n_name);
   2148             printf("\n");
   2149         }
   2150     }
   2151     function_tests++;
   2152 #endif
   2153 
   2154     return(test_ret);
   2155 }
   2156 
   2157 
   2158 static int
   2159 test_htmlNewParserCtxt(void) {
   2160     int test_ret = 0;
   2161 
   2162 #if defined(LIBXML_HTML_ENABLED)
   2163     int mem_base;
   2164     htmlParserCtxtPtr ret_val;
   2165 
   2166         mem_base = xmlMemBlocks();
   2167 
   2168         ret_val = htmlNewParserCtxt();
   2169         desret_htmlParserCtxtPtr(ret_val);
   2170         call_tests++;
   2171         xmlResetLastError();
   2172         if (mem_base != xmlMemBlocks()) {
   2173             printf("Leak of %d blocks found in htmlNewParserCtxt",
   2174 	           xmlMemBlocks() - mem_base);
   2175 	    test_ret++;
   2176             printf("\n");
   2177         }
   2178     function_tests++;
   2179 #endif
   2180 
   2181     return(test_ret);
   2182 }
   2183 
   2184 
   2185 static int
   2186 test_htmlNodeStatus(void) {
   2187     int test_ret = 0;
   2188 
   2189 #if defined(LIBXML_HTML_ENABLED)
   2190     int mem_base;
   2191     htmlStatus ret_val;
   2192     htmlNodePtr node; /* an htmlNodePtr in a tree */
   2193     int n_node;
   2194     int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
   2195     int n_legacy;
   2196 
   2197     for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
   2198     for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
   2199         mem_base = xmlMemBlocks();
   2200         node = gen_const_htmlNodePtr(n_node, 0);
   2201         legacy = gen_int(n_legacy, 1);
   2202 
   2203         ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
   2204         desret_htmlStatus(ret_val);
   2205         call_tests++;
   2206         des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
   2207         des_int(n_legacy, legacy, 1);
   2208         xmlResetLastError();
   2209         if (mem_base != xmlMemBlocks()) {
   2210             printf("Leak of %d blocks found in htmlNodeStatus",
   2211 	           xmlMemBlocks() - mem_base);
   2212 	    test_ret++;
   2213             printf(" %d", n_node);
   2214             printf(" %d", n_legacy);
   2215             printf("\n");
   2216         }
   2217     }
   2218     }
   2219     function_tests++;
   2220 #endif
   2221 
   2222     return(test_ret);
   2223 }
   2224 
   2225 
   2226 static int
   2227 test_htmlParseCharRef(void) {
   2228     int test_ret = 0;
   2229 
   2230 #if defined(LIBXML_HTML_ENABLED)
   2231     int mem_base;
   2232     int ret_val;
   2233     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   2234     int n_ctxt;
   2235 
   2236     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   2237         mem_base = xmlMemBlocks();
   2238         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   2239 
   2240         ret_val = htmlParseCharRef(ctxt);
   2241         desret_int(ret_val);
   2242         call_tests++;
   2243         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   2244         xmlResetLastError();
   2245         if (mem_base != xmlMemBlocks()) {
   2246             printf("Leak of %d blocks found in htmlParseCharRef",
   2247 	           xmlMemBlocks() - mem_base);
   2248 	    test_ret++;
   2249             printf(" %d", n_ctxt);
   2250             printf("\n");
   2251         }
   2252     }
   2253     function_tests++;
   2254 #endif
   2255 
   2256     return(test_ret);
   2257 }
   2258 
   2259 
   2260 static int
   2261 test_htmlParseChunk(void) {
   2262     int test_ret = 0;
   2263 
   2264 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
   2265     int mem_base;
   2266     int ret_val;
   2267     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   2268     int n_ctxt;
   2269     char * chunk; /* an char array */
   2270     int n_chunk;
   2271     int size; /* the size in byte of the chunk */
   2272     int n_size;
   2273     int terminate; /* last chunk indicator */
   2274     int n_terminate;
   2275 
   2276     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   2277     for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
   2278     for (n_size = 0;n_size < gen_nb_int;n_size++) {
   2279     for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
   2280         mem_base = xmlMemBlocks();
   2281         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   2282         chunk = gen_const_char_ptr(n_chunk, 1);
   2283         size = gen_int(n_size, 2);
   2284         terminate = gen_int(n_terminate, 3);
   2285 
   2286         ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
   2287         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
   2288         desret_int(ret_val);
   2289         call_tests++;
   2290         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   2291         des_const_char_ptr(n_chunk, (const char *)chunk, 1);
   2292         des_int(n_size, size, 2);
   2293         des_int(n_terminate, terminate, 3);
   2294         xmlResetLastError();
   2295         if (mem_base != xmlMemBlocks()) {
   2296             printf("Leak of %d blocks found in htmlParseChunk",
   2297 	           xmlMemBlocks() - mem_base);
   2298 	    test_ret++;
   2299             printf(" %d", n_ctxt);
   2300             printf(" %d", n_chunk);
   2301             printf(" %d", n_size);
   2302             printf(" %d", n_terminate);
   2303             printf("\n");
   2304         }
   2305     }
   2306     }
   2307     }
   2308     }
   2309     function_tests++;
   2310 #endif
   2311 
   2312     return(test_ret);
   2313 }
   2314 
   2315 
   2316 static int
   2317 test_htmlParseDoc(void) {
   2318     int test_ret = 0;
   2319 
   2320 #if defined(LIBXML_HTML_ENABLED)
   2321     int mem_base;
   2322     htmlDocPtr ret_val;
   2323     xmlChar * cur; /* a pointer to an array of xmlChar */
   2324     int n_cur;
   2325     char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
   2326     int n_encoding;
   2327 
   2328     for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
   2329     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2330         mem_base = xmlMemBlocks();
   2331         cur = gen_xmlChar_ptr(n_cur, 0);
   2332         encoding = gen_const_char_ptr(n_encoding, 1);
   2333 
   2334         ret_val = htmlParseDoc(cur, (const char *)encoding);
   2335         desret_htmlDocPtr(ret_val);
   2336         call_tests++;
   2337         des_xmlChar_ptr(n_cur, cur, 0);
   2338         des_const_char_ptr(n_encoding, (const char *)encoding, 1);
   2339         xmlResetLastError();
   2340         if (mem_base != xmlMemBlocks()) {
   2341             printf("Leak of %d blocks found in htmlParseDoc",
   2342 	           xmlMemBlocks() - mem_base);
   2343 	    test_ret++;
   2344             printf(" %d", n_cur);
   2345             printf(" %d", n_encoding);
   2346             printf("\n");
   2347         }
   2348     }
   2349     }
   2350     function_tests++;
   2351 #endif
   2352 
   2353     return(test_ret);
   2354 }
   2355 
   2356 
   2357 static int
   2358 test_htmlParseDocument(void) {
   2359     int test_ret = 0;
   2360 
   2361 #if defined(LIBXML_HTML_ENABLED)
   2362     int mem_base;
   2363     int ret_val;
   2364     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   2365     int n_ctxt;
   2366 
   2367     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   2368         mem_base = xmlMemBlocks();
   2369         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   2370 
   2371         ret_val = htmlParseDocument(ctxt);
   2372         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
   2373         desret_int(ret_val);
   2374         call_tests++;
   2375         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   2376         xmlResetLastError();
   2377         if (mem_base != xmlMemBlocks()) {
   2378             printf("Leak of %d blocks found in htmlParseDocument",
   2379 	           xmlMemBlocks() - mem_base);
   2380 	    test_ret++;
   2381             printf(" %d", n_ctxt);
   2382             printf("\n");
   2383         }
   2384     }
   2385     function_tests++;
   2386 #endif
   2387 
   2388     return(test_ret);
   2389 }
   2390 
   2391 
   2392 static int
   2393 test_htmlParseElement(void) {
   2394     int test_ret = 0;
   2395 
   2396 #if defined(LIBXML_HTML_ENABLED)
   2397     int mem_base;
   2398     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   2399     int n_ctxt;
   2400 
   2401     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   2402         mem_base = xmlMemBlocks();
   2403         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   2404 
   2405         htmlParseElement(ctxt);
   2406         call_tests++;
   2407         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   2408         xmlResetLastError();
   2409         if (mem_base != xmlMemBlocks()) {
   2410             printf("Leak of %d blocks found in htmlParseElement",
   2411 	           xmlMemBlocks() - mem_base);
   2412 	    test_ret++;
   2413             printf(" %d", n_ctxt);
   2414             printf("\n");
   2415         }
   2416     }
   2417     function_tests++;
   2418 #endif
   2419 
   2420     return(test_ret);
   2421 }
   2422 
   2423 
   2424 static int
   2425 test_htmlParseEntityRef(void) {
   2426     int test_ret = 0;
   2427 
   2428 #if defined(LIBXML_HTML_ENABLED)
   2429     int mem_base;
   2430     const htmlEntityDesc * ret_val;
   2431     htmlParserCtxtPtr ctxt; /* an HTML parser context */
   2432     int n_ctxt;
   2433     xmlChar ** str; /* location to store the entity name */
   2434     int n_str;
   2435 
   2436     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
   2437     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
   2438         mem_base = xmlMemBlocks();
   2439         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
   2440         str = gen_const_xmlChar_ptr_ptr(n_str, 1);
   2441 
   2442         ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
   2443         desret_const_htmlEntityDesc_ptr(ret_val);
   2444         call_tests++;
   2445         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
   2446         des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
   2447         xmlResetLastError();
   2448         if (mem_base != xmlMemBlocks()) {
   2449             printf("Leak of %d blocks found in htmlParseEntityRef",
   2450 	           xmlMemBlocks() - mem_base);
   2451 	    test_ret++;
   2452             printf(" %d", n_ctxt);
   2453             printf(" %d", n_str);
   2454             printf("\n");
   2455         }
   2456     }
   2457     }
   2458     function_tests++;
   2459 #endif
   2460 
   2461     return(test_ret);
   2462 }
   2463 
   2464 
   2465 static int
   2466 test_htmlParseFile(void) {
   2467     int test_ret = 0;
   2468 
   2469 #if defined(LIBXML_HTML_ENABLED)
   2470     htmlDocPtr ret_val;
   2471     const char * filename; /* the filename */
   2472     int n_filename;
   2473     char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
   2474     int n_encoding;
   2475 
   2476     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
   2477     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2478         filename = gen_filepath(n_filename, 0);
   2479         encoding = gen_const_char_ptr(n_encoding, 1);
   2480 
   2481         ret_val = htmlParseFile(filename, (const char *)encoding);
   2482         desret_htmlDocPtr(ret_val);
   2483         call_tests++;
   2484         des_filepath(n_filename, filename, 0);
   2485         des_const_char_ptr(n_encoding, (const char *)encoding, 1);
   2486         xmlResetLastError();
   2487     }
   2488     }
   2489     function_tests++;
   2490 #endif
   2491 
   2492     return(test_ret);
   2493 }
   2494 
   2495 
   2496 static int
   2497 test_htmlReadDoc(void) {
   2498     int test_ret = 0;
   2499 
   2500 #if defined(LIBXML_HTML_ENABLED)
   2501     int mem_base;
   2502     htmlDocPtr ret_val;
   2503     xmlChar * cur; /* a pointer to a zero terminated string */
   2504     int n_cur;
   2505     const char * URL; /* the base URL to use for the document */
   2506     int n_URL;
   2507     char * encoding; /* the document encoding, or NULL */
   2508     int n_encoding;
   2509     int options; /* a combination of htmlParserOption(s) */
   2510     int n_options;
   2511 
   2512     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
   2513     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
   2514     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2515     for (n_options = 0;n_options < gen_nb_int;n_options++) {
   2516         mem_base = xmlMemBlocks();
   2517         cur = gen_const_xmlChar_ptr(n_cur, 0);
   2518         URL = gen_filepath(n_URL, 1);
   2519         encoding = gen_const_char_ptr(n_encoding, 2);
   2520         options = gen_int(n_options, 3);
   2521 
   2522         ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
   2523         desret_htmlDocPtr(ret_val);
   2524         call_tests++;
   2525         des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
   2526         des_filepath(n_URL, URL, 1);
   2527         des_const_char_ptr(n_encoding, (const char *)encoding, 2);
   2528         des_int(n_options, options, 3);
   2529         xmlResetLastError();
   2530         if (mem_base != xmlMemBlocks()) {
   2531             printf("Leak of %d blocks found in htmlReadDoc",
   2532 	           xmlMemBlocks() - mem_base);
   2533 	    test_ret++;
   2534             printf(" %d", n_cur);
   2535             printf(" %d", n_URL);
   2536             printf(" %d", n_encoding);
   2537             printf(" %d", n_options);
   2538             printf("\n");
   2539         }
   2540     }
   2541     }
   2542     }
   2543     }
   2544     function_tests++;
   2545 #endif
   2546 
   2547     return(test_ret);
   2548 }
   2549 
   2550 
   2551 static int
   2552 test_htmlReadFile(void) {
   2553     int test_ret = 0;
   2554 
   2555 #if defined(LIBXML_HTML_ENABLED)
   2556     int mem_base;
   2557     htmlDocPtr ret_val;
   2558     const char * filename; /* a file or URL */
   2559     int n_filename;
   2560     char * encoding; /* the document encoding, or NULL */
   2561     int n_encoding;
   2562     int options; /* a combination of htmlParserOption(s) */
   2563     int n_options;
   2564 
   2565     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
   2566     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2567     for (n_options = 0;n_options < gen_nb_int;n_options++) {
   2568         mem_base = xmlMemBlocks();
   2569         filename = gen_filepath(n_filename, 0);
   2570         encoding = gen_const_char_ptr(n_encoding, 1);
   2571         options = gen_int(n_options, 2);
   2572 
   2573         ret_val = htmlReadFile(filename, (const char *)encoding, options);
   2574         desret_htmlDocPtr(ret_val);
   2575         call_tests++;
   2576         des_filepath(n_filename, filename, 0);
   2577         des_const_char_ptr(n_encoding, (const char *)encoding, 1);
   2578         des_int(n_options, options, 2);
   2579         xmlResetLastError();
   2580         if (mem_base != xmlMemBlocks()) {
   2581             printf("Leak of %d blocks found in htmlReadFile",
   2582 	           xmlMemBlocks() - mem_base);
   2583 	    test_ret++;
   2584             printf(" %d", n_filename);
   2585             printf(" %d", n_encoding);
   2586             printf(" %d", n_options);
   2587             printf("\n");
   2588         }
   2589     }
   2590     }
   2591     }
   2592     function_tests++;
   2593 #endif
   2594 
   2595     return(test_ret);
   2596 }
   2597 
   2598 
   2599 static int
   2600 test_htmlReadMemory(void) {
   2601     int test_ret = 0;
   2602 
   2603 #if defined(LIBXML_HTML_ENABLED)
   2604     int mem_base;
   2605     htmlDocPtr ret_val;
   2606     char * buffer; /* a pointer to a char array */
   2607     int n_buffer;
   2608     int size; /* the size of the array */
   2609     int n_size;
   2610     const char * URL; /* the base URL to use for the document */
   2611     int n_URL;
   2612     char * encoding; /* the document encoding, or NULL */
   2613     int n_encoding;
   2614     int options; /* a combination of htmlParserOption(s) */
   2615     int n_options;
   2616 
   2617     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
   2618     for (n_size = 0;n_size < gen_nb_int;n_size++) {
   2619     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
   2620     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2621     for (n_options = 0;n_options < gen_nb_int;n_options++) {
   2622         mem_base = xmlMemBlocks();
   2623         buffer = gen_const_char_ptr(n_buffer, 0);
   2624         size = gen_int(n_size, 1);
   2625         URL = gen_filepath(n_URL, 2);
   2626         encoding = gen_const_char_ptr(n_encoding, 3);
   2627         options = gen_int(n_options, 4);
   2628 
   2629         ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
   2630         desret_htmlDocPtr(ret_val);
   2631         call_tests++;
   2632         des_const_char_ptr(n_buffer, (const char *)buffer, 0);
   2633         des_int(n_size, size, 1);
   2634         des_filepath(n_URL, URL, 2);
   2635         des_const_char_ptr(n_encoding, (const char *)encoding, 3);
   2636         des_int(n_options, options, 4);
   2637         xmlResetLastError();
   2638         if (mem_base != xmlMemBlocks()) {
   2639             printf("Leak of %d blocks found in htmlReadMemory",
   2640 	           xmlMemBlocks() - mem_base);
   2641 	    test_ret++;
   2642             printf(" %d", n_buffer);
   2643             printf(" %d", n_size);
   2644             printf(" %d", n_URL);
   2645             printf(" %d", n_encoding);
   2646             printf(" %d", n_options);
   2647             printf("\n");
   2648         }
   2649     }
   2650     }
   2651     }
   2652     }
   2653     }
   2654     function_tests++;
   2655 #endif
   2656 
   2657     return(test_ret);
   2658 }
   2659 
   2660 
   2661 static int
   2662 test_htmlSAXParseDoc(void) {
   2663     int test_ret = 0;
   2664 
   2665 #if defined(LIBXML_HTML_ENABLED)
   2666     int mem_base;
   2667     htmlDocPtr ret_val;
   2668     xmlChar * cur; /* a pointer to an array of xmlChar */
   2669     int n_cur;
   2670     char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
   2671     int n_encoding;
   2672     htmlSAXHandlerPtr sax; /* the SAX handler block */
   2673     int n_sax;
   2674     void * userData; /* if using SAX, this pointer will be provided on callbacks. */
   2675     int n_userData;
   2676 
   2677     for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
   2678     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2679     for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
   2680     for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
   2681         mem_base = xmlMemBlocks();
   2682         cur = gen_xmlChar_ptr(n_cur, 0);
   2683         encoding = gen_const_char_ptr(n_encoding, 1);
   2684         sax = gen_htmlSAXHandlerPtr(n_sax, 2);
   2685         userData = gen_userdata(n_userData, 3);
   2686 
   2687         ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
   2688         desret_htmlDocPtr(ret_val);
   2689         call_tests++;
   2690         des_xmlChar_ptr(n_cur, cur, 0);
   2691         des_const_char_ptr(n_encoding, (const char *)encoding, 1);
   2692         des_htmlSAXHandlerPtr(n_sax, sax, 2);
   2693         des_userdata(n_userData, userData, 3);
   2694         xmlResetLastError();
   2695         if (mem_base != xmlMemBlocks()) {
   2696             printf("Leak of %d blocks found in htmlSAXParseDoc",
   2697 	           xmlMemBlocks() - mem_base);
   2698 	    test_ret++;
   2699             printf(" %d", n_cur);
   2700             printf(" %d", n_encoding);
   2701             printf(" %d", n_sax);
   2702             printf(" %d", n_userData);
   2703             printf("\n");
   2704         }
   2705     }
   2706     }
   2707     }
   2708     }
   2709     function_tests++;
   2710 #endif
   2711 
   2712     return(test_ret);
   2713 }
   2714 
   2715 
   2716 static int
   2717 test_htmlSAXParseFile(void) {
   2718     int test_ret = 0;
   2719 
   2720 #if defined(LIBXML_HTML_ENABLED)
   2721     int mem_base;
   2722     htmlDocPtr ret_val;
   2723     const char * filename; /* the filename */
   2724     int n_filename;
   2725     char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
   2726     int n_encoding;
   2727     htmlSAXHandlerPtr sax; /* the SAX handler block */
   2728     int n_sax;
   2729     void * userData; /* if using SAX, this pointer will be provided on callbacks. */
   2730     int n_userData;
   2731 
   2732     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
   2733     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2734     for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
   2735     for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
   2736         mem_base = xmlMemBlocks();
   2737         filename = gen_filepath(n_filename, 0);
   2738         encoding = gen_const_char_ptr(n_encoding, 1);
   2739         sax = gen_htmlSAXHandlerPtr(n_sax, 2);
   2740         userData = gen_userdata(n_userData, 3);
   2741 
   2742         ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
   2743         desret_htmlDocPtr(ret_val);
   2744         call_tests++;
   2745         des_filepath(n_filename, filename, 0);
   2746         des_const_char_ptr(n_encoding, (const char *)encoding, 1);
   2747         des_htmlSAXHandlerPtr(n_sax, sax, 2);
   2748         des_userdata(n_userData, userData, 3);
   2749         xmlResetLastError();
   2750         if (mem_base != xmlMemBlocks()) {
   2751             printf("Leak of %d blocks found in htmlSAXParseFile",
   2752 	           xmlMemBlocks() - mem_base);
   2753 	    test_ret++;
   2754             printf(" %d", n_filename);
   2755             printf(" %d", n_encoding);
   2756             printf(" %d", n_sax);
   2757             printf(" %d", n_userData);
   2758             printf("\n");
   2759         }
   2760     }
   2761     }
   2762     }
   2763     }
   2764     function_tests++;
   2765 #endif
   2766 
   2767     return(test_ret);
   2768 }
   2769 
   2770 
   2771 static int
   2772 test_htmlTagLookup(void) {
   2773     int test_ret = 0;
   2774 
   2775 
   2776     /* missing type support */
   2777     return(test_ret);
   2778 }
   2779 
   2780 static int
   2781 test_HTMLparser(void) {
   2782     int test_ret = 0;
   2783 
   2784     if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n");
   2785     test_ret += test_UTF8ToHtml();
   2786     test_ret += test_htmlAttrAllowed();
   2787     test_ret += test_htmlAutoCloseTag();
   2788     test_ret += test_htmlCreateMemoryParserCtxt();
   2789     test_ret += test_htmlCreatePushParserCtxt();
   2790     test_ret += test_htmlCtxtReadDoc();
   2791     test_ret += test_htmlCtxtReadFile();
   2792     test_ret += test_htmlCtxtReadMemory();
   2793     test_ret += test_htmlCtxtReset();
   2794     test_ret += test_htmlCtxtUseOptions();
   2795     test_ret += test_htmlElementAllowedHere();
   2796     test_ret += test_htmlElementStatusHere();
   2797     test_ret += test_htmlEncodeEntities();
   2798     test_ret += test_htmlEntityLookup();
   2799     test_ret += test_htmlEntityValueLookup();
   2800     test_ret += test_htmlHandleOmittedElem();
   2801     test_ret += test_htmlIsAutoClosed();
   2802     test_ret += test_htmlIsScriptAttribute();
   2803     test_ret += test_htmlNewParserCtxt();
   2804     test_ret += test_htmlNodeStatus();
   2805     test_ret += test_htmlParseCharRef();
   2806     test_ret += test_htmlParseChunk();
   2807     test_ret += test_htmlParseDoc();
   2808     test_ret += test_htmlParseDocument();
   2809     test_ret += test_htmlParseElement();
   2810     test_ret += test_htmlParseEntityRef();
   2811     test_ret += test_htmlParseFile();
   2812     test_ret += test_htmlReadDoc();
   2813     test_ret += test_htmlReadFile();
   2814     test_ret += test_htmlReadMemory();
   2815     test_ret += test_htmlSAXParseDoc();
   2816     test_ret += test_htmlSAXParseFile();
   2817     test_ret += test_htmlTagLookup();
   2818 
   2819     if (test_ret != 0)
   2820 	printf("Module HTMLparser: %d errors\n", test_ret);
   2821     return(test_ret);
   2822 }
   2823 
   2824 static int
   2825 test_htmlDocContentDumpFormatOutput(void) {
   2826     int test_ret = 0;
   2827 
   2828 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   2829     int mem_base;
   2830     xmlOutputBufferPtr buf; /* the HTML buffer output */
   2831     int n_buf;
   2832     xmlDocPtr cur; /* the document */
   2833     int n_cur;
   2834     char * encoding; /* the encoding string */
   2835     int n_encoding;
   2836     int format; /* should formatting spaces been added */
   2837     int n_format;
   2838 
   2839     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
   2840     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   2841     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2842     for (n_format = 0;n_format < gen_nb_int;n_format++) {
   2843         mem_base = xmlMemBlocks();
   2844         buf = gen_xmlOutputBufferPtr(n_buf, 0);
   2845         cur = gen_xmlDocPtr(n_cur, 1);
   2846         encoding = gen_const_char_ptr(n_encoding, 2);
   2847         format = gen_int(n_format, 3);
   2848 
   2849         htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
   2850         call_tests++;
   2851         des_xmlOutputBufferPtr(n_buf, buf, 0);
   2852         des_xmlDocPtr(n_cur, cur, 1);
   2853         des_const_char_ptr(n_encoding, (const char *)encoding, 2);
   2854         des_int(n_format, format, 3);
   2855         xmlResetLastError();
   2856         if (mem_base != xmlMemBlocks()) {
   2857             printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
   2858 	           xmlMemBlocks() - mem_base);
   2859 	    test_ret++;
   2860             printf(" %d", n_buf);
   2861             printf(" %d", n_cur);
   2862             printf(" %d", n_encoding);
   2863             printf(" %d", n_format);
   2864             printf("\n");
   2865         }
   2866     }
   2867     }
   2868     }
   2869     }
   2870     function_tests++;
   2871 #endif
   2872 
   2873     return(test_ret);
   2874 }
   2875 
   2876 
   2877 static int
   2878 test_htmlDocContentDumpOutput(void) {
   2879     int test_ret = 0;
   2880 
   2881 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   2882     int mem_base;
   2883     xmlOutputBufferPtr buf; /* the HTML buffer output */
   2884     int n_buf;
   2885     xmlDocPtr cur; /* the document */
   2886     int n_cur;
   2887     char * encoding; /* the encoding string */
   2888     int n_encoding;
   2889 
   2890     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
   2891     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   2892     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   2893         mem_base = xmlMemBlocks();
   2894         buf = gen_xmlOutputBufferPtr(n_buf, 0);
   2895         cur = gen_xmlDocPtr(n_cur, 1);
   2896         encoding = gen_const_char_ptr(n_encoding, 2);
   2897 
   2898         htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
   2899         call_tests++;
   2900         des_xmlOutputBufferPtr(n_buf, buf, 0);
   2901         des_xmlDocPtr(n_cur, cur, 1);
   2902         des_const_char_ptr(n_encoding, (const char *)encoding, 2);
   2903         xmlResetLastError();
   2904         if (mem_base != xmlMemBlocks()) {
   2905             printf("Leak of %d blocks found in htmlDocContentDumpOutput",
   2906 	           xmlMemBlocks() - mem_base);
   2907 	    test_ret++;
   2908             printf(" %d", n_buf);
   2909             printf(" %d", n_cur);
   2910             printf(" %d", n_encoding);
   2911             printf("\n");
   2912         }
   2913     }
   2914     }
   2915     }
   2916     function_tests++;
   2917 #endif
   2918 
   2919     return(test_ret);
   2920 }
   2921 
   2922 
   2923 static int
   2924 test_htmlDocDump(void) {
   2925     int test_ret = 0;
   2926 
   2927 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   2928     int mem_base;
   2929     int ret_val;
   2930     FILE * f; /* the FILE* */
   2931     int n_f;
   2932     xmlDocPtr cur; /* the document */
   2933     int n_cur;
   2934 
   2935     for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
   2936     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   2937         mem_base = xmlMemBlocks();
   2938         f = gen_FILE_ptr(n_f, 0);
   2939         cur = gen_xmlDocPtr(n_cur, 1);
   2940 
   2941         ret_val = htmlDocDump(f, cur);
   2942         desret_int(ret_val);
   2943         call_tests++;
   2944         des_FILE_ptr(n_f, f, 0);
   2945         des_xmlDocPtr(n_cur, cur, 1);
   2946         xmlResetLastError();
   2947         if (mem_base != xmlMemBlocks()) {
   2948             printf("Leak of %d blocks found in htmlDocDump",
   2949 	           xmlMemBlocks() - mem_base);
   2950 	    test_ret++;
   2951             printf(" %d", n_f);
   2952             printf(" %d", n_cur);
   2953             printf("\n");
   2954         }
   2955     }
   2956     }
   2957     function_tests++;
   2958 #endif
   2959 
   2960     return(test_ret);
   2961 }
   2962 
   2963 
   2964 #define gen_nb_xmlChar_ptr_ptr 1
   2965 static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   2966     return(NULL);
   2967 }
   2968 static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   2969 }
   2970 
   2971 static int
   2972 test_htmlDocDumpMemory(void) {
   2973     int test_ret = 0;
   2974 
   2975 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   2976     int mem_base;
   2977     xmlDocPtr cur; /* the document */
   2978     int n_cur;
   2979     xmlChar ** mem; /* OUT: the memory pointer */
   2980     int n_mem;
   2981     int * size; /* OUT: the memory length */
   2982     int n_size;
   2983 
   2984     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   2985     for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
   2986     for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
   2987         mem_base = xmlMemBlocks();
   2988         cur = gen_xmlDocPtr(n_cur, 0);
   2989         mem = gen_xmlChar_ptr_ptr(n_mem, 1);
   2990         size = gen_int_ptr(n_size, 2);
   2991 
   2992         htmlDocDumpMemory(cur, mem, size);
   2993         call_tests++;
   2994         des_xmlDocPtr(n_cur, cur, 0);
   2995         des_xmlChar_ptr_ptr(n_mem, mem, 1);
   2996         des_int_ptr(n_size, size, 2);
   2997         xmlResetLastError();
   2998         if (mem_base != xmlMemBlocks()) {
   2999             printf("Leak of %d blocks found in htmlDocDumpMemory",
   3000 	           xmlMemBlocks() - mem_base);
   3001 	    test_ret++;
   3002             printf(" %d", n_cur);
   3003             printf(" %d", n_mem);
   3004             printf(" %d", n_size);
   3005             printf("\n");
   3006         }
   3007     }
   3008     }
   3009     }
   3010     function_tests++;
   3011 #endif
   3012 
   3013     return(test_ret);
   3014 }
   3015 
   3016 
   3017 static int
   3018 test_htmlDocDumpMemoryFormat(void) {
   3019     int test_ret = 0;
   3020 
   3021 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3022     int mem_base;
   3023     xmlDocPtr cur; /* the document */
   3024     int n_cur;
   3025     xmlChar ** mem; /* OUT: the memory pointer */
   3026     int n_mem;
   3027     int * size; /* OUT: the memory length */
   3028     int n_size;
   3029     int format; /* should formatting spaces been added */
   3030     int n_format;
   3031 
   3032     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   3033     for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
   3034     for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
   3035     for (n_format = 0;n_format < gen_nb_int;n_format++) {
   3036         mem_base = xmlMemBlocks();
   3037         cur = gen_xmlDocPtr(n_cur, 0);
   3038         mem = gen_xmlChar_ptr_ptr(n_mem, 1);
   3039         size = gen_int_ptr(n_size, 2);
   3040         format = gen_int(n_format, 3);
   3041 
   3042         htmlDocDumpMemoryFormat(cur, mem, size, format);
   3043         call_tests++;
   3044         des_xmlDocPtr(n_cur, cur, 0);
   3045         des_xmlChar_ptr_ptr(n_mem, mem, 1);
   3046         des_int_ptr(n_size, size, 2);
   3047         des_int(n_format, format, 3);
   3048         xmlResetLastError();
   3049         if (mem_base != xmlMemBlocks()) {
   3050             printf("Leak of %d blocks found in htmlDocDumpMemoryFormat",
   3051 	           xmlMemBlocks() - mem_base);
   3052 	    test_ret++;
   3053             printf(" %d", n_cur);
   3054             printf(" %d", n_mem);
   3055             printf(" %d", n_size);
   3056             printf(" %d", n_format);
   3057             printf("\n");
   3058         }
   3059     }
   3060     }
   3061     }
   3062     }
   3063     function_tests++;
   3064 #endif
   3065 
   3066     return(test_ret);
   3067 }
   3068 
   3069 
   3070 static int
   3071 test_htmlGetMetaEncoding(void) {
   3072     int test_ret = 0;
   3073 
   3074 #if defined(LIBXML_HTML_ENABLED)
   3075     int mem_base;
   3076     const xmlChar * ret_val;
   3077     htmlDocPtr doc; /* the document */
   3078     int n_doc;
   3079 
   3080     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
   3081         mem_base = xmlMemBlocks();
   3082         doc = gen_htmlDocPtr(n_doc, 0);
   3083 
   3084         ret_val = htmlGetMetaEncoding(doc);
   3085         desret_const_xmlChar_ptr(ret_val);
   3086         call_tests++;
   3087         des_htmlDocPtr(n_doc, doc, 0);
   3088         xmlResetLastError();
   3089         if (mem_base != xmlMemBlocks()) {
   3090             printf("Leak of %d blocks found in htmlGetMetaEncoding",
   3091 	           xmlMemBlocks() - mem_base);
   3092 	    test_ret++;
   3093             printf(" %d", n_doc);
   3094             printf("\n");
   3095         }
   3096     }
   3097     function_tests++;
   3098 #endif
   3099 
   3100     return(test_ret);
   3101 }
   3102 
   3103 
   3104 static int
   3105 test_htmlIsBooleanAttr(void) {
   3106     int test_ret = 0;
   3107 
   3108 #if defined(LIBXML_HTML_ENABLED)
   3109     int mem_base;
   3110     int ret_val;
   3111     xmlChar * name; /* the name of the attribute to check */
   3112     int n_name;
   3113 
   3114     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   3115         mem_base = xmlMemBlocks();
   3116         name = gen_const_xmlChar_ptr(n_name, 0);
   3117 
   3118         ret_val = htmlIsBooleanAttr((const xmlChar *)name);
   3119         desret_int(ret_val);
   3120         call_tests++;
   3121         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
   3122         xmlResetLastError();
   3123         if (mem_base != xmlMemBlocks()) {
   3124             printf("Leak of %d blocks found in htmlIsBooleanAttr",
   3125 	           xmlMemBlocks() - mem_base);
   3126 	    test_ret++;
   3127             printf(" %d", n_name);
   3128             printf("\n");
   3129         }
   3130     }
   3131     function_tests++;
   3132 #endif
   3133 
   3134     return(test_ret);
   3135 }
   3136 
   3137 
   3138 static int
   3139 test_htmlNewDoc(void) {
   3140     int test_ret = 0;
   3141 
   3142 #if defined(LIBXML_HTML_ENABLED)
   3143     int mem_base;
   3144     htmlDocPtr ret_val;
   3145     xmlChar * URI; /* URI for the dtd, or NULL */
   3146     int n_URI;
   3147     xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
   3148     int n_ExternalID;
   3149 
   3150     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
   3151     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
   3152         mem_base = xmlMemBlocks();
   3153         URI = gen_const_xmlChar_ptr(n_URI, 0);
   3154         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
   3155 
   3156         ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
   3157         desret_htmlDocPtr(ret_val);
   3158         call_tests++;
   3159         des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
   3160         des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
   3161         xmlResetLastError();
   3162         if (mem_base != xmlMemBlocks()) {
   3163             printf("Leak of %d blocks found in htmlNewDoc",
   3164 	           xmlMemBlocks() - mem_base);
   3165 	    test_ret++;
   3166             printf(" %d", n_URI);
   3167             printf(" %d", n_ExternalID);
   3168             printf("\n");
   3169         }
   3170     }
   3171     }
   3172     function_tests++;
   3173 #endif
   3174 
   3175     return(test_ret);
   3176 }
   3177 
   3178 
   3179 static int
   3180 test_htmlNewDocNoDtD(void) {
   3181     int test_ret = 0;
   3182 
   3183 #if defined(LIBXML_HTML_ENABLED)
   3184     int mem_base;
   3185     htmlDocPtr ret_val;
   3186     xmlChar * URI; /* URI for the dtd, or NULL */
   3187     int n_URI;
   3188     xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
   3189     int n_ExternalID;
   3190 
   3191     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
   3192     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
   3193         mem_base = xmlMemBlocks();
   3194         URI = gen_const_xmlChar_ptr(n_URI, 0);
   3195         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
   3196 
   3197         ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
   3198         desret_htmlDocPtr(ret_val);
   3199         call_tests++;
   3200         des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
   3201         des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
   3202         xmlResetLastError();
   3203         if (mem_base != xmlMemBlocks()) {
   3204             printf("Leak of %d blocks found in htmlNewDocNoDtD",
   3205 	           xmlMemBlocks() - mem_base);
   3206 	    test_ret++;
   3207             printf(" %d", n_URI);
   3208             printf(" %d", n_ExternalID);
   3209             printf("\n");
   3210         }
   3211     }
   3212     }
   3213     function_tests++;
   3214 #endif
   3215 
   3216     return(test_ret);
   3217 }
   3218 
   3219 
   3220 static int
   3221 test_htmlNodeDump(void) {
   3222     int test_ret = 0;
   3223 
   3224 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3225     int mem_base;
   3226     int ret_val;
   3227     xmlBufferPtr buf; /* the HTML buffer output */
   3228     int n_buf;
   3229     xmlDocPtr doc; /* the document */
   3230     int n_doc;
   3231     xmlNodePtr cur; /* the current node */
   3232     int n_cur;
   3233 
   3234     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
   3235     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
   3236     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
   3237         mem_base = xmlMemBlocks();
   3238         buf = gen_xmlBufferPtr(n_buf, 0);
   3239         doc = gen_xmlDocPtr(n_doc, 1);
   3240         cur = gen_xmlNodePtr(n_cur, 2);
   3241 
   3242         ret_val = htmlNodeDump(buf, doc, cur);
   3243         desret_int(ret_val);
   3244         call_tests++;
   3245         des_xmlBufferPtr(n_buf, buf, 0);
   3246         des_xmlDocPtr(n_doc, doc, 1);
   3247         des_xmlNodePtr(n_cur, cur, 2);
   3248         xmlResetLastError();
   3249         if (mem_base != xmlMemBlocks()) {
   3250             printf("Leak of %d blocks found in htmlNodeDump",
   3251 	           xmlMemBlocks() - mem_base);
   3252 	    test_ret++;
   3253             printf(" %d", n_buf);
   3254             printf(" %d", n_doc);
   3255             printf(" %d", n_cur);
   3256             printf("\n");
   3257         }
   3258     }
   3259     }
   3260     }
   3261     function_tests++;
   3262 #endif
   3263 
   3264     return(test_ret);
   3265 }
   3266 
   3267 
   3268 static int
   3269 test_htmlNodeDumpFile(void) {
   3270     int test_ret = 0;
   3271 
   3272 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3273     int mem_base;
   3274     FILE * out; /* the FILE pointer */
   3275     int n_out;
   3276     xmlDocPtr doc; /* the document */
   3277     int n_doc;
   3278     xmlNodePtr cur; /* the current node */
   3279     int n_cur;
   3280 
   3281     for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
   3282     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
   3283     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
   3284         mem_base = xmlMemBlocks();
   3285         out = gen_FILE_ptr(n_out, 0);
   3286         doc = gen_xmlDocPtr(n_doc, 1);
   3287         cur = gen_xmlNodePtr(n_cur, 2);
   3288 
   3289         htmlNodeDumpFile(out, doc, cur);
   3290         call_tests++;
   3291         des_FILE_ptr(n_out, out, 0);
   3292         des_xmlDocPtr(n_doc, doc, 1);
   3293         des_xmlNodePtr(n_cur, cur, 2);
   3294         xmlResetLastError();
   3295         if (mem_base != xmlMemBlocks()) {
   3296             printf("Leak of %d blocks found in htmlNodeDumpFile",
   3297 	           xmlMemBlocks() - mem_base);
   3298 	    test_ret++;
   3299             printf(" %d", n_out);
   3300             printf(" %d", n_doc);
   3301             printf(" %d", n_cur);
   3302             printf("\n");
   3303         }
   3304     }
   3305     }
   3306     }
   3307     function_tests++;
   3308 #endif
   3309 
   3310     return(test_ret);
   3311 }
   3312 
   3313 
   3314 static int
   3315 test_htmlNodeDumpFileFormat(void) {
   3316     int test_ret = 0;
   3317 
   3318 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3319     int mem_base;
   3320     int ret_val;
   3321     FILE * out; /* the FILE pointer */
   3322     int n_out;
   3323     xmlDocPtr doc; /* the document */
   3324     int n_doc;
   3325     xmlNodePtr cur; /* the current node */
   3326     int n_cur;
   3327     char * encoding; /* the document encoding */
   3328     int n_encoding;
   3329     int format; /* should formatting spaces been added */
   3330     int n_format;
   3331 
   3332     for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
   3333     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
   3334     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
   3335     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   3336     for (n_format = 0;n_format < gen_nb_int;n_format++) {
   3337         mem_base = xmlMemBlocks();
   3338         out = gen_FILE_ptr(n_out, 0);
   3339         doc = gen_xmlDocPtr(n_doc, 1);
   3340         cur = gen_xmlNodePtr(n_cur, 2);
   3341         encoding = gen_const_char_ptr(n_encoding, 3);
   3342         format = gen_int(n_format, 4);
   3343 
   3344         ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
   3345         desret_int(ret_val);
   3346         call_tests++;
   3347         des_FILE_ptr(n_out, out, 0);
   3348         des_xmlDocPtr(n_doc, doc, 1);
   3349         des_xmlNodePtr(n_cur, cur, 2);
   3350         des_const_char_ptr(n_encoding, (const char *)encoding, 3);
   3351         des_int(n_format, format, 4);
   3352         xmlResetLastError();
   3353         if (mem_base != xmlMemBlocks()) {
   3354             printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
   3355 	           xmlMemBlocks() - mem_base);
   3356 	    test_ret++;
   3357             printf(" %d", n_out);
   3358             printf(" %d", n_doc);
   3359             printf(" %d", n_cur);
   3360             printf(" %d", n_encoding);
   3361             printf(" %d", n_format);
   3362             printf("\n");
   3363         }
   3364     }
   3365     }
   3366     }
   3367     }
   3368     }
   3369     function_tests++;
   3370 #endif
   3371 
   3372     return(test_ret);
   3373 }
   3374 
   3375 
   3376 static int
   3377 test_htmlNodeDumpFormatOutput(void) {
   3378     int test_ret = 0;
   3379 
   3380 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3381     int mem_base;
   3382     xmlOutputBufferPtr buf; /* the HTML buffer output */
   3383     int n_buf;
   3384     xmlDocPtr doc; /* the document */
   3385     int n_doc;
   3386     xmlNodePtr cur; /* the current node */
   3387     int n_cur;
   3388     char * encoding; /* the encoding string */
   3389     int n_encoding;
   3390     int format; /* should formatting spaces been added */
   3391     int n_format;
   3392 
   3393     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
   3394     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
   3395     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
   3396     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   3397     for (n_format = 0;n_format < gen_nb_int;n_format++) {
   3398         mem_base = xmlMemBlocks();
   3399         buf = gen_xmlOutputBufferPtr(n_buf, 0);
   3400         doc = gen_xmlDocPtr(n_doc, 1);
   3401         cur = gen_xmlNodePtr(n_cur, 2);
   3402         encoding = gen_const_char_ptr(n_encoding, 3);
   3403         format = gen_int(n_format, 4);
   3404 
   3405         htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
   3406         call_tests++;
   3407         des_xmlOutputBufferPtr(n_buf, buf, 0);
   3408         des_xmlDocPtr(n_doc, doc, 1);
   3409         des_xmlNodePtr(n_cur, cur, 2);
   3410         des_const_char_ptr(n_encoding, (const char *)encoding, 3);
   3411         des_int(n_format, format, 4);
   3412         xmlResetLastError();
   3413         if (mem_base != xmlMemBlocks()) {
   3414             printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
   3415 	           xmlMemBlocks() - mem_base);
   3416 	    test_ret++;
   3417             printf(" %d", n_buf);
   3418             printf(" %d", n_doc);
   3419             printf(" %d", n_cur);
   3420             printf(" %d", n_encoding);
   3421             printf(" %d", n_format);
   3422             printf("\n");
   3423         }
   3424     }
   3425     }
   3426     }
   3427     }
   3428     }
   3429     function_tests++;
   3430 #endif
   3431 
   3432     return(test_ret);
   3433 }
   3434 
   3435 
   3436 static int
   3437 test_htmlNodeDumpOutput(void) {
   3438     int test_ret = 0;
   3439 
   3440 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3441     int mem_base;
   3442     xmlOutputBufferPtr buf; /* the HTML buffer output */
   3443     int n_buf;
   3444     xmlDocPtr doc; /* the document */
   3445     int n_doc;
   3446     xmlNodePtr cur; /* the current node */
   3447     int n_cur;
   3448     char * encoding; /* the encoding string */
   3449     int n_encoding;
   3450 
   3451     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
   3452     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
   3453     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
   3454     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   3455         mem_base = xmlMemBlocks();
   3456         buf = gen_xmlOutputBufferPtr(n_buf, 0);
   3457         doc = gen_xmlDocPtr(n_doc, 1);
   3458         cur = gen_xmlNodePtr(n_cur, 2);
   3459         encoding = gen_const_char_ptr(n_encoding, 3);
   3460 
   3461         htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
   3462         call_tests++;
   3463         des_xmlOutputBufferPtr(n_buf, buf, 0);
   3464         des_xmlDocPtr(n_doc, doc, 1);
   3465         des_xmlNodePtr(n_cur, cur, 2);
   3466         des_const_char_ptr(n_encoding, (const char *)encoding, 3);
   3467         xmlResetLastError();
   3468         if (mem_base != xmlMemBlocks()) {
   3469             printf("Leak of %d blocks found in htmlNodeDumpOutput",
   3470 	           xmlMemBlocks() - mem_base);
   3471 	    test_ret++;
   3472             printf(" %d", n_buf);
   3473             printf(" %d", n_doc);
   3474             printf(" %d", n_cur);
   3475             printf(" %d", n_encoding);
   3476             printf("\n");
   3477         }
   3478     }
   3479     }
   3480     }
   3481     }
   3482     function_tests++;
   3483 #endif
   3484 
   3485     return(test_ret);
   3486 }
   3487 
   3488 
   3489 static int
   3490 test_htmlSaveFile(void) {
   3491     int test_ret = 0;
   3492 
   3493 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3494     int mem_base;
   3495     int ret_val;
   3496     const char * filename; /* the filename (or URL) */
   3497     int n_filename;
   3498     xmlDocPtr cur; /* the document */
   3499     int n_cur;
   3500 
   3501     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
   3502     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   3503         mem_base = xmlMemBlocks();
   3504         filename = gen_fileoutput(n_filename, 0);
   3505         cur = gen_xmlDocPtr(n_cur, 1);
   3506 
   3507         ret_val = htmlSaveFile(filename, cur);
   3508         desret_int(ret_val);
   3509         call_tests++;
   3510         des_fileoutput(n_filename, filename, 0);
   3511         des_xmlDocPtr(n_cur, cur, 1);
   3512         xmlResetLastError();
   3513         if (mem_base != xmlMemBlocks()) {
   3514             printf("Leak of %d blocks found in htmlSaveFile",
   3515 	           xmlMemBlocks() - mem_base);
   3516 	    test_ret++;
   3517             printf(" %d", n_filename);
   3518             printf(" %d", n_cur);
   3519             printf("\n");
   3520         }
   3521     }
   3522     }
   3523     function_tests++;
   3524 #endif
   3525 
   3526     return(test_ret);
   3527 }
   3528 
   3529 
   3530 static int
   3531 test_htmlSaveFileEnc(void) {
   3532     int test_ret = 0;
   3533 
   3534 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3535     int mem_base;
   3536     int ret_val;
   3537     const char * filename; /* the filename */
   3538     int n_filename;
   3539     xmlDocPtr cur; /* the document */
   3540     int n_cur;
   3541     char * encoding; /* the document encoding */
   3542     int n_encoding;
   3543 
   3544     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
   3545     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   3546     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   3547         mem_base = xmlMemBlocks();
   3548         filename = gen_fileoutput(n_filename, 0);
   3549         cur = gen_xmlDocPtr(n_cur, 1);
   3550         encoding = gen_const_char_ptr(n_encoding, 2);
   3551 
   3552         ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
   3553         desret_int(ret_val);
   3554         call_tests++;
   3555         des_fileoutput(n_filename, filename, 0);
   3556         des_xmlDocPtr(n_cur, cur, 1);
   3557         des_const_char_ptr(n_encoding, (const char *)encoding, 2);
   3558         xmlResetLastError();
   3559         if (mem_base != xmlMemBlocks()) {
   3560             printf("Leak of %d blocks found in htmlSaveFileEnc",
   3561 	           xmlMemBlocks() - mem_base);
   3562 	    test_ret++;
   3563             printf(" %d", n_filename);
   3564             printf(" %d", n_cur);
   3565             printf(" %d", n_encoding);
   3566             printf("\n");
   3567         }
   3568     }
   3569     }
   3570     }
   3571     function_tests++;
   3572 #endif
   3573 
   3574     return(test_ret);
   3575 }
   3576 
   3577 
   3578 static int
   3579 test_htmlSaveFileFormat(void) {
   3580     int test_ret = 0;
   3581 
   3582 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
   3583     int mem_base;
   3584     int ret_val;
   3585     const char * filename; /* the filename */
   3586     int n_filename;
   3587     xmlDocPtr cur; /* the document */
   3588     int n_cur;
   3589     char * encoding; /* the document encoding */
   3590     int n_encoding;
   3591     int format; /* should formatting spaces been added */
   3592     int n_format;
   3593 
   3594     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
   3595     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
   3596     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
   3597     for (n_format = 0;n_format < gen_nb_int;n_format++) {
   3598         mem_base = xmlMemBlocks();
   3599         filename = gen_fileoutput(n_filename, 0);
   3600         cur = gen_xmlDocPtr(n_cur, 1);
   3601         encoding = gen_const_char_ptr(n_encoding, 2);
   3602         format = gen_int(n_format, 3);
   3603 
   3604         ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
   3605         desret_int(ret_val);
   3606         call_tests++;
   3607         des_fileoutput(n_filename, filename, 0);
   3608         des_xmlDocPtr(n_cur, cur, 1);
   3609         des_const_char_ptr(n_encoding, (const char *)encoding, 2);
   3610         des_int(n_format, format, 3);
   3611         xmlResetLastError();
   3612         if (mem_base != xmlMemBlocks()) {
   3613             printf("Leak of %d blocks found in htmlSaveFileFormat",
   3614 	           xmlMemBlocks() - mem_base);
   3615 	    test_ret++;
   3616             printf(" %d", n_filename);
   3617             printf(" %d", n_cur);
   3618             printf(" %d", n_encoding);
   3619             printf(" %d", n_format);
   3620             printf("\n");
   3621         }
   3622     }
   3623     }
   3624     }
   3625     }
   3626     function_tests++;
   3627 #endif
   3628 
   3629     return(test_ret);
   3630 }
   3631 
   3632 
   3633 static int
   3634 test_htmlSetMetaEncoding(void) {
   3635     int test_ret = 0;
   3636 
   3637 #if defined(LIBXML_HTML_ENABLED)
   3638     int mem_base;
   3639     int ret_val;
   3640     htmlDocPtr doc; /* the document */
   3641     int n_doc;
   3642     xmlChar * encoding; /* the encoding string */
   3643     int n_encoding;
   3644 
   3645     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
   3646     for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
   3647         mem_base = xmlMemBlocks();
   3648         doc = gen_htmlDocPtr(n_doc, 0);
   3649         encoding = gen_const_xmlChar_ptr(n_encoding, 1);
   3650 
   3651         ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
   3652         desret_int(ret_val);
   3653         call_tests++;
   3654         des_htmlDocPtr(n_doc, doc, 0);
   3655         des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
   3656         xmlResetLastError();
   3657         if (mem_base != xmlMemBlocks()) {
   3658             printf("Leak of %d blocks found in htmlSetMetaEncoding",
   3659 	           xmlMemBlocks() - mem_base);
   3660 	    test_ret++;
   3661             printf(" %d", n_doc);
   3662             printf(" %d", n_encoding);
   3663             printf("\n");
   3664         }
   3665     }
   3666     }
   3667     function_tests++;
   3668 #endif
   3669 
   3670     return(test_ret);
   3671 }
   3672 
   3673 static int
   3674 test_HTMLtree(void) {
   3675     int test_ret = 0;
   3676 
   3677     if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n");
   3678     test_ret += test_htmlDocContentDumpFormatOutput();
   3679     test_ret += test_htmlDocContentDumpOutput();
   3680     test_ret += test_htmlDocDump();
   3681     test_ret += test_htmlDocDumpMemory();
   3682     test_ret += test_htmlDocDumpMemoryFormat();
   3683     test_ret += test_htmlGetMetaEncoding();
   3684     test_ret += test_htmlIsBooleanAttr();
   3685     test_ret += test_htmlNewDoc();
   3686     test_ret += test_htmlNewDocNoDtD();
   3687     test_ret += test_htmlNodeDump();
   3688     test_ret += test_htmlNodeDumpFile();
   3689     test_ret += test_htmlNodeDumpFileFormat();
   3690     test_ret += test_htmlNodeDumpFormatOutput();
   3691     test_ret += test_htmlNodeDumpOutput();
   3692     test_ret += test_htmlSaveFile();
   3693     test_ret += test_htmlSaveFileEnc();
   3694     test_ret += test_htmlSaveFileFormat();
   3695     test_ret += test_htmlSetMetaEncoding();
   3696 
   3697     if (test_ret != 0)
   3698 	printf("Module HTMLtree: %d errors\n", test_ret);
   3699     return(test_ret);
   3700 }
   3701 
   3702 static int
   3703 test_docbDefaultSAXHandlerInit(void) {
   3704     int test_ret = 0;
   3705 
   3706 #if defined(LIBXML_DOCB_ENABLED)
   3707 #ifdef LIBXML_DOCB_ENABLED
   3708     int mem_base;
   3709 
   3710         mem_base = xmlMemBlocks();
   3711 
   3712         docbDefaultSAXHandlerInit();
   3713         call_tests++;
   3714         xmlResetLastError();
   3715         if (mem_base != xmlMemBlocks()) {
   3716             printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
   3717 	           xmlMemBlocks() - mem_base);
   3718 	    test_ret++;
   3719             printf("\n");
   3720         }
   3721     function_tests++;
   3722 #endif
   3723 #endif
   3724 
   3725     return(test_ret);
   3726 }
   3727 
   3728 
   3729 static int
   3730 test_htmlDefaultSAXHandlerInit(void) {
   3731     int test_ret = 0;
   3732 
   3733 #if defined(LIBXML_HTML_ENABLED)
   3734 #ifdef LIBXML_HTML_ENABLED
   3735     int mem_base;
   3736 
   3737         mem_base = xmlMemBlocks();
   3738 
   3739         htmlDefaultSAXHandlerInit();
   3740         call_tests++;
   3741         xmlResetLastError();
   3742         if (mem_base != xmlMemBlocks()) {
   3743             printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
   3744 	           xmlMemBlocks() - mem_base);
   3745 	    test_ret++;
   3746             printf("\n");
   3747         }
   3748     function_tests++;
   3749 #endif
   3750 #endif
   3751 
   3752     return(test_ret);
   3753 }
   3754 
   3755 
   3756 static int
   3757 test_xmlDefaultSAXHandlerInit(void) {
   3758     int test_ret = 0;
   3759 
   3760     int mem_base;
   3761 
   3762         mem_base = xmlMemBlocks();
   3763 
   3764         xmlDefaultSAXHandlerInit();
   3765         call_tests++;
   3766         xmlResetLastError();
   3767         if (mem_base != xmlMemBlocks()) {
   3768             printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
   3769 	           xmlMemBlocks() - mem_base);
   3770 	    test_ret++;
   3771             printf("\n");
   3772         }
   3773     function_tests++;
   3774 
   3775     return(test_ret);
   3776 }
   3777 
   3778 
   3779 #define gen_nb_xmlEnumerationPtr 1
   3780 static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   3781     return(NULL);
   3782 }
   3783 static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   3784 }
   3785 
   3786 static int
   3787 test_xmlSAX2AttributeDecl(void) {
   3788     int test_ret = 0;
   3789 
   3790     int mem_base;
   3791     void * ctx; /* the user data (XML parser context) */
   3792     int n_ctx;
   3793     xmlChar * elem; /* the name of the element */
   3794     int n_elem;
   3795     xmlChar * fullname; /* the attribute name */
   3796     int n_fullname;
   3797     int type; /* the attribute type */
   3798     int n_type;
   3799     int def; /* the type of default value */
   3800     int n_def;
   3801     xmlChar * defaultValue; /* the attribute default value */
   3802     int n_defaultValue;
   3803     xmlEnumerationPtr tree; /* the tree of enumerated value set */
   3804     int n_tree;
   3805 
   3806     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   3807     for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
   3808     for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
   3809     for (n_type = 0;n_type < gen_nb_int;n_type++) {
   3810     for (n_def = 0;n_def < gen_nb_int;n_def++) {
   3811     for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
   3812     for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
   3813         mem_base = xmlMemBlocks();
   3814         ctx = gen_void_ptr(n_ctx, 0);
   3815         elem = gen_const_xmlChar_ptr(n_elem, 1);
   3816         fullname = gen_const_xmlChar_ptr(n_fullname, 2);
   3817         type = gen_int(n_type, 3);
   3818         def = gen_int(n_def, 4);
   3819         defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
   3820         tree = gen_xmlEnumerationPtr(n_tree, 6);
   3821 
   3822         xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
   3823         call_tests++;
   3824         des_void_ptr(n_ctx, ctx, 0);
   3825         des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
   3826         des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
   3827         des_int(n_type, type, 3);
   3828         des_int(n_def, def, 4);
   3829         des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
   3830         des_xmlEnumerationPtr(n_tree, tree, 6);
   3831         xmlResetLastError();
   3832         if (mem_base != xmlMemBlocks()) {
   3833             printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
   3834 	           xmlMemBlocks() - mem_base);
   3835 	    test_ret++;
   3836             printf(" %d", n_ctx);
   3837             printf(" %d", n_elem);
   3838             printf(" %d", n_fullname);
   3839             printf(" %d", n_type);
   3840             printf(" %d", n_def);
   3841             printf(" %d", n_defaultValue);
   3842             printf(" %d", n_tree);
   3843             printf("\n");
   3844         }
   3845     }
   3846     }
   3847     }
   3848     }
   3849     }
   3850     }
   3851     }
   3852     function_tests++;
   3853 
   3854     return(test_ret);
   3855 }
   3856 
   3857 
   3858 static int
   3859 test_xmlSAX2CDataBlock(void) {
   3860     int test_ret = 0;
   3861 
   3862     int mem_base;
   3863     void * ctx; /* the user data (XML parser context) */
   3864     int n_ctx;
   3865     xmlChar * value; /* The pcdata content */
   3866     int n_value;
   3867     int len; /* the block length */
   3868     int n_len;
   3869 
   3870     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   3871     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
   3872     for (n_len = 0;n_len < gen_nb_int;n_len++) {
   3873         mem_base = xmlMemBlocks();
   3874         ctx = gen_void_ptr(n_ctx, 0);
   3875         value = gen_const_xmlChar_ptr(n_value, 1);
   3876         len = gen_int(n_len, 2);
   3877 
   3878         xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
   3879         call_tests++;
   3880         des_void_ptr(n_ctx, ctx, 0);
   3881         des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
   3882         des_int(n_len, len, 2);
   3883         xmlResetLastError();
   3884         if (mem_base != xmlMemBlocks()) {
   3885             printf("Leak of %d blocks found in xmlSAX2CDataBlock",
   3886 	           xmlMemBlocks() - mem_base);
   3887 	    test_ret++;
   3888             printf(" %d", n_ctx);
   3889             printf(" %d", n_value);
   3890             printf(" %d", n_len);
   3891             printf("\n");
   3892         }
   3893     }
   3894     }
   3895     }
   3896     function_tests++;
   3897 
   3898     return(test_ret);
   3899 }
   3900 
   3901 
   3902 static int
   3903 test_xmlSAX2Characters(void) {
   3904     int test_ret = 0;
   3905 
   3906     int mem_base;
   3907     void * ctx; /* the user data (XML parser context) */
   3908     int n_ctx;
   3909     xmlChar * ch; /* a xmlChar string */
   3910     int n_ch;
   3911     int len; /* the number of xmlChar */
   3912     int n_len;
   3913 
   3914     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   3915     for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
   3916     for (n_len = 0;n_len < gen_nb_int;n_len++) {
   3917         mem_base = xmlMemBlocks();
   3918         ctx = gen_void_ptr(n_ctx, 0);
   3919         ch = gen_const_xmlChar_ptr(n_ch, 1);
   3920         len = gen_int(n_len, 2);
   3921 
   3922         xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
   3923         call_tests++;
   3924         des_void_ptr(n_ctx, ctx, 0);
   3925         des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
   3926         des_int(n_len, len, 2);
   3927         xmlResetLastError();
   3928         if (mem_base != xmlMemBlocks()) {
   3929             printf("Leak of %d blocks found in xmlSAX2Characters",
   3930 	           xmlMemBlocks() - mem_base);
   3931 	    test_ret++;
   3932             printf(" %d", n_ctx);
   3933             printf(" %d", n_ch);
   3934             printf(" %d", n_len);
   3935             printf("\n");
   3936         }
   3937     }
   3938     }
   3939     }
   3940     function_tests++;
   3941 
   3942     return(test_ret);
   3943 }
   3944 
   3945 
   3946 static int
   3947 test_xmlSAX2Comment(void) {
   3948     int test_ret = 0;
   3949 
   3950     int mem_base;
   3951     void * ctx; /* the user data (XML parser context) */
   3952     int n_ctx;
   3953     xmlChar * value; /* the xmlSAX2Comment content */
   3954     int n_value;
   3955 
   3956     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   3957     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
   3958         mem_base = xmlMemBlocks();
   3959         ctx = gen_void_ptr(n_ctx, 0);
   3960         value = gen_const_xmlChar_ptr(n_value, 1);
   3961 
   3962         xmlSAX2Comment(ctx, (const xmlChar *)value);
   3963         call_tests++;
   3964         des_void_ptr(n_ctx, ctx, 0);
   3965         des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
   3966         xmlResetLastError();
   3967         if (mem_base != xmlMemBlocks()) {
   3968             printf("Leak of %d blocks found in xmlSAX2Comment",
   3969 	           xmlMemBlocks() - mem_base);
   3970 	    test_ret++;
   3971             printf(" %d", n_ctx);
   3972             printf(" %d", n_value);
   3973             printf("\n");
   3974         }
   3975     }
   3976     }
   3977     function_tests++;
   3978 
   3979     return(test_ret);
   3980 }
   3981 
   3982 
   3983 static int
   3984 test_xmlSAX2ElementDecl(void) {
   3985     int test_ret = 0;
   3986 
   3987     int mem_base;
   3988     void * ctx; /* the user data (XML parser context) */
   3989     int n_ctx;
   3990     xmlChar * name; /* the element name */
   3991     int n_name;
   3992     int type; /* the element type */
   3993     int n_type;
   3994     xmlElementContentPtr content; /* the element value tree */
   3995     int n_content;
   3996 
   3997     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   3998     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   3999     for (n_type = 0;n_type < gen_nb_int;n_type++) {
   4000     for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
   4001         mem_base = xmlMemBlocks();
   4002         ctx = gen_void_ptr(n_ctx, 0);
   4003         name = gen_const_xmlChar_ptr(n_name, 1);
   4004         type = gen_int(n_type, 2);
   4005         content = gen_xmlElementContentPtr(n_content, 3);
   4006 
   4007         xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
   4008         call_tests++;
   4009         des_void_ptr(n_ctx, ctx, 0);
   4010         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4011         des_int(n_type, type, 2);
   4012         des_xmlElementContentPtr(n_content, content, 3);
   4013         xmlResetLastError();
   4014         if (mem_base != xmlMemBlocks()) {
   4015             printf("Leak of %d blocks found in xmlSAX2ElementDecl",
   4016 	           xmlMemBlocks() - mem_base);
   4017 	    test_ret++;
   4018             printf(" %d", n_ctx);
   4019             printf(" %d", n_name);
   4020             printf(" %d", n_type);
   4021             printf(" %d", n_content);
   4022             printf("\n");
   4023         }
   4024     }
   4025     }
   4026     }
   4027     }
   4028     function_tests++;
   4029 
   4030     return(test_ret);
   4031 }
   4032 
   4033 
   4034 static int
   4035 test_xmlSAX2EndDocument(void) {
   4036     int test_ret = 0;
   4037 
   4038     int mem_base;
   4039     void * ctx; /* the user data (XML parser context) */
   4040     int n_ctx;
   4041 
   4042     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4043         mem_base = xmlMemBlocks();
   4044         ctx = gen_void_ptr(n_ctx, 0);
   4045 
   4046         xmlSAX2EndDocument(ctx);
   4047         call_tests++;
   4048         des_void_ptr(n_ctx, ctx, 0);
   4049         xmlResetLastError();
   4050         if (mem_base != xmlMemBlocks()) {
   4051             printf("Leak of %d blocks found in xmlSAX2EndDocument",
   4052 	           xmlMemBlocks() - mem_base);
   4053 	    test_ret++;
   4054             printf(" %d", n_ctx);
   4055             printf("\n");
   4056         }
   4057     }
   4058     function_tests++;
   4059 
   4060     return(test_ret);
   4061 }
   4062 
   4063 
   4064 static int
   4065 test_xmlSAX2EndElement(void) {
   4066     int test_ret = 0;
   4067 
   4068 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
   4069 #ifdef LIBXML_SAX1_ENABLED
   4070     int mem_base;
   4071     void * ctx; /* the user data (XML parser context) */
   4072     int n_ctx;
   4073     xmlChar * name; /* The element name */
   4074     int n_name;
   4075 
   4076     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4077     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4078         mem_base = xmlMemBlocks();
   4079         ctx = gen_void_ptr(n_ctx, 0);
   4080         name = gen_const_xmlChar_ptr(n_name, 1);
   4081 
   4082         xmlSAX2EndElement(ctx, (const xmlChar *)name);
   4083         call_tests++;
   4084         des_void_ptr(n_ctx, ctx, 0);
   4085         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4086         xmlResetLastError();
   4087         if (mem_base != xmlMemBlocks()) {
   4088             printf("Leak of %d blocks found in xmlSAX2EndElement",
   4089 	           xmlMemBlocks() - mem_base);
   4090 	    test_ret++;
   4091             printf(" %d", n_ctx);
   4092             printf(" %d", n_name);
   4093             printf("\n");
   4094         }
   4095     }
   4096     }
   4097     function_tests++;
   4098 #endif
   4099 #endif
   4100 
   4101     return(test_ret);
   4102 }
   4103 
   4104 
   4105 static int
   4106 test_xmlSAX2EndElementNs(void) {
   4107     int test_ret = 0;
   4108 
   4109     int mem_base;
   4110     void * ctx; /* the user data (XML parser context) */
   4111     int n_ctx;
   4112     xmlChar * localname; /* the local name of the element */
   4113     int n_localname;
   4114     xmlChar * prefix; /* the element namespace prefix if available */
   4115     int n_prefix;
   4116     xmlChar * URI; /* the element namespace name if available */
   4117     int n_URI;
   4118 
   4119     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4120     for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
   4121     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
   4122     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
   4123         mem_base = xmlMemBlocks();
   4124         ctx = gen_void_ptr(n_ctx, 0);
   4125         localname = gen_const_xmlChar_ptr(n_localname, 1);
   4126         prefix = gen_const_xmlChar_ptr(n_prefix, 2);
   4127         URI = gen_const_xmlChar_ptr(n_URI, 3);
   4128 
   4129         xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
   4130         call_tests++;
   4131         des_void_ptr(n_ctx, ctx, 0);
   4132         des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
   4133         des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
   4134         des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
   4135         xmlResetLastError();
   4136         if (mem_base != xmlMemBlocks()) {
   4137             printf("Leak of %d blocks found in xmlSAX2EndElementNs",
   4138 	           xmlMemBlocks() - mem_base);
   4139 	    test_ret++;
   4140             printf(" %d", n_ctx);
   4141             printf(" %d", n_localname);
   4142             printf(" %d", n_prefix);
   4143             printf(" %d", n_URI);
   4144             printf("\n");
   4145         }
   4146     }
   4147     }
   4148     }
   4149     }
   4150     function_tests++;
   4151 
   4152     return(test_ret);
   4153 }
   4154 
   4155 
   4156 static int
   4157 test_xmlSAX2EntityDecl(void) {
   4158     int test_ret = 0;
   4159 
   4160     int mem_base;
   4161     void * ctx; /* the user data (XML parser context) */
   4162     int n_ctx;
   4163     xmlChar * name; /* the entity name */
   4164     int n_name;
   4165     int type; /* the entity type */
   4166     int n_type;
   4167     xmlChar * publicId; /* The public ID of the entity */
   4168     int n_publicId;
   4169     xmlChar * systemId; /* The system ID of the entity */
   4170     int n_systemId;
   4171     xmlChar * content; /* the entity value (without processing). */
   4172     int n_content;
   4173 
   4174     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4175     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4176     for (n_type = 0;n_type < gen_nb_int;n_type++) {
   4177     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
   4178     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
   4179     for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
   4180         mem_base = xmlMemBlocks();
   4181         ctx = gen_void_ptr(n_ctx, 0);
   4182         name = gen_const_xmlChar_ptr(n_name, 1);
   4183         type = gen_int(n_type, 2);
   4184         publicId = gen_const_xmlChar_ptr(n_publicId, 3);
   4185         systemId = gen_const_xmlChar_ptr(n_systemId, 4);
   4186         content = gen_xmlChar_ptr(n_content, 5);
   4187 
   4188         xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
   4189         call_tests++;
   4190         des_void_ptr(n_ctx, ctx, 0);
   4191         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4192         des_int(n_type, type, 2);
   4193         des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
   4194         des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
   4195         des_xmlChar_ptr(n_content, content, 5);
   4196         xmlResetLastError();
   4197         if (mem_base != xmlMemBlocks()) {
   4198             printf("Leak of %d blocks found in xmlSAX2EntityDecl",
   4199 	           xmlMemBlocks() - mem_base);
   4200 	    test_ret++;
   4201             printf(" %d", n_ctx);
   4202             printf(" %d", n_name);
   4203             printf(" %d", n_type);
   4204             printf(" %d", n_publicId);
   4205             printf(" %d", n_systemId);
   4206             printf(" %d", n_content);
   4207             printf("\n");
   4208         }
   4209     }
   4210     }
   4211     }
   4212     }
   4213     }
   4214     }
   4215     function_tests++;
   4216 
   4217     return(test_ret);
   4218 }
   4219 
   4220 
   4221 static int
   4222 test_xmlSAX2ExternalSubset(void) {
   4223     int test_ret = 0;
   4224 
   4225     int mem_base;
   4226     void * ctx; /* the user data (XML parser context) */
   4227     int n_ctx;
   4228     xmlChar * name; /* the root element name */
   4229     int n_name;
   4230     xmlChar * ExternalID; /* the external ID */
   4231     int n_ExternalID;
   4232     xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
   4233     int n_SystemID;
   4234 
   4235     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4236     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4237     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
   4238     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
   4239         mem_base = xmlMemBlocks();
   4240         ctx = gen_void_ptr(n_ctx, 0);
   4241         name = gen_const_xmlChar_ptr(n_name, 1);
   4242         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
   4243         SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
   4244 
   4245         xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
   4246         call_tests++;
   4247         des_void_ptr(n_ctx, ctx, 0);
   4248         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4249         des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
   4250         des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
   4251         xmlResetLastError();
   4252         if (mem_base != xmlMemBlocks()) {
   4253             printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
   4254 	           xmlMemBlocks() - mem_base);
   4255 	    test_ret++;
   4256             printf(" %d", n_ctx);
   4257             printf(" %d", n_name);
   4258             printf(" %d", n_ExternalID);
   4259             printf(" %d", n_SystemID);
   4260             printf("\n");
   4261         }
   4262     }
   4263     }
   4264     }
   4265     }
   4266     function_tests++;
   4267 
   4268     return(test_ret);
   4269 }
   4270 
   4271 
   4272 static int
   4273 test_xmlSAX2GetColumnNumber(void) {
   4274     int test_ret = 0;
   4275 
   4276     int mem_base;
   4277     int ret_val;
   4278     void * ctx; /* the user data (XML parser context) */
   4279     int n_ctx;
   4280 
   4281     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4282         mem_base = xmlMemBlocks();
   4283         ctx = gen_void_ptr(n_ctx, 0);
   4284 
   4285         ret_val = xmlSAX2GetColumnNumber(ctx);
   4286         desret_int(ret_val);
   4287         call_tests++;
   4288         des_void_ptr(n_ctx, ctx, 0);
   4289         xmlResetLastError();
   4290         if (mem_base != xmlMemBlocks()) {
   4291             printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
   4292 	           xmlMemBlocks() - mem_base);
   4293 	    test_ret++;
   4294             printf(" %d", n_ctx);
   4295             printf("\n");
   4296         }
   4297     }
   4298     function_tests++;
   4299 
   4300     return(test_ret);
   4301 }
   4302 
   4303 
   4304 static int
   4305 test_xmlSAX2GetEntity(void) {
   4306     int test_ret = 0;
   4307 
   4308     int mem_base;
   4309     xmlEntityPtr ret_val;
   4310     void * ctx; /* the user data (XML parser context) */
   4311     int n_ctx;
   4312     xmlChar * name; /* The entity name */
   4313     int n_name;
   4314 
   4315     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4316     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4317         mem_base = xmlMemBlocks();
   4318         ctx = gen_void_ptr(n_ctx, 0);
   4319         name = gen_const_xmlChar_ptr(n_name, 1);
   4320 
   4321         ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
   4322         desret_xmlEntityPtr(ret_val);
   4323         call_tests++;
   4324         des_void_ptr(n_ctx, ctx, 0);
   4325         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4326         xmlResetLastError();
   4327         if (mem_base != xmlMemBlocks()) {
   4328             printf("Leak of %d blocks found in xmlSAX2GetEntity",
   4329 	           xmlMemBlocks() - mem_base);
   4330 	    test_ret++;
   4331             printf(" %d", n_ctx);
   4332             printf(" %d", n_name);
   4333             printf("\n");
   4334         }
   4335     }
   4336     }
   4337     function_tests++;
   4338 
   4339     return(test_ret);
   4340 }
   4341 
   4342 
   4343 static int
   4344 test_xmlSAX2GetLineNumber(void) {
   4345     int test_ret = 0;
   4346 
   4347     int mem_base;
   4348     int ret_val;
   4349     void * ctx; /* the user data (XML parser context) */
   4350     int n_ctx;
   4351 
   4352     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4353         mem_base = xmlMemBlocks();
   4354         ctx = gen_void_ptr(n_ctx, 0);
   4355 
   4356         ret_val = xmlSAX2GetLineNumber(ctx);
   4357         desret_int(ret_val);
   4358         call_tests++;
   4359         des_void_ptr(n_ctx, ctx, 0);
   4360         xmlResetLastError();
   4361         if (mem_base != xmlMemBlocks()) {
   4362             printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
   4363 	           xmlMemBlocks() - mem_base);
   4364 	    test_ret++;
   4365             printf(" %d", n_ctx);
   4366             printf("\n");
   4367         }
   4368     }
   4369     function_tests++;
   4370 
   4371     return(test_ret);
   4372 }
   4373 
   4374 
   4375 static int
   4376 test_xmlSAX2GetParameterEntity(void) {
   4377     int test_ret = 0;
   4378 
   4379     int mem_base;
   4380     xmlEntityPtr ret_val;
   4381     void * ctx; /* the user data (XML parser context) */
   4382     int n_ctx;
   4383     xmlChar * name; /* The entity name */
   4384     int n_name;
   4385 
   4386     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4387     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4388         mem_base = xmlMemBlocks();
   4389         ctx = gen_void_ptr(n_ctx, 0);
   4390         name = gen_const_xmlChar_ptr(n_name, 1);
   4391 
   4392         ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
   4393         desret_xmlEntityPtr(ret_val);
   4394         call_tests++;
   4395         des_void_ptr(n_ctx, ctx, 0);
   4396         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4397         xmlResetLastError();
   4398         if (mem_base != xmlMemBlocks()) {
   4399             printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
   4400 	           xmlMemBlocks() - mem_base);
   4401 	    test_ret++;
   4402             printf(" %d", n_ctx);
   4403             printf(" %d", n_name);
   4404             printf("\n");
   4405         }
   4406     }
   4407     }
   4408     function_tests++;
   4409 
   4410     return(test_ret);
   4411 }
   4412 
   4413 
   4414 static int
   4415 test_xmlSAX2GetPublicId(void) {
   4416     int test_ret = 0;
   4417 
   4418     int mem_base;
   4419     const xmlChar * ret_val;
   4420     void * ctx; /* the user data (XML parser context) */
   4421     int n_ctx;
   4422 
   4423     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4424         mem_base = xmlMemBlocks();
   4425         ctx = gen_void_ptr(n_ctx, 0);
   4426 
   4427         ret_val = xmlSAX2GetPublicId(ctx);
   4428         desret_const_xmlChar_ptr(ret_val);
   4429         call_tests++;
   4430         des_void_ptr(n_ctx, ctx, 0);
   4431         xmlResetLastError();
   4432         if (mem_base != xmlMemBlocks()) {
   4433             printf("Leak of %d blocks found in xmlSAX2GetPublicId",
   4434 	           xmlMemBlocks() - mem_base);
   4435 	    test_ret++;
   4436             printf(" %d", n_ctx);
   4437             printf("\n");
   4438         }
   4439     }
   4440     function_tests++;
   4441 
   4442     return(test_ret);
   4443 }
   4444 
   4445 
   4446 static int
   4447 test_xmlSAX2GetSystemId(void) {
   4448     int test_ret = 0;
   4449 
   4450     int mem_base;
   4451     const xmlChar * ret_val;
   4452     void * ctx; /* the user data (XML parser context) */
   4453     int n_ctx;
   4454 
   4455     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4456         mem_base = xmlMemBlocks();
   4457         ctx = gen_void_ptr(n_ctx, 0);
   4458 
   4459         ret_val = xmlSAX2GetSystemId(ctx);
   4460         desret_const_xmlChar_ptr(ret_val);
   4461         call_tests++;
   4462         des_void_ptr(n_ctx, ctx, 0);
   4463         xmlResetLastError();
   4464         if (mem_base != xmlMemBlocks()) {
   4465             printf("Leak of %d blocks found in xmlSAX2GetSystemId",
   4466 	           xmlMemBlocks() - mem_base);
   4467 	    test_ret++;
   4468             printf(" %d", n_ctx);
   4469             printf("\n");
   4470         }
   4471     }
   4472     function_tests++;
   4473 
   4474     return(test_ret);
   4475 }
   4476 
   4477 
   4478 static int
   4479 test_xmlSAX2HasExternalSubset(void) {
   4480     int test_ret = 0;
   4481 
   4482     int mem_base;
   4483     int ret_val;
   4484     void * ctx; /* the user data (XML parser context) */
   4485     int n_ctx;
   4486 
   4487     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4488         mem_base = xmlMemBlocks();
   4489         ctx = gen_void_ptr(n_ctx, 0);
   4490 
   4491         ret_val = xmlSAX2HasExternalSubset(ctx);
   4492         desret_int(ret_val);
   4493         call_tests++;
   4494         des_void_ptr(n_ctx, ctx, 0);
   4495         xmlResetLastError();
   4496         if (mem_base != xmlMemBlocks()) {
   4497             printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
   4498 	           xmlMemBlocks() - mem_base);
   4499 	    test_ret++;
   4500             printf(" %d", n_ctx);
   4501             printf("\n");
   4502         }
   4503     }
   4504     function_tests++;
   4505 
   4506     return(test_ret);
   4507 }
   4508 
   4509 
   4510 static int
   4511 test_xmlSAX2HasInternalSubset(void) {
   4512     int test_ret = 0;
   4513 
   4514     int mem_base;
   4515     int ret_val;
   4516     void * ctx; /* the user data (XML parser context) */
   4517     int n_ctx;
   4518 
   4519     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4520         mem_base = xmlMemBlocks();
   4521         ctx = gen_void_ptr(n_ctx, 0);
   4522 
   4523         ret_val = xmlSAX2HasInternalSubset(ctx);
   4524         desret_int(ret_val);
   4525         call_tests++;
   4526         des_void_ptr(n_ctx, ctx, 0);
   4527         xmlResetLastError();
   4528         if (mem_base != xmlMemBlocks()) {
   4529             printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
   4530 	           xmlMemBlocks() - mem_base);
   4531 	    test_ret++;
   4532             printf(" %d", n_ctx);
   4533             printf("\n");
   4534         }
   4535     }
   4536     function_tests++;
   4537 
   4538     return(test_ret);
   4539 }
   4540 
   4541 
   4542 static int
   4543 test_xmlSAX2IgnorableWhitespace(void) {
   4544     int test_ret = 0;
   4545 
   4546     int mem_base;
   4547     void * ctx; /* the user data (XML parser context) */
   4548     int n_ctx;
   4549     xmlChar * ch; /* a xmlChar string */
   4550     int n_ch;
   4551     int len; /* the number of xmlChar */
   4552     int n_len;
   4553 
   4554     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4555     for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
   4556     for (n_len = 0;n_len < gen_nb_int;n_len++) {
   4557         mem_base = xmlMemBlocks();
   4558         ctx = gen_void_ptr(n_ctx, 0);
   4559         ch = gen_const_xmlChar_ptr(n_ch, 1);
   4560         len = gen_int(n_len, 2);
   4561 
   4562         xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
   4563         call_tests++;
   4564         des_void_ptr(n_ctx, ctx, 0);
   4565         des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
   4566         des_int(n_len, len, 2);
   4567         xmlResetLastError();
   4568         if (mem_base != xmlMemBlocks()) {
   4569             printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
   4570 	           xmlMemBlocks() - mem_base);
   4571 	    test_ret++;
   4572             printf(" %d", n_ctx);
   4573             printf(" %d", n_ch);
   4574             printf(" %d", n_len);
   4575             printf("\n");
   4576         }
   4577     }
   4578     }
   4579     }
   4580     function_tests++;
   4581 
   4582     return(test_ret);
   4583 }
   4584 
   4585 
   4586 #define gen_nb_xmlSAXHandler_ptr 1
   4587 static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   4588     return(NULL);
   4589 }
   4590 static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   4591 }
   4592 
   4593 static int
   4594 test_xmlSAX2InitDefaultSAXHandler(void) {
   4595     int test_ret = 0;
   4596 
   4597     int mem_base;
   4598     xmlSAXHandler * hdlr; /* the SAX handler */
   4599     int n_hdlr;
   4600     int warning; /* flag if non-zero sets the handler warning procedure */
   4601     int n_warning;
   4602 
   4603     for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
   4604     for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
   4605         mem_base = xmlMemBlocks();
   4606         hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
   4607         warning = gen_int(n_warning, 1);
   4608 
   4609         xmlSAX2InitDefaultSAXHandler(hdlr, warning);
   4610         call_tests++;
   4611         des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
   4612         des_int(n_warning, warning, 1);
   4613         xmlResetLastError();
   4614         if (mem_base != xmlMemBlocks()) {
   4615             printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
   4616 	           xmlMemBlocks() - mem_base);
   4617 	    test_ret++;
   4618             printf(" %d", n_hdlr);
   4619             printf(" %d", n_warning);
   4620             printf("\n");
   4621         }
   4622     }
   4623     }
   4624     function_tests++;
   4625 
   4626     return(test_ret);
   4627 }
   4628 
   4629 
   4630 static int
   4631 test_xmlSAX2InitDocbDefaultSAXHandler(void) {
   4632     int test_ret = 0;
   4633 
   4634 #if defined(LIBXML_DOCB_ENABLED)
   4635     int mem_base;
   4636     xmlSAXHandler * hdlr; /* the SAX handler */
   4637     int n_hdlr;
   4638 
   4639     for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
   4640         mem_base = xmlMemBlocks();
   4641         hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
   4642 
   4643         xmlSAX2InitDocbDefaultSAXHandler(hdlr);
   4644         call_tests++;
   4645         des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
   4646         xmlResetLastError();
   4647         if (mem_base != xmlMemBlocks()) {
   4648             printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
   4649 	           xmlMemBlocks() - mem_base);
   4650 	    test_ret++;
   4651             printf(" %d", n_hdlr);
   4652             printf("\n");
   4653         }
   4654     }
   4655     function_tests++;
   4656 #endif
   4657 
   4658     return(test_ret);
   4659 }
   4660 
   4661 
   4662 static int
   4663 test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
   4664     int test_ret = 0;
   4665 
   4666 #if defined(LIBXML_HTML_ENABLED)
   4667     int mem_base;
   4668     xmlSAXHandler * hdlr; /* the SAX handler */
   4669     int n_hdlr;
   4670 
   4671     for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
   4672         mem_base = xmlMemBlocks();
   4673         hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
   4674 
   4675         xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
   4676         call_tests++;
   4677         des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
   4678         xmlResetLastError();
   4679         if (mem_base != xmlMemBlocks()) {
   4680             printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
   4681 	           xmlMemBlocks() - mem_base);
   4682 	    test_ret++;
   4683             printf(" %d", n_hdlr);
   4684             printf("\n");
   4685         }
   4686     }
   4687     function_tests++;
   4688 #endif
   4689 
   4690     return(test_ret);
   4691 }
   4692 
   4693 
   4694 static int
   4695 test_xmlSAX2InternalSubset(void) {
   4696     int test_ret = 0;
   4697 
   4698     int mem_base;
   4699     void * ctx; /* the user data (XML parser context) */
   4700     int n_ctx;
   4701     xmlChar * name; /* the root element name */
   4702     int n_name;
   4703     xmlChar * ExternalID; /* the external ID */
   4704     int n_ExternalID;
   4705     xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
   4706     int n_SystemID;
   4707 
   4708     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4709     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4710     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
   4711     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
   4712         mem_base = xmlMemBlocks();
   4713         ctx = gen_void_ptr(n_ctx, 0);
   4714         name = gen_const_xmlChar_ptr(n_name, 1);
   4715         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
   4716         SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
   4717 
   4718         xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
   4719         call_tests++;
   4720         des_void_ptr(n_ctx, ctx, 0);
   4721         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4722         des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
   4723         des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
   4724         xmlResetLastError();
   4725         if (mem_base != xmlMemBlocks()) {
   4726             printf("Leak of %d blocks found in xmlSAX2InternalSubset",
   4727 	           xmlMemBlocks() - mem_base);
   4728 	    test_ret++;
   4729             printf(" %d", n_ctx);
   4730             printf(" %d", n_name);
   4731             printf(" %d", n_ExternalID);
   4732             printf(" %d", n_SystemID);
   4733             printf("\n");
   4734         }
   4735     }
   4736     }
   4737     }
   4738     }
   4739     function_tests++;
   4740 
   4741     return(test_ret);
   4742 }
   4743 
   4744 
   4745 static int
   4746 test_xmlSAX2IsStandalone(void) {
   4747     int test_ret = 0;
   4748 
   4749     int mem_base;
   4750     int ret_val;
   4751     void * ctx; /* the user data (XML parser context) */
   4752     int n_ctx;
   4753 
   4754     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4755         mem_base = xmlMemBlocks();
   4756         ctx = gen_void_ptr(n_ctx, 0);
   4757 
   4758         ret_val = xmlSAX2IsStandalone(ctx);
   4759         desret_int(ret_val);
   4760         call_tests++;
   4761         des_void_ptr(n_ctx, ctx, 0);
   4762         xmlResetLastError();
   4763         if (mem_base != xmlMemBlocks()) {
   4764             printf("Leak of %d blocks found in xmlSAX2IsStandalone",
   4765 	           xmlMemBlocks() - mem_base);
   4766 	    test_ret++;
   4767             printf(" %d", n_ctx);
   4768             printf("\n");
   4769         }
   4770     }
   4771     function_tests++;
   4772 
   4773     return(test_ret);
   4774 }
   4775 
   4776 
   4777 static int
   4778 test_xmlSAX2NotationDecl(void) {
   4779     int test_ret = 0;
   4780 
   4781     int mem_base;
   4782     void * ctx; /* the user data (XML parser context) */
   4783     int n_ctx;
   4784     xmlChar * name; /* The name of the notation */
   4785     int n_name;
   4786     xmlChar * publicId; /* The public ID of the entity */
   4787     int n_publicId;
   4788     xmlChar * systemId; /* The system ID of the entity */
   4789     int n_systemId;
   4790 
   4791     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4792     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4793     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
   4794     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
   4795         mem_base = xmlMemBlocks();
   4796         ctx = gen_void_ptr(n_ctx, 0);
   4797         name = gen_const_xmlChar_ptr(n_name, 1);
   4798         publicId = gen_const_xmlChar_ptr(n_publicId, 2);
   4799         systemId = gen_const_xmlChar_ptr(n_systemId, 3);
   4800 
   4801         xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
   4802         call_tests++;
   4803         des_void_ptr(n_ctx, ctx, 0);
   4804         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4805         des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
   4806         des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
   4807         xmlResetLastError();
   4808         if (mem_base != xmlMemBlocks()) {
   4809             printf("Leak of %d blocks found in xmlSAX2NotationDecl",
   4810 	           xmlMemBlocks() - mem_base);
   4811 	    test_ret++;
   4812             printf(" %d", n_ctx);
   4813             printf(" %d", n_name);
   4814             printf(" %d", n_publicId);
   4815             printf(" %d", n_systemId);
   4816             printf("\n");
   4817         }
   4818     }
   4819     }
   4820     }
   4821     }
   4822     function_tests++;
   4823 
   4824     return(test_ret);
   4825 }
   4826 
   4827 
   4828 static int
   4829 test_xmlSAX2ProcessingInstruction(void) {
   4830     int test_ret = 0;
   4831 
   4832     int mem_base;
   4833     void * ctx; /* the user data (XML parser context) */
   4834     int n_ctx;
   4835     xmlChar * target; /* the target name */
   4836     int n_target;
   4837     xmlChar * data; /* the PI data's */
   4838     int n_data;
   4839 
   4840     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4841     for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
   4842     for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
   4843         mem_base = xmlMemBlocks();
   4844         ctx = gen_void_ptr(n_ctx, 0);
   4845         target = gen_const_xmlChar_ptr(n_target, 1);
   4846         data = gen_const_xmlChar_ptr(n_data, 2);
   4847 
   4848         xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
   4849         call_tests++;
   4850         des_void_ptr(n_ctx, ctx, 0);
   4851         des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
   4852         des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
   4853         xmlResetLastError();
   4854         if (mem_base != xmlMemBlocks()) {
   4855             printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
   4856 	           xmlMemBlocks() - mem_base);
   4857 	    test_ret++;
   4858             printf(" %d", n_ctx);
   4859             printf(" %d", n_target);
   4860             printf(" %d", n_data);
   4861             printf("\n");
   4862         }
   4863     }
   4864     }
   4865     }
   4866     function_tests++;
   4867 
   4868     return(test_ret);
   4869 }
   4870 
   4871 
   4872 static int
   4873 test_xmlSAX2Reference(void) {
   4874     int test_ret = 0;
   4875 
   4876     int mem_base;
   4877     void * ctx; /* the user data (XML parser context) */
   4878     int n_ctx;
   4879     xmlChar * name; /* The entity name */
   4880     int n_name;
   4881 
   4882     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4883     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   4884         mem_base = xmlMemBlocks();
   4885         ctx = gen_void_ptr(n_ctx, 0);
   4886         name = gen_const_xmlChar_ptr(n_name, 1);
   4887 
   4888         xmlSAX2Reference(ctx, (const xmlChar *)name);
   4889         call_tests++;
   4890         des_void_ptr(n_ctx, ctx, 0);
   4891         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   4892         xmlResetLastError();
   4893         if (mem_base != xmlMemBlocks()) {
   4894             printf("Leak of %d blocks found in xmlSAX2Reference",
   4895 	           xmlMemBlocks() - mem_base);
   4896 	    test_ret++;
   4897             printf(" %d", n_ctx);
   4898             printf(" %d", n_name);
   4899             printf("\n");
   4900         }
   4901     }
   4902     }
   4903     function_tests++;
   4904 
   4905     return(test_ret);
   4906 }
   4907 
   4908 
   4909 static int
   4910 test_xmlSAX2ResolveEntity(void) {
   4911     int test_ret = 0;
   4912 
   4913     int mem_base;
   4914     xmlParserInputPtr ret_val;
   4915     void * ctx; /* the user data (XML parser context) */
   4916     int n_ctx;
   4917     xmlChar * publicId; /* The public ID of the entity */
   4918     int n_publicId;
   4919     xmlChar * systemId; /* The system ID of the entity */
   4920     int n_systemId;
   4921 
   4922     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4923     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
   4924     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
   4925         mem_base = xmlMemBlocks();
   4926         ctx = gen_void_ptr(n_ctx, 0);
   4927         publicId = gen_const_xmlChar_ptr(n_publicId, 1);
   4928         systemId = gen_const_xmlChar_ptr(n_systemId, 2);
   4929 
   4930         ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
   4931         desret_xmlParserInputPtr(ret_val);
   4932         call_tests++;
   4933         des_void_ptr(n_ctx, ctx, 0);
   4934         des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
   4935         des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
   4936         xmlResetLastError();
   4937         if (mem_base != xmlMemBlocks()) {
   4938             printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
   4939 	           xmlMemBlocks() - mem_base);
   4940 	    test_ret++;
   4941             printf(" %d", n_ctx);
   4942             printf(" %d", n_publicId);
   4943             printf(" %d", n_systemId);
   4944             printf("\n");
   4945         }
   4946     }
   4947     }
   4948     }
   4949     function_tests++;
   4950 
   4951     return(test_ret);
   4952 }
   4953 
   4954 
   4955 #define gen_nb_xmlSAXLocatorPtr 1
   4956 static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   4957     return(NULL);
   4958 }
   4959 static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
   4960 }
   4961 
   4962 static int
   4963 test_xmlSAX2SetDocumentLocator(void) {
   4964     int test_ret = 0;
   4965 
   4966     int mem_base;
   4967     void * ctx; /* the user data (XML parser context) */
   4968     int n_ctx;
   4969     xmlSAXLocatorPtr loc; /* A SAX Locator */
   4970     int n_loc;
   4971 
   4972     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   4973     for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
   4974         mem_base = xmlMemBlocks();
   4975         ctx = gen_void_ptr(n_ctx, 0);
   4976         loc = gen_xmlSAXLocatorPtr(n_loc, 1);
   4977 
   4978         xmlSAX2SetDocumentLocator(ctx, loc);
   4979         call_tests++;
   4980         des_void_ptr(n_ctx, ctx, 0);
   4981         des_xmlSAXLocatorPtr(n_loc, loc, 1);
   4982         xmlResetLastError();
   4983         if (mem_base != xmlMemBlocks()) {
   4984             printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
   4985 	           xmlMemBlocks() - mem_base);
   4986 	    test_ret++;
   4987             printf(" %d", n_ctx);
   4988             printf(" %d", n_loc);
   4989             printf("\n");
   4990         }
   4991     }
   4992     }
   4993     function_tests++;
   4994 
   4995     return(test_ret);
   4996 }
   4997 
   4998 
   4999 static int
   5000 test_xmlSAX2StartDocument(void) {
   5001     int test_ret = 0;
   5002 
   5003     int mem_base;
   5004     void * ctx; /* the user data (XML parser context) */
   5005     int n_ctx;
   5006 
   5007     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   5008         mem_base = xmlMemBlocks();
   5009         ctx = gen_void_ptr(n_ctx, 0);
   5010 
   5011         xmlSAX2StartDocument(ctx);
   5012         call_tests++;
   5013         des_void_ptr(n_ctx, ctx, 0);
   5014         xmlResetLastError();
   5015         if (mem_base != xmlMemBlocks()) {
   5016             printf("Leak of %d blocks found in xmlSAX2StartDocument",
   5017 	           xmlMemBlocks() - mem_base);
   5018 	    test_ret++;
   5019             printf(" %d", n_ctx);
   5020             printf("\n");
   5021         }
   5022     }
   5023     function_tests++;
   5024 
   5025     return(test_ret);
   5026 }
   5027 
   5028 
   5029 static int
   5030 test_xmlSAX2StartElement(void) {
   5031     int test_ret = 0;
   5032 
   5033 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
   5034 #ifdef LIBXML_SAX1_ENABLED
   5035     int mem_base;
   5036     void * ctx; /* the user data (XML parser context) */
   5037     int n_ctx;
   5038     xmlChar * fullname; /* The element name, including namespace prefix */
   5039     int n_fullname;
   5040     xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
   5041     int n_atts;
   5042 
   5043     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   5044     for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
   5045     for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
   5046         mem_base = xmlMemBlocks();
   5047         ctx = gen_void_ptr(n_ctx, 0);
   5048         fullname = gen_const_xmlChar_ptr(n_fullname, 1);
   5049         atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
   5050 
   5051         xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
   5052         call_tests++;
   5053         des_void_ptr(n_ctx, ctx, 0);
   5054         des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
   5055         des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
   5056         xmlResetLastError();
   5057         if (mem_base != xmlMemBlocks()) {
   5058             printf("Leak of %d blocks found in xmlSAX2StartElement",
   5059 	           xmlMemBlocks() - mem_base);
   5060 	    test_ret++;
   5061             printf(" %d", n_ctx);
   5062             printf(" %d", n_fullname);
   5063             printf(" %d", n_atts);
   5064             printf("\n");
   5065         }
   5066     }
   5067     }
   5068     }
   5069     function_tests++;
   5070 #endif
   5071 #endif
   5072 
   5073     return(test_ret);
   5074 }
   5075 
   5076 
   5077 static int
   5078 test_xmlSAX2StartElementNs(void) {
   5079     int test_ret = 0;
   5080 
   5081     int mem_base;
   5082     void * ctx; /* the user data (XML parser context) */
   5083     int n_ctx;
   5084     xmlChar * localname; /* the local name of the element */
   5085     int n_localname;
   5086     xmlChar * prefix; /* the element namespace prefix if available */
   5087     int n_prefix;
   5088     xmlChar * URI; /* the element namespace name if available */
   5089     int n_URI;
   5090     int nb_namespaces; /* number of namespace definitions on that node */
   5091     int n_nb_namespaces;
   5092     xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
   5093     int n_namespaces;
   5094     int nb_attributes; /* the number of attributes on that node */
   5095     int n_nb_attributes;
   5096     int nb_defaulted; /* the number of defaulted attributes. */
   5097     int n_nb_defaulted;
   5098     xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
   5099     int n_attributes;
   5100 
   5101     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   5102     for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
   5103     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
   5104     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
   5105     for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
   5106     for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
   5107     for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
   5108     for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
   5109     for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
   5110         mem_base = xmlMemBlocks();
   5111         ctx = gen_void_ptr(n_ctx, 0);
   5112         localname = gen_const_xmlChar_ptr(n_localname, 1);
   5113         prefix = gen_const_xmlChar_ptr(n_prefix, 2);
   5114         URI = gen_const_xmlChar_ptr(n_URI, 3);
   5115         nb_namespaces = gen_int(n_nb_namespaces, 4);
   5116         namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
   5117         nb_attributes = gen_int(n_nb_attributes, 6);
   5118         nb_defaulted = gen_int(n_nb_defaulted, 7);
   5119         attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
   5120 
   5121         xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes);
   5122         call_tests++;
   5123         des_void_ptr(n_ctx, ctx, 0);
   5124         des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
   5125         des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
   5126         des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
   5127         des_int(n_nb_namespaces, nb_namespaces, 4);
   5128         des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
   5129         des_int(n_nb_attributes, nb_attributes, 6);
   5130         des_int(n_nb_defaulted, nb_defaulted, 7);
   5131         des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
   5132         xmlResetLastError();
   5133         if (mem_base != xmlMemBlocks()) {
   5134             printf("Leak of %d blocks found in xmlSAX2StartElementNs",
   5135 	           xmlMemBlocks() - mem_base);
   5136 	    test_ret++;
   5137             printf(" %d", n_ctx);
   5138             printf(" %d", n_localname);
   5139             printf(" %d", n_prefix);
   5140             printf(" %d", n_URI);
   5141             printf(" %d", n_nb_namespaces);
   5142             printf(" %d", n_namespaces);
   5143             printf(" %d", n_nb_attributes);
   5144             printf(" %d", n_nb_defaulted);
   5145             printf(" %d", n_attributes);
   5146             printf("\n");
   5147         }
   5148     }
   5149     }
   5150     }
   5151     }
   5152     }
   5153     }
   5154     }
   5155     }
   5156     }
   5157     function_tests++;
   5158 
   5159     return(test_ret);
   5160 }
   5161 
   5162 
   5163 static int
   5164 test_xmlSAX2UnparsedEntityDecl(void) {
   5165     int test_ret = 0;
   5166 
   5167     int mem_base;
   5168     void * ctx; /* the user data (XML parser context) */
   5169     int n_ctx;
   5170     xmlChar * name; /* The name of the entity */
   5171     int n_name;
   5172     xmlChar * publicId; /* The public ID of the entity */
   5173     int n_publicId;
   5174     xmlChar * systemId; /* The system ID of the entity */
   5175     int n_systemId;
   5176     xmlChar * notationName; /* the name of the notation */
   5177     int n_notationName;
   5178 
   5179     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
   5180     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
   5181     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
   5182     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
   5183     for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
   5184         mem_base = xmlMemBlocks();
   5185         ctx = gen_void_ptr(n_ctx, 0);
   5186         name = gen_const_xmlChar_ptr(n_name, 1);
   5187         publicId = gen_const_xmlChar_ptr(n_publicId, 2);
   5188         systemId = gen_const_xmlChar_ptr(n_systemId, 3);
   5189         notationName = gen_const_xmlChar_ptr(n_notationName, 4);
   5190 
   5191         xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
   5192         call_tests++;
   5193         des_void_ptr(n_ctx, ctx, 0);
   5194         des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
   5195         des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
   5196         des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
   5197         des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
   5198         xmlResetLastError();
   5199         if (mem_base != xmlMemBlocks()) {
   5200             printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
   5201 	           xmlMemBlocks() - mem_base);
   5202 	    test_ret++;
   5203             printf(" %d", n_ctx);
   5204             printf(" %d", n_name);
   5205             printf(" %d", n_publicId);
   5206             printf(" %d", n_systemId);
   5207             printf(" %d", n_notationName);
   5208             printf("\n");
   5209         }
   5210     }
   5211     }
   5212     }
   5213     }
   5214     }
   5215     function_tests++;
   5216 
   5217     return(test_ret);
   5218 }
   5219 
   5220 
   5221 static int
   5222 test_xmlSAXDefaultVersion(void) {
   5223     int test_ret = 0;
   5224 
   5225 #if defined(LIBXML_SAX1_ENABLED)
   5226 #ifdef LIBXML_SAX1_ENABLED
   5227     int mem_base;
   5228     int ret_val;
   5229     int version; /* the version, 1 or 2 */
   5230     int n_version;
   5231 
   5232     for (n_version = 0;n_version < gen_nb_int;n_version++) {
   5233         mem_base = xmlMemBlocks();
   5234         version = gen_int(n_version, 0);
   5235 
   5236         ret_val = xmlSAXDefaultVersion(version);
   5237         desret_int(ret_val);
   5238         call_tests++;
   5239         des_int(n_version, version, 0);
   5240         xmlResetLastError();
   5241         if (mem_base != xmlMemBlocks()) {
   5242             printf("Leak of %d blocks found in xmlSAXDefaultVersion",
   5243 	           xmlMemBlocks() - mem_base);
   5244 	    test_ret++;
   5245             printf(" %d", n_version);
   5246             printf("\n");
   5247         }
   5248     }
   5249     function_tests++;
   5250 #endif
   5251 #endif
   5252 
   5253     return(test_ret);
   5254 }
   5255 
   5256 
   5257 static int
   5258 test_xmlSAXVersion(void) {
   5259     int test_ret = 0;
   5260 
   5261     int mem_base;
   5262     int ret_val;
   5263     xmlSAXHandler * hdlr; /* the SAX handler */
   5264     int n_hdlr;
   5265     int version; /* the version, 1 or 2 */
   5266     int n_version;
   5267 
   5268     for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
   5269     for (n_version = 0;n_version < gen_nb_int;n_version++) {
   5270         mem_base = xmlMemBlocks();
   5271         hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
   5272         version = gen_int(n_version, 1);
   5273 
   5274         ret_val = xmlSAXVersion(hdlr, version);
   5275         desret_int(ret_val);
   5276         call_tests++;
   5277         des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
   5278         des_int(n_version, version, 1);
   5279         xmlResetLastError();
   5280         if (mem_base != xmlMemBlocks()) {
   5281             printf("Leak of %d blocks found in xmlSAXVersion",
   5282 	           xmlMemBlocks() - mem_base);
   5283 	    test_ret++;
   5284             printf(" %d", n_hdlr);
   5285             printf(" %d", n_version);
   5286             printf("\n");
   5287         }
   5288     }
   5289     }
   5290     function_tests++;
   5291 
   5292     return(test_ret);
   5293 }
   5294 
   5295 static int
   5296 test_SAX2(void) {
   5297     int test_ret = 0;
   5298 
   5299     if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
   5300     test_ret += test_docbDefaultSAXHandlerInit();
   5301     test_ret += test_htmlDefaultSAXHandlerInit();
   5302     test_ret += test_xmlDefaultSAXHandlerInit();
   5303     test_ret += test_xmlSAX2AttributeDecl();
   5304     test_ret += test_xmlSAX2CDataBlock();
   5305     test_ret += test_xmlSAX2Characters();
   5306     test_ret += test_xmlSAX2Comment();
   5307     test_ret += test_xmlSAX2ElementDecl();
   5308     test_ret += test_xmlSAX2EndDocument();
   5309     test_ret += test_xmlSAX2EndElement();
   5310     test_ret += test_xmlSAX2EndElementNs();
   5311     test_ret += test_xmlSAX2EntityDecl();
   5312     test_ret += test_xmlSAX2ExternalSubset();
   5313     test_ret += test_xmlSAX2GetColumnNumber();
   5314     test_ret += test_xmlSAX2GetEntity();
   5315     test_ret += test_xmlSAX2GetLineNumber();
   5316     test_ret += test_xmlSAX2GetParameterEntity();
   5317     test_ret += test_xmlSAX2GetPublicId();
   5318     test_ret += test_xmlSAX2GetSystemId();
   5319     test_ret += test_xmlSAX2HasExternalSubset();
   5320     test_ret += test_xmlSAX2HasInternalSubset();
   5321     test_ret += test_xmlSAX2IgnorableWhitespace();
   5322     test_ret += test_xmlSAX2InitDefaultSAXHandler();
   5323     test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
   5324     test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
   5325     test_ret += test_xmlSAX2InternalSubset();
   5326     test_ret += test_xmlSAX2IsStandalone();
   5327     test_ret += test_xmlSAX2NotationDecl();
   5328     test_ret += test_xmlSAX2ProcessingInstruction();
   5329     test_ret += test_xmlSAX2Reference();
   5330     test_ret += test_xmlSAX2ResolveEntity();
   5331     test_ret += test_xmlSAX2SetDocumentLocator();
   5332     test_ret += test_xmlSAX2StartDocument();
   5333     test_ret += test_xmlSAX2StartElement();
   5334     test_ret += test_xmlSAX2StartElementNs();
   5335     test_ret += test_xmlSAX2UnparsedEntityDecl();
   5336     test_ret += test_xmlSAXDefaultVersion();
   5337     test_ret += test_xmlSAXVersion();
   5338 
   5339     if (test_ret != 0)
   5340 	printf("Module SAX2: %d errors\n", test_ret);
   5341     return(test_ret);
   5342 }
   5343 
   5344 static int
   5345