/* * testapi.c: libxml2 API tester program. * * Automatically generated by gentest.py from libxml2-api.xml * * See Copyright for the status of this software. * * daniel@veillard.com */ #include "libxml.h"#include <stdio.h> #include <stdlib.h> /* for putenv() */#include <string.h>#include <libxml/xmlerror.h>#include <libxml/relaxng.h> static int testlibxml2(void);static int test_module(const char *module); static int generic_errors = 0;static int call_tests = 0;static int function_tests = 0; static xmlChar chartab[1024];static int inttab[1024];static unsigned long longtab[1024]; static xmlDocPtr api_doc = NULL;static xmlDtdPtr api_dtd = NULL;static xmlNodePtr api_root = NULL;static xmlAttrPtr api_attr = NULL;static xmlNsPtr api_ns = NULL; static voidstructured_errors(void *userData ATTRIBUTE_UNUSED, xmlErrorPtr error ATTRIBUTE_UNUSED) { generic_errors++;} static voidfree_api_doc(void) { xmlFreeDoc(api_doc); api_doc = NULL; api_dtd = NULL; api_root = NULL; api_attr = NULL; api_ns = NULL;} static xmlDocPtrget_api_doc(void) { if (api_doc == NULL) { api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0); api_root = NULL; api_attr = NULL; } return(api_doc);} static xmlDtdPtrget_api_dtd(void) { if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) { get_api_doc(); if ((api_doc != NULL) && (api_doc->children != NULL) && (api_doc->children->type == XML_DTD_NODE)) api_dtd = (xmlDtdPtr) api_doc->children; } return(api_dtd);} static xmlNodePtrget_api_root(void) { if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { get_api_doc(); if ((api_doc != NULL) && (api_doc->children != NULL) && (api_doc->children->next != NULL) && (api_doc->children->next->type == XML_ELEMENT_NODE)) api_root = api_doc->children->next; } return(api_root);} static xmlNsPtrget_api_ns(void) { get_api_root(); if (api_root != NULL) api_ns = api_root->nsDef; return(api_ns);} static xmlAttrPtrget_api_attr(void) {#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) static int nr = 0; xmlChar name[20];#endif if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { get_api_root(); } if (api_root == NULL) return(NULL); if (api_root->properties != NULL) { api_attr = api_root->properties; return(api_root->properties); } api_attr = NULL;#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) snprintf((char *) name, 20, "foo%d", nr++); api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");#endif return(api_attr);} static int quiet = 0; int main(int argc, char **argv) { int ret; int blocks, mem; #ifdef HAVE_PUTENV /* access to the proxy can slow up regression tests a lot */ putenv((char *) "http_proxy=");#endif memset(chartab, 0, sizeof(chartab)); strncpy((char *) chartab, " chartab\n", 20); memset(inttab, 0, sizeof(inttab)); memset(longtab, 0, sizeof(longtab)); xmlInitParser();#ifdef LIBXML_SCHEMAS_ENABLED xmlRelaxNGInitTypes();#endif LIBXML_TEST_VERSION xmlSetStructuredErrorFunc(NULL, structured_errors); if (argc >= 2) { if (!strcmp(argv[1], "-q")) { quiet = 1; if (argc >= 3) ret = test_module(argv[2]); else ret = testlibxml2(); } else { ret = test_module(argv[1]); } } else ret = testlibxml2(); xmlCleanupParser(); blocks = xmlMemBlocks(); mem = xmlMemUsed(); if ((blocks != 0) || (mem != 0)) { printf("testapi leaked %d bytes in %d blocks\n", mem, blocks); } xmlMemoryDump(); return (ret != 0);} #include <libxml/HTMLparser.h>#include <libxml/HTMLtree.h>#include <libxml/catalog.h>#include <libxml/chvalid.h>#include <libxml/dict.h>#include <libxml/encoding.h>#include <libxml/entities.h>#include <libxml/hash.h>#include <libxml/list.h>#include <libxml/nanoftp.h>#include <libxml/nanohttp.h>#include <libxml/parser.h>#include <libxml/parserInternals.h>#include <libxml/pattern.h>#include <libxml/relaxng.h>#include <libxml/schemasInternals.h>#include <libxml/schematron.h>#include <libxml/tree.h>#include <libxml/uri.h>#include <libxml/valid.h>#include <libxml/xinclude.h>#include <libxml/xmlIO.h>#include <libxml/xmlerror.h>#include <libxml/xmlreader.h>#include <libxml/xmlsave.h>#include <libxml/xmlschemas.h>#include <libxml/xmlschemastypes.h>#include <libxml/xmlstring.h>#include <libxml/xmlwriter.h>#include <libxml/xpath.h>#include <libxml/xpointer.h>#include <libxml/debugXML.h> /* We manually define xmlErrMemory because it's normal declaration is "hidden" by #ifdef IN_LIBXML*/void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra); /* We need some "remote" addresses, but want to avoid getting into name resolution delays, so we use these*/#define REMOTE1GOOD "http://localhost/"#define REMOTE1BAD "http:http://http"#define REMOTE2GOOD "ftp://localhost/foo" #define gen_nb_void_ptr 2 static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { return(NULL);}static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #if 0#define gen_nb_const_void_ptr 2 static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((const void *) "immutable string"); return(NULL);}static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {}#endif #define gen_nb_userdata 3 static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((void *) &call_tests); if (no == 1) return((void *) -1); return(NULL);}static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_int 4 static int gen_int(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(-1); if (no == 3) return(122); return(-1);} static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_parseroptions 5 static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER); if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA); if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN); if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT); return(XML_PARSE_SAX1);} static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #if 0#define gen_nb_long 5 static long gen_long(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(-1); if (no == 3) return(122); return(-1);} static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {}#endif #define gen_nb_xmlChar 4 static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return('a'); if (no == 1) return(' '); if (no == 2) return((xmlChar) '\xf8'); return(0);} static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_unsigned_int 3 static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(122); return((unsigned int) -1);} static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_unsigned_long 4 static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(122); return((unsigned long) -1);} static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_double 4 static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(-1.1);#if defined(LIBXML_XPATH_ENABLED) if (no == 2) return(xmlXPathNAN);#endif return(-1);} static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_unsigned_long_ptr 2 static unsigned long *gen_unsigned_long_ptr(int no, int nr) { if (no == 0) return(&longtab[nr]); return(NULL);} static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_int_ptr 2 static int *gen_int_ptr(int no, int nr) { if (no == 0) return(&inttab[nr]); return(NULL);} static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_const_char_ptr 4 static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((char *) "foo"); if (no == 1) return((char *) "<foo/>"); if (no == 2) return((char *) "test/ent2"); return(NULL);}static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_xmlChar_ptr 2 static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(&chartab[0]); return(NULL);}static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_FILE_ptr 2 static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(fopen("test.out", "a+")); return(NULL);}static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { if (val != NULL) fclose(val);} #define gen_nb_debug_FILE_ptr 2static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { return(fopen("test.out", "a+"));}static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { if (val != NULL) fclose(val);} #define gen_nb_const_xmlChar_ptr 5 static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((xmlChar *) "foo"); if (no == 1) return((xmlChar *) "<foo/>"); if (no == 2) return((xmlChar *) "n" "\xf8" "ne"); if (no == 3) return((xmlChar *) " 2ab "); return(NULL);}static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_filepath 8 static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return("missing.xml"); if (no == 1) return("<foo/>"); if (no == 2) return("test/ent2"); if (no == 3) return("test/valid/REC-xml-19980210.xml"); if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd"); if (no == 5) return(REMOTE1GOOD); if (no == 6) return(REMOTE1BAD); return(NULL);}static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_eaten_name 2 static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlStrdup(BAD_CAST "eaten")); return(NULL);}static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_fileoutput 6 static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return("/missing.xml"); if (no == 1) return("<foo/>"); if (no == 2) return(REMOTE2GOOD); if (no == 3) return(REMOTE1GOOD); if (no == 4) return(REMOTE1BAD); return(NULL);}static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_xmlParserCtxtPtr 3static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlNewParserCtxt()); if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6)); return(NULL);}static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) { if (val != NULL) xmlFreeParserCtxt(val);} #define gen_nb_xmlSAXHandlerPtr 2static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {#ifdef LIBXML_SAX1_ENABLED if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);#endif return(NULL);}static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {} #define gen_nb_xmlValidCtxtPtr 2static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {#ifdef LIBXML_VALID_ENABLED if (no == 0) return(xmlNewValidCtxt());#endif return(NULL);}static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {#ifdef LIBXML_VALID_ENABLED if (val != NULL) xmlFreeValidCtxt(val);#endif} #define gen_nb_xmlParserInputBufferPtr 8 static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE)); if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE)); if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE)); if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE)); if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE)); if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE)); if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE)); return(NULL);}static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) { xmlFreeParserInputBuffer(val);} #define gen_nb_xmlDocPtr 4static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0)); if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL, 0)); return(NULL);}static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {Lines 1–500 of 52060. Load more
/* * testapi.c: libxml2 API tester program. * * Automatically generated by gentest.py from libxml2-api.xml * * See Copyright for the status of this software. * * daniel@veillard.com */ #include "libxml.h" #include <stdio.h> #include <stdlib.h> /* for putenv() */ #include <string.h> #include <libxml/xmlerror.h> #include <libxml/relaxng.h> static int testlibxml2(void); static int test_module(const char *module); static int generic_errors = 0; static int call_tests = 0; static int function_tests = 0; static xmlChar chartab[1024]; static int inttab[1024]; static unsigned long longtab[1024]; static xmlDocPtr api_doc = NULL; static xmlDtdPtr api_dtd = NULL; static xmlNodePtr api_root = NULL; static xmlAttrPtr api_attr = NULL; static xmlNsPtr api_ns = NULL; static void structured_errors(void *userData ATTRIBUTE_UNUSED, xmlErrorPtr error ATTRIBUTE_UNUSED) { generic_errors++; } static void free_api_doc(void) { xmlFreeDoc(api_doc); api_doc = NULL; api_dtd = NULL; api_root = NULL; api_attr = NULL; api_ns = NULL; } static xmlDocPtr get_api_doc(void) { if (api_doc == NULL) { api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0); api_root = NULL; api_attr = NULL; } return(api_doc); } static xmlDtdPtr get_api_dtd(void) { if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) { get_api_doc(); if ((api_doc != NULL) && (api_doc->children != NULL) && (api_doc->children->type == XML_DTD_NODE)) api_dtd = (xmlDtdPtr) api_doc->children; } return(api_dtd); } static xmlNodePtr get_api_root(void) { if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { get_api_doc(); if ((api_doc != NULL) && (api_doc->children != NULL) && (api_doc->children->next != NULL) && (api_doc->children->next->type == XML_ELEMENT_NODE)) api_root = api_doc->children->next; } return(api_root); } static xmlNsPtr get_api_ns(void) { get_api_root(); if (api_root != NULL) api_ns = api_root->nsDef; return(api_ns); } static xmlAttrPtr get_api_attr(void) { #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) static int nr = 0; xmlChar name[20]; #endif if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { get_api_root(); } if (api_root == NULL) return(NULL); if (api_root->properties != NULL) { api_attr = api_root->properties; return(api_root->properties); } api_attr = NULL; #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) snprintf((char *) name, 20, "foo%d", nr++); api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar"); #endif return(api_attr); } static int quiet = 0; int main(int argc, char **argv) { int ret; int blocks, mem; #ifdef HAVE_PUTENV /* access to the proxy can slow up regression tests a lot */ putenv((char *) "http_proxy="); #endif memset(chartab, 0, sizeof(chartab)); strncpy((char *) chartab, " chartab\n", 20); memset(inttab, 0, sizeof(inttab)); memset(longtab, 0, sizeof(longtab)); xmlInitParser(); #ifdef LIBXML_SCHEMAS_ENABLED xmlRelaxNGInitTypes(); #endif LIBXML_TEST_VERSION xmlSetStructuredErrorFunc(NULL, structured_errors); if (argc >= 2) { if (!strcmp(argv[1], "-q")) { quiet = 1; if (argc >= 3) ret = test_module(argv[2]); else ret = testlibxml2(); } else { ret = test_module(argv[1]); } } else ret = testlibxml2(); xmlCleanupParser(); blocks = xmlMemBlocks(); mem = xmlMemUsed(); if ((blocks != 0) || (mem != 0)) { printf("testapi leaked %d bytes in %d blocks\n", mem, blocks); } xmlMemoryDump(); return (ret != 0); } #include <libxml/HTMLparser.h> #include <libxml/HTMLtree.h> #include <libxml/catalog.h> #include <libxml/chvalid.h> #include <libxml/dict.h> #include <libxml/encoding.h> #include <libxml/entities.h> #include <libxml/hash.h> #include <libxml/list.h> #include <libxml/nanoftp.h> #include <libxml/nanohttp.h> #include <libxml/parser.h> #include <libxml/parserInternals.h> #include <libxml/pattern.h> #include <libxml/relaxng.h> #include <libxml/schemasInternals.h> #include <libxml/schematron.h> #include <libxml/tree.h> #include <libxml/uri.h> #include <libxml/valid.h> #include <libxml/xinclude.h> #include <libxml/xmlIO.h> #include <libxml/xmlerror.h> #include <libxml/xmlreader.h> #include <libxml/xmlsave.h> #include <libxml/xmlschemas.h> #include <libxml/xmlschemastypes.h> #include <libxml/xmlstring.h> #include <libxml/xmlwriter.h> #include <libxml/xpath.h> #include <libxml/xpointer.h> #include <libxml/debugXML.h> /* We manually define xmlErrMemory because it's normal declaration is "hidden" by #ifdef IN_LIBXML */ void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra); /* We need some "remote" addresses, but want to avoid getting into name resolution delays, so we use these */ #define REMOTE1GOOD "http://localhost/" #define REMOTE1BAD "http:http://http" #define REMOTE2GOOD "ftp://localhost/foo" #define gen_nb_void_ptr 2 static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { return(NULL); } static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #if 0 #define gen_nb_const_void_ptr 2 static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((const void *) "immutable string"); return(NULL); } static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #endif #define gen_nb_userdata 3 static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((void *) &call_tests); if (no == 1) return((void *) -1); return(NULL); } static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_int 4 static int gen_int(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(-1); if (no == 3) return(122); return(-1); } static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_parseroptions 5 static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER); if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA); if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN); if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT); return(XML_PARSE_SAX1); } static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #if 0 #define gen_nb_long 5 static long gen_long(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(-1); if (no == 3) return(122); return(-1); } static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #endif #define gen_nb_xmlChar 4 static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return('a'); if (no == 1) return(' '); if (no == 2) return((xmlChar) '\xf8'); return(0); } static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_unsigned_int 3 static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(122); return((unsigned int) -1); } static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_unsigned_long 4 static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(1); if (no == 2) return(122); return((unsigned long) -1); } static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_double 4 static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(0); if (no == 1) return(-1.1); #if defined(LIBXML_XPATH_ENABLED) if (no == 2) return(xmlXPathNAN); #endif return(-1); } static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_unsigned_long_ptr 2 static unsigned long *gen_unsigned_long_ptr(int no, int nr) { if (no == 0) return(&longtab[nr]); return(NULL); } static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_int_ptr 2 static int *gen_int_ptr(int no, int nr) { if (no == 0) return(&inttab[nr]); return(NULL); } static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_const_char_ptr 4 static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((char *) "foo"); if (no == 1) return((char *) "<foo/>"); if (no == 2) return((char *) "test/ent2"); return(NULL); } static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_xmlChar_ptr 2 static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(&chartab[0]); return(NULL); } static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_FILE_ptr 2 static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(fopen("test.out", "a+")); return(NULL); } static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { if (val != NULL) fclose(val); } #define gen_nb_debug_FILE_ptr 2 static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { return(fopen("test.out", "a+")); } static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { if (val != NULL) fclose(val); } #define gen_nb_const_xmlChar_ptr 5 static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return((xmlChar *) "foo"); if (no == 1) return((xmlChar *) "<foo/>"); if (no == 2) return((xmlChar *) "n" "\xf8" "ne"); if (no == 3) return((xmlChar *) " 2ab "); return(NULL); } static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_filepath 8 static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return("missing.xml"); if (no == 1) return("<foo/>"); if (no == 2) return("test/ent2"); if (no == 3) return("test/valid/REC-xml-19980210.xml"); if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd"); if (no == 5) return(REMOTE1GOOD); if (no == 6) return(REMOTE1BAD); return(NULL); } static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_eaten_name 2 static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlStrdup(BAD_CAST "eaten")); return(NULL); } static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_fileoutput 6 static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return("/missing.xml"); if (no == 1) return("<foo/>"); if (no == 2) return(REMOTE2GOOD); if (no == 3) return(REMOTE1GOOD); if (no == 4) return(REMOTE1BAD); return(NULL); } static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_xmlParserCtxtPtr 3 static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlNewParserCtxt()); if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6)); return(NULL); } static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) { if (val != NULL) xmlFreeParserCtxt(val); } #define gen_nb_xmlSAXHandlerPtr 2 static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) { #ifdef LIBXML_SAX1_ENABLED if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler); #endif return(NULL); } static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } #define gen_nb_xmlValidCtxtPtr 2 static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { #ifdef LIBXML_VALID_ENABLED if (no == 0) return(xmlNewValidCtxt()); #endif return(NULL); } static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) { #ifdef LIBXML_VALID_ENABLED if (val != NULL) xmlFreeValidCtxt(val); #endif } #define gen_nb_xmlParserInputBufferPtr 8 static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE)); if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE)); if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE)); if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE)); if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE)); if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE)); if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE)); return(NULL); } static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) { xmlFreeParserInputBuffer(val); } #define gen_nb_xmlDocPtr 4 static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0)); if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL, 0)); return(NULL); } static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {