You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2016/07/21 18:44:54 UTC
[35/52] [abbrv] [partial] nifi-minifi-cpp git commit: MINIFI-6: More
infra works
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7956696e/thirdparty/libxml2/check-relaxng-test-suite.py
----------------------------------------------------------------------
diff --git a/thirdparty/libxml2/check-relaxng-test-suite.py b/thirdparty/libxml2/check-relaxng-test-suite.py
new file mode 100755
index 0000000..f4a5a69
--- /dev/null
+++ b/thirdparty/libxml2/check-relaxng-test-suite.py
@@ -0,0 +1,394 @@
+#!/usr/bin/python
+import sys
+import time
+import os
+import string
+import StringIO
+sys.path.insert(0, "python")
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+debug = 0
+verbose = 0
+quiet = 1
+
+#
+# the testsuite description
+#
+CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/OASIS/spectest.xml")
+LOG="check-relaxng-test-suite.log"
+RES="relaxng-test-results.xml"
+
+log = open(LOG, "w")
+nb_schemas_tests = 0
+nb_schemas_success = 0
+nb_schemas_failed = 0
+nb_instances_tests = 0
+nb_instances_success = 0
+nb_instances_failed = 0
+
+libxml2.lineNumbersDefault(1)
+#
+# Error and warnng callbacks
+#
+def callback(ctx, str):
+ global log
+ log.write("%s%s" % (ctx, str))
+
+libxml2.registerErrorHandler(callback, "")
+
+#
+# Resolver callback
+#
+resources = {}
+def resolver(URL, ID, ctxt):
+ global resources
+
+ if string.find(URL, '#') != -1:
+ URL = URL[0:string.find(URL, '#')]
+ if resources.has_key(URL):
+ return(StringIO.StringIO(resources[URL]))
+ log.write("Resolver failure: asked %s\n" % (URL))
+ log.write("resources: %s\n" % (resources))
+ return None
+
+#
+# Load the previous results
+#
+#results = {}
+#previous = {}
+#
+#try:
+# res = libxml2.parseFile(RES)
+#except:
+# log.write("Could not parse %s" % (RES))
+
+#
+# handle a valid instance
+#
+def handle_valid(node, schema):
+ global log
+ global nb_instances_success
+ global nb_instances_failed
+
+ instance = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ instance = instance + child.serialize()
+ child = child.next
+
+ try:
+ doc = libxml2.parseDoc(instance)
+ except:
+ doc = None
+
+ if doc == None:
+ log.write("\nFailed to parse correct instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ return
+
+ try:
+ ctxt = schema.relaxNGNewValidCtxt()
+ ret = doc.relaxNGValidateDoc(ctxt)
+ except:
+ ret = -1
+ if ret != 0:
+ log.write("\nFailed to validate correct instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ else:
+ nb_instances_success = nb_instances_success + 1
+ doc.freeDoc()
+
+#
+# handle an invalid instance
+#
+def handle_invalid(node, schema):
+ global log
+ global nb_instances_success
+ global nb_instances_failed
+
+ instance = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ instance = instance + child.serialize()
+ child = child.next
+
+ try:
+ doc = libxml2.parseDoc(instance)
+ except:
+ doc = None
+
+ if doc == None:
+ log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ return
+
+ try:
+ ctxt = schema.relaxNGNewValidCtxt()
+ ret = doc.relaxNGValidateDoc(ctxt)
+ except:
+ ret = -1
+ if ret == 0:
+ log.write("\nFailed to detect validation problem in instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ else:
+ nb_instances_success = nb_instances_success + 1
+ doc.freeDoc()
+
+#
+# handle an incorrect test
+#
+def handle_correct(node):
+ global log
+ global nb_schemas_success
+ global nb_schemas_failed
+
+ schema = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ schema = schema + child.serialize()
+ child = child.next
+
+ try:
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
+ except:
+ rngs = None
+ if rngs == None:
+ log.write("\nFailed to compile correct schema:\n-----\n")
+ log.write(schema)
+ log.write("\n-----\n")
+ nb_schemas_failed = nb_schemas_failed + 1
+ else:
+ nb_schemas_success = nb_schemas_success + 1
+ return rngs
+
+def handle_incorrect(node):
+ global log
+ global nb_schemas_success
+ global nb_schemas_failed
+
+ schema = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ schema = schema + child.serialize()
+ child = child.next
+
+ try:
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
+ except:
+ rngs = None
+ if rngs != None:
+ log.write("\nFailed to detect schema error in:\n-----\n")
+ log.write(schema)
+ log.write("\n-----\n")
+ nb_schemas_failed = nb_schemas_failed + 1
+ else:
+# log.write("\nSuccess detecting schema error in:\n-----\n")
+# log.write(schema)
+# log.write("\n-----\n")
+ nb_schemas_success = nb_schemas_success + 1
+ return None
+
+#
+# resource handling: keep a dictionary of URL->string mappings
+#
+def handle_resource(node, dir):
+ global resources
+
+ try:
+ name = node.prop('name')
+ except:
+ name = None
+
+ if name == None or name == '':
+ log.write("resource has no name")
+ return;
+
+ if dir != None:
+# name = libxml2.buildURI(name, dir)
+ name = dir + '/' + name
+
+ res = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ res = res + child.serialize()
+ child = child.next
+ resources[name] = res
+
+#
+# dir handling: pseudo directory resources
+#
+def handle_dir(node, dir):
+ try:
+ name = node.prop('name')
+ except:
+ name = None
+
+ if name == None or name == '':
+ log.write("resource has no name")
+ return;
+
+ if dir != None:
+# name = libxml2.buildURI(name, dir)
+ name = dir + '/' + name
+
+ dirs = node.xpathEval('dir')
+ for dir in dirs:
+ handle_dir(dir, name)
+ res = node.xpathEval('resource')
+ for r in res:
+ handle_resource(r, name)
+
+#
+# handle a testCase element
+#
+def handle_testCase(node):
+ global nb_schemas_tests
+ global nb_instances_tests
+ global resources
+
+ sections = node.xpathEval('string(section)')
+ log.write("\n ======== test %d line %d section %s ==========\n" % (
+
+ nb_schemas_tests, node.lineNo(), sections))
+ resources = {}
+ if debug:
+ print "test %d line %d" % (nb_schemas_tests, node.lineNo())
+
+ dirs = node.xpathEval('dir')
+ for dir in dirs:
+ handle_dir(dir, None)
+ res = node.xpathEval('resource')
+ for r in res:
+ handle_resource(r, None)
+
+ tsts = node.xpathEval('incorrect')
+ if tsts != []:
+ if len(tsts) != 1:
+ print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
+ schema = handle_incorrect(tsts[0])
+ else:
+ tsts = node.xpathEval('correct')
+ if tsts != []:
+ if len(tsts) != 1:
+ print "warning test line %d has more than one <correct> example"% (node.lineNo())
+ schema = handle_correct(tsts[0])
+ else:
+ print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
+
+ nb_schemas_tests = nb_schemas_tests + 1;
+
+ valids = node.xpathEval('valid')
+ invalids = node.xpathEval('invalid')
+ nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
+ if schema != None:
+ for valid in valids:
+ handle_valid(valid, schema)
+ for invalid in invalids:
+ handle_invalid(invalid, schema)
+
+
+#
+# handle a testSuite element
+#
+def handle_testSuite(node, level = 0):
+ global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
+ global nb_instances_tests, nb_instances_success, nb_instances_failed
+ global quiet
+ if level >= 1:
+ old_schemas_tests = nb_schemas_tests
+ old_schemas_success = nb_schemas_success
+ old_schemas_failed = nb_schemas_failed
+ old_instances_tests = nb_instances_tests
+ old_instances_success = nb_instances_success
+ old_instances_failed = nb_instances_failed
+
+ docs = node.xpathEval('documentation')
+ authors = node.xpathEval('author')
+ if docs != []:
+ msg = ""
+ for doc in docs:
+ msg = msg + doc.content + " "
+ if authors != []:
+ msg = msg + "written by "
+ for author in authors:
+ msg = msg + author.content + " "
+ if quiet == 0:
+ print msg
+ sections = node.xpathEval('section')
+ if sections != [] and level <= 0:
+ msg = ""
+ for section in sections:
+ msg = msg + section.content + " "
+ if quiet == 0:
+ print "Tests for section %s" % (msg)
+ for test in node.xpathEval('testCase'):
+ handle_testCase(test)
+ for test in node.xpathEval('testSuite'):
+ handle_testSuite(test, level + 1)
+
+
+ if verbose and level >= 1 and sections != []:
+ msg = ""
+ for section in sections:
+ msg = msg + section.content + " "
+ print "Result of tests for section %s" % (msg)
+ if nb_schemas_tests != old_schemas_tests:
+ print "found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests - old_schemas_tests,
+ nb_schemas_success - old_schemas_success,
+ nb_schemas_failed - old_schemas_failed)
+ if nb_instances_tests != old_instances_tests:
+ print "found %d test instances: %d success %d failures" % (
+ nb_instances_tests - old_instances_tests,
+ nb_instances_success - old_instances_success,
+ nb_instances_failed - old_instances_failed)
+#
+# Parse the conf file
+#
+libxml2.substituteEntitiesDefault(1);
+testsuite = libxml2.parseFile(CONF)
+libxml2.setEntityLoader(resolver)
+root = testsuite.getRootElement()
+if root.name != 'testSuite':
+ print "%s doesn't start with a testSuite element, aborting" % (CONF)
+ sys.exit(1)
+if quiet == 0:
+ print "Running Relax NG testsuite"
+handle_testSuite(root)
+
+if quiet == 0:
+ print "\nTOTAL:\n"
+if quiet == 0 or nb_schemas_failed != 0:
+ print "found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
+if quiet == 0 or nb_instances_failed != 0:
+ print "found %d test instances: %d success %d failures" % (
+ nb_instances_tests, nb_instances_success, nb_instances_failed)
+
+testsuite.freeDoc()
+
+# Memory debug specific
+libxml2.relaxNGCleanupTypes()
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ if quiet == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7956696e/thirdparty/libxml2/check-relaxng-test-suite2.py
----------------------------------------------------------------------
diff --git a/thirdparty/libxml2/check-relaxng-test-suite2.py b/thirdparty/libxml2/check-relaxng-test-suite2.py
new file mode 100755
index 0000000..8618db7
--- /dev/null
+++ b/thirdparty/libxml2/check-relaxng-test-suite2.py
@@ -0,0 +1,418 @@
+#!/usr/bin/python
+import sys
+import time
+import os
+import string
+import StringIO
+sys.path.insert(0, "python")
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+debug = 0
+quiet = 1
+
+#
+# the testsuite description
+#
+CONF=os.path.join(os.path.dirname(__file__), "test/relaxng/testsuite.xml")
+LOG="check-relaxng-test-suite2.log"
+
+log = open(LOG, "w")
+nb_schemas_tests = 0
+nb_schemas_success = 0
+nb_schemas_failed = 0
+nb_instances_tests = 0
+nb_instances_success = 0
+nb_instances_failed = 0
+
+libxml2.lineNumbersDefault(1)
+#
+# Resolver callback
+#
+resources = {}
+def resolver(URL, ID, ctxt):
+ global resources
+
+ if resources.has_key(URL):
+ return(StringIO.StringIO(resources[URL]))
+ log.write("Resolver failure: asked %s\n" % (URL))
+ log.write("resources: %s\n" % (resources))
+ return None
+
+#
+# Load the previous results
+#
+#results = {}
+#previous = {}
+#
+#try:
+# res = libxml2.parseFile(RES)
+#except:
+# log.write("Could not parse %s" % (RES))
+
+#
+# handle a valid instance
+#
+def handle_valid(node, schema):
+ global log
+ global nb_instances_success
+ global nb_instances_failed
+
+ instance = node.prop("dtd")
+ if instance == None:
+ instance = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ instance = instance + child.serialize()
+ child = child.next
+
+# mem = libxml2.debugMemory(1);
+ try:
+ doc = libxml2.parseDoc(instance)
+ except:
+ doc = None
+
+ if doc == None:
+ log.write("\nFailed to parse correct instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ return
+
+ if debug:
+ print "instance line %d" % (node.lineNo())
+
+ try:
+ ctxt = schema.relaxNGNewValidCtxt()
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
+ except:
+ ret = -1
+
+ doc.freeDoc()
+# if mem != libxml2.debugMemory(1):
+# print "validating instance %d line %d leaks" % (
+# nb_instances_tests, node.lineNo())
+
+ if ret != 0:
+ log.write("\nFailed to validate correct instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ else:
+ nb_instances_success = nb_instances_success + 1
+
+#
+# handle an invalid instance
+#
+def handle_invalid(node, schema):
+ global log
+ global nb_instances_success
+ global nb_instances_failed
+
+ instance = node.prop("dtd")
+ if instance == None:
+ instance = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ instance = instance + child.serialize()
+ child = child.next
+
+# mem = libxml2.debugMemory(1);
+
+ try:
+ doc = libxml2.parseDoc(instance)
+ except:
+ doc = None
+
+ if doc == None:
+ log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ return
+
+ if debug:
+ print "instance line %d" % (node.lineNo())
+
+ try:
+ ctxt = schema.relaxNGNewValidCtxt()
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
+
+ except:
+ ret = -1
+
+ doc.freeDoc()
+# mem2 = libxml2.debugMemory(1)
+# if mem != mem2:
+# print "validating instance %d line %d leaks %d bytes" % (
+# nb_instances_tests, node.lineNo(), mem2 - mem)
+
+ if ret == 0:
+ log.write("\nFailed to detect validation problem in instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ else:
+ nb_instances_success = nb_instances_success + 1
+
+#
+# handle an incorrect test
+#
+def handle_correct(node):
+ global log
+ global nb_schemas_success
+ global nb_schemas_failed
+
+ schema = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ schema = schema + child.serialize()
+ child = child.next
+
+ try:
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
+ except:
+ rngs = None
+ if rngs == None:
+ log.write("\nFailed to compile correct schema:\n-----\n")
+ log.write(schema)
+ log.write("\n-----\n")
+ nb_schemas_failed = nb_schemas_failed + 1
+ else:
+ nb_schemas_success = nb_schemas_success + 1
+ return rngs
+
+def handle_incorrect(node):
+ global log
+ global nb_schemas_success
+ global nb_schemas_failed
+
+ schema = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ schema = schema + child.serialize()
+ child = child.next
+
+ try:
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
+ except:
+ rngs = None
+ if rngs != None:
+ log.write("\nFailed to detect schema error in:\n-----\n")
+ log.write(schema)
+ log.write("\n-----\n")
+ nb_schemas_failed = nb_schemas_failed + 1
+ else:
+# log.write("\nSuccess detecting schema error in:\n-----\n")
+# log.write(schema)
+# log.write("\n-----\n")
+ nb_schemas_success = nb_schemas_success + 1
+ return None
+
+#
+# resource handling: keep a dictionary of URL->string mappings
+#
+def handle_resource(node, dir):
+ global resources
+
+ try:
+ name = node.prop('name')
+ except:
+ name = None
+
+ if name == None or name == '':
+ log.write("resource has no name")
+ return;
+
+ if dir != None:
+# name = libxml2.buildURI(name, dir)
+ name = dir + '/' + name
+
+ res = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ res = res + child.serialize()
+ child = child.next
+ resources[name] = res
+
+#
+# dir handling: pseudo directory resources
+#
+def handle_dir(node, dir):
+ try:
+ name = node.prop('name')
+ except:
+ name = None
+
+ if name == None or name == '':
+ log.write("resource has no name")
+ return;
+
+ if dir != None:
+# name = libxml2.buildURI(name, dir)
+ name = dir + '/' + name
+
+ dirs = node.xpathEval('dir')
+ for dir in dirs:
+ handle_dir(dir, name)
+ res = node.xpathEval('resource')
+ for r in res:
+ handle_resource(r, name)
+
+#
+# handle a testCase element
+#
+def handle_testCase(node):
+ global nb_schemas_tests
+ global nb_instances_tests
+ global resources
+
+ sections = node.xpathEval('string(section)')
+ log.write("\n ======== test %d line %d section %s ==========\n" % (
+
+ nb_schemas_tests, node.lineNo(), sections))
+ resources = {}
+ if debug:
+ print "test %d line %d" % (nb_schemas_tests, node.lineNo())
+
+ dirs = node.xpathEval('dir')
+ for dir in dirs:
+ handle_dir(dir, None)
+ res = node.xpathEval('resource')
+ for r in res:
+ handle_resource(r, None)
+
+ tsts = node.xpathEval('incorrect')
+ if tsts != []:
+ if len(tsts) != 1:
+ print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
+ schema = handle_incorrect(tsts[0])
+ else:
+ tsts = node.xpathEval('correct')
+ if tsts != []:
+ if len(tsts) != 1:
+ print "warning test line %d has more than one <correct> example"% (node.lineNo())
+ schema = handle_correct(tsts[0])
+ else:
+ print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
+
+ nb_schemas_tests = nb_schemas_tests + 1;
+
+ valids = node.xpathEval('valid')
+ invalids = node.xpathEval('invalid')
+ nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
+ if schema != None:
+ for valid in valids:
+ handle_valid(valid, schema)
+ for invalid in invalids:
+ handle_invalid(invalid, schema)
+
+
+#
+# handle a testSuite element
+#
+def handle_testSuite(node, level = 0):
+ global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
+ global nb_instances_tests, nb_instances_success, nb_instances_failed
+ if level >= 1:
+ old_schemas_tests = nb_schemas_tests
+ old_schemas_success = nb_schemas_success
+ old_schemas_failed = nb_schemas_failed
+ old_instances_tests = nb_instances_tests
+ old_instances_success = nb_instances_success
+ old_instances_failed = nb_instances_failed
+
+ docs = node.xpathEval('documentation')
+ authors = node.xpathEval('author')
+ if docs != []:
+ msg = ""
+ for doc in docs:
+ msg = msg + doc.content + " "
+ if authors != []:
+ msg = msg + "written by "
+ for author in authors:
+ msg = msg + author.content + " "
+ if quiet == 0:
+ print msg
+ sections = node.xpathEval('section')
+ if sections != [] and level <= 0:
+ msg = ""
+ for section in sections:
+ msg = msg + section.content + " "
+ if quiet == 0:
+ print "Tests for section %s" % (msg)
+ for test in node.xpathEval('testCase'):
+ handle_testCase(test)
+ for test in node.xpathEval('testSuite'):
+ handle_testSuite(test, level + 1)
+
+
+ if level >= 1 and sections != []:
+ msg = ""
+ for section in sections:
+ msg = msg + section.content + " "
+ print "Result of tests for section %s" % (msg)
+ if nb_schemas_tests != old_schemas_tests:
+ print "found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests - old_schemas_tests,
+ nb_schemas_success - old_schemas_success,
+ nb_schemas_failed - old_schemas_failed)
+ if nb_instances_tests != old_instances_tests:
+ print "found %d test instances: %d success %d failures" % (
+ nb_instances_tests - old_instances_tests,
+ nb_instances_success - old_instances_success,
+ nb_instances_failed - old_instances_failed)
+#
+# Parse the conf file
+#
+libxml2.substituteEntitiesDefault(1);
+testsuite = libxml2.parseFile(CONF)
+
+#
+# Error and warnng callbacks
+#
+def callback(ctx, str):
+ global log
+ log.write("%s%s" % (ctx, str))
+
+libxml2.registerErrorHandler(callback, "")
+
+libxml2.setEntityLoader(resolver)
+root = testsuite.getRootElement()
+if root.name != 'testSuite':
+ print "%s doesn't start with a testSuite element, aborting" % (CONF)
+ sys.exit(1)
+if quiet == 0:
+ print "Running Relax NG testsuite"
+handle_testSuite(root)
+
+if quiet == 0:
+ print "\nTOTAL:\n"
+if quiet == 0 or nb_schemas_failed != 0:
+ print "found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
+if quiet == 0 or nb_instances_failed != 0:
+ print "found %d test instances: %d success %d failures" % (
+ nb_instances_tests, nb_instances_success, nb_instances_failed)
+
+
+testsuite.freeDoc()
+
+# Memory debug specific
+libxml2.relaxNGCleanupTypes()
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ if quiet == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7956696e/thirdparty/libxml2/check-xinclude-test-suite.py
----------------------------------------------------------------------
diff --git a/thirdparty/libxml2/check-xinclude-test-suite.py b/thirdparty/libxml2/check-xinclude-test-suite.py
new file mode 100755
index 0000000..f470011
--- /dev/null
+++ b/thirdparty/libxml2/check-xinclude-test-suite.py
@@ -0,0 +1,221 @@
+#!/usr/bin/python
+import sys
+import time
+import os
+import string
+sys.path.insert(0, "python")
+import libxml2
+
+#
+# the testsuite description
+#
+DIR="xinclude-test-suite"
+CONF="testdescr.xml"
+LOG="check-xinclude-test-suite.log"
+
+log = open(LOG, "w")
+
+os.chdir(DIR)
+
+test_nr = 0
+test_succeed = 0
+test_failed = 0
+test_error = 0
+#
+# Error and warning handlers
+#
+error_nr = 0
+error_msg = ''
+
+def errorHandler(ctx, str):
+ global error_nr
+ global error_msg
+
+ if string.find(str, "error:") >= 0:
+ error_nr = error_nr + 1
+ if len(error_msg) < 300:
+ if len(error_msg) == 0 or error_msg[-1] == '\n':
+ error_msg = error_msg + " >>" + str
+ else:
+ error_msg = error_msg + str
+
+libxml2.registerErrorHandler(errorHandler, None)
+
+def testXInclude(filename, id):
+ global error_nr
+ global error_msg
+ global log
+
+ error_nr = 0
+ error_msg = ''
+
+ print "testXInclude(%s, %s)" % (filename, id)
+ return 1
+
+def runTest(test, basedir):
+ global test_nr
+ global test_failed
+ global test_error
+ global test_succeed
+ global error_msg
+ global log
+
+ fatal_error = 0
+ uri = test.prop('href')
+ id = test.prop('id')
+ type = test.prop('type')
+ if uri == None:
+ print "Test without ID:", uri
+ return -1
+ if id == None:
+ print "Test without URI:", id
+ return -1
+ if type == None:
+ print "Test without URI:", id
+ return -1
+ if basedir != None:
+ URI = basedir + "/" + uri
+ else:
+ URI = uri
+ if os.access(URI, os.R_OK) == 0:
+ print "Test %s missing: base %s uri %s" % (URI, basedir, uri)
+ return -1
+
+ expected = None
+ outputfile = None
+ diff = None
+ if type != 'error':
+ output = test.xpathEval('string(output)')
+ if output == 'No output file.':
+ output = None
+ if output == '':
+ output = None
+ if output != None:
+ if basedir != None:
+ output = basedir + "/" + output
+ if os.access(output, os.R_OK) == 0:
+ print "Result for %s missing: %s" % (id, output)
+ output = None
+ else:
+ try:
+ f = open(output)
+ expected = f.read()
+ outputfile = output
+ except:
+ print "Result for %s unreadable: %s" % (id, output)
+
+ try:
+ # print "testing %s" % (URI)
+ doc = libxml2.parseFile(URI)
+ except:
+ doc = None
+ if doc != None:
+ res = doc.xincludeProcess()
+ if res >= 0 and expected != None:
+ result = doc.serialize()
+ if result != expected:
+ print "Result for %s differs" % (id)
+ open("xinclude.res", "w").write(result)
+ diff = os.popen("diff %s xinclude.res" % outputfile).read()
+
+ doc.freeDoc()
+ else:
+ print "Failed to parse %s" % (URI)
+ res = -1
+
+
+
+ test_nr = test_nr + 1
+ if type == 'success':
+ if res > 0:
+ test_succeed = test_succeed + 1
+ elif res == 0:
+ test_failed = test_failed + 1
+ print "Test %s: no substitution done ???" % (id)
+ elif res < 0:
+ test_error = test_error + 1
+ print "Test %s: failed valid XInclude processing" % (id)
+ elif type == 'error':
+ if res > 0:
+ test_error = test_error + 1
+ print "Test %s: failed to detect invalid XInclude processing" % (id)
+ elif res == 0:
+ test_failed = test_failed + 1
+ print "Test %s: Invalid but no substitution done" % (id)
+ elif res < 0:
+ test_succeed = test_succeed + 1
+ elif type == 'optional':
+ if res > 0:
+ test_succeed = test_succeed + 1
+ else:
+ print "Test %s: failed optional test" % (id)
+
+ # Log the ontext
+ if res != 1:
+ log.write("Test ID %s\n" % (id))
+ log.write(" File: %s\n" % (URI))
+ content = string.strip(test.content)
+ while content[-1] == '\n':
+ content = content[0:-1]
+ log.write(" %s:%s\n\n" % (type, content))
+ if error_msg != '':
+ log.write(" ----\n%s ----\n" % (error_msg))
+ error_msg = ''
+ log.write("\n")
+ if diff != None:
+ log.write("diff from test %s:\n" %(id))
+ log.write(" -----------\n%s\n -----------\n" % (diff));
+
+ return 0
+
+
+def runTestCases(case):
+ creator = case.prop('creator')
+ if creator != None:
+ print "=>", creator
+ base = case.getBase(None)
+ basedir = case.prop('basedir')
+ if basedir != None:
+ base = libxml2.buildURI(basedir, base)
+ test = case.children
+ while test != None:
+ if test.name == 'testcase':
+ runTest(test, base)
+ if test.name == 'testcases':
+ runTestCases(test)
+ test = test.next
+
+conf = libxml2.parseFile(CONF)
+if conf == None:
+ print "Unable to load %s" % CONF
+ sys.exit(1)
+
+testsuite = conf.getRootElement()
+if testsuite.name != 'testsuite':
+ print "Expecting TESTSUITE root element: aborting"
+ sys.exit(1)
+
+profile = testsuite.prop('PROFILE')
+if profile != None:
+ print profile
+
+start = time.time()
+
+case = testsuite.children
+while case != None:
+ if case.name == 'testcases':
+ old_test_nr = test_nr
+ old_test_succeed = test_succeed
+ old_test_failed = test_failed
+ old_test_error = test_error
+ runTestCases(case)
+ print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % (
+ test_nr - old_test_nr, test_succeed - old_test_succeed,
+ test_failed - old_test_failed, test_error - old_test_error)
+ case = case.next
+
+conf.freeDoc()
+log.close()
+
+print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % (
+ test_nr, test_succeed, test_failed, test_error, time.time() - start)
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7956696e/thirdparty/libxml2/check-xml-test-suite.py
----------------------------------------------------------------------
diff --git a/thirdparty/libxml2/check-xml-test-suite.py b/thirdparty/libxml2/check-xml-test-suite.py
new file mode 100755
index 0000000..2de07b1
--- /dev/null
+++ b/thirdparty/libxml2/check-xml-test-suite.py
@@ -0,0 +1,409 @@
+#!/usr/bin/python
+import sys
+import time
+import os
+import string
+sys.path.insert(0, "python")
+import libxml2
+
+test_nr = 0
+test_succeed = 0
+test_failed = 0
+test_error = 0
+
+#
+# the testsuite description
+#
+CONF="xml-test-suite/xmlconf/xmlconf.xml"
+LOG="check-xml-test-suite.log"
+
+log = open(LOG, "w")
+
+#
+# Error and warning handlers
+#
+error_nr = 0
+error_msg = ''
+def errorHandler(ctx, str):
+ global error_nr
+ global error_msg
+
+ error_nr = error_nr + 1
+ if len(error_msg) < 300:
+ if len(error_msg) == 0 or error_msg[-1] == '\n':
+ error_msg = error_msg + " >>" + str
+ else:
+ error_msg = error_msg + str
+
+libxml2.registerErrorHandler(errorHandler, None)
+
+#warning_nr = 0
+#warning = ''
+#def warningHandler(ctx, str):
+# global warning_nr
+# global warning
+#
+# warning_nr = warning_nr + 1
+# warning = warning + str
+#
+#libxml2.registerWarningHandler(warningHandler, None)
+
+#
+# Used to load the XML testsuite description
+#
+def loadNoentDoc(filename):
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return None
+ ctxt.replaceEntities(1)
+ ctxt.parseDocument()
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ if ctxt.wellFormed() != 1:
+ doc.freeDoc()
+ return None
+ return doc
+
+#
+# The conformance testing routines
+#
+
+def testNotWf(filename, id):
+ global error_nr
+ global error_msg
+ global log
+
+ error_nr = 0
+ error_msg = ''
+
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return -1
+ ret = ctxt.parseDocument()
+
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ if doc != None:
+ doc.freeDoc()
+ if ret == 0 or ctxt.wellFormed() != 0:
+ print "%s: error: Well Formedness error not detected" % (id)
+ log.write("%s: error: Well Formedness error not detected\n" % (id))
+ return 0
+ return 1
+
+def testNotWfEnt(filename, id):
+ global error_nr
+ global error_msg
+ global log
+
+ error_nr = 0
+ error_msg = ''
+
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return -1
+ ctxt.replaceEntities(1)
+ ret = ctxt.parseDocument()
+
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ if doc != None:
+ doc.freeDoc()
+ if ret == 0 or ctxt.wellFormed() != 0:
+ print "%s: error: Well Formedness error not detected" % (id)
+ log.write("%s: error: Well Formedness error not detected\n" % (id))
+ return 0
+ return 1
+
+def testNotWfEntDtd(filename, id):
+ global error_nr
+ global error_msg
+ global log
+
+ error_nr = 0
+ error_msg = ''
+
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return -1
+ ctxt.replaceEntities(1)
+ ctxt.loadSubset(1)
+ ret = ctxt.parseDocument()
+
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ if doc != None:
+ doc.freeDoc()
+ if ret == 0 or ctxt.wellFormed() != 0:
+ print "%s: error: Well Formedness error not detected" % (id)
+ log.write("%s: error: Well Formedness error not detected\n" % (id))
+ return 0
+ return 1
+
+def testWfEntDtd(filename, id):
+ global error_nr
+ global error_msg
+ global log
+
+ error_nr = 0
+ error_msg = ''
+
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return -1
+ ctxt.replaceEntities(1)
+ ctxt.loadSubset(1)
+ ret = ctxt.parseDocument()
+
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ if doc == None or ret != 0 or ctxt.wellFormed() == 0:
+ print "%s: error: wrongly failed to parse the document" % (id)
+ log.write("%s: error: wrongly failed to parse the document\n" % (id))
+ if doc != None:
+ doc.freeDoc()
+ return 0
+ if error_nr != 0:
+ print "%s: warning: WF document generated an error msg" % (id)
+ log.write("%s: error: WF document generated an error msg\n" % (id))
+ doc.freeDoc()
+ return 2
+ doc.freeDoc()
+ return 1
+
+def testError(filename, id):
+ global error_nr
+ global error_msg
+ global log
+
+ error_nr = 0
+ error_msg = ''
+
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return -1
+ ctxt.replaceEntities(1)
+ ctxt.loadSubset(1)
+ ret = ctxt.parseDocument()
+
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ if doc != None:
+ doc.freeDoc()
+ if ctxt.wellFormed() == 0:
+ print "%s: warning: failed to parse the document but accepted" % (id)
+ log.write("%s: warning: failed to parse the document but accepte\n" % (id))
+ return 2
+ if error_nr != 0:
+ print "%s: warning: WF document generated an error msg" % (id)
+ log.write("%s: error: WF document generated an error msg\n" % (id))
+ return 2
+ return 1
+
+def testInvalid(filename, id):
+ global error_nr
+ global error_msg
+ global log
+
+ error_nr = 0
+ error_msg = ''
+
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return -1
+ ctxt.validate(1)
+ ret = ctxt.parseDocument()
+
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ valid = ctxt.isValid()
+ if doc == None:
+ print "%s: error: wrongly failed to parse the document" % (id)
+ log.write("%s: error: wrongly failed to parse the document\n" % (id))
+ return 0
+ if valid == 1:
+ print "%s: error: Validity error not detected" % (id)
+ log.write("%s: error: Validity error not detected\n" % (id))
+ doc.freeDoc()
+ return 0
+ if error_nr == 0:
+ print "%s: warning: Validity error not reported" % (id)
+ log.write("%s: warning: Validity error not reported\n" % (id))
+ doc.freeDoc()
+ return 2
+
+ doc.freeDoc()
+ return 1
+
+def testValid(filename, id):
+ global error_nr
+ global error_msg
+
+ error_nr = 0
+ error_msg = ''
+
+ ctxt = libxml2.createFileParserCtxt(filename)
+ if ctxt == None:
+ return -1
+ ctxt.validate(1)
+ ctxt.parseDocument()
+
+ try:
+ doc = ctxt.doc()
+ except:
+ doc = None
+ valid = ctxt.isValid()
+ if doc == None:
+ print "%s: error: wrongly failed to parse the document" % (id)
+ log.write("%s: error: wrongly failed to parse the document\n" % (id))
+ return 0
+ if valid != 1:
+ print "%s: error: Validity check failed" % (id)
+ log.write("%s: error: Validity check failed\n" % (id))
+ doc.freeDoc()
+ return 0
+ if error_nr != 0 or valid != 1:
+ print "%s: warning: valid document reported an error" % (id)
+ log.write("%s: warning: valid document reported an error\n" % (id))
+ doc.freeDoc()
+ return 2
+ doc.freeDoc()
+ return 1
+
+def runTest(test):
+ global test_nr
+ global test_succeed
+ global test_failed
+ global error_msg
+ global log
+
+ uri = test.prop('URI')
+ id = test.prop('ID')
+ if uri == None:
+ print "Test without ID:", uri
+ return -1
+ if id == None:
+ print "Test without URI:", id
+ return -1
+ base = test.getBase(None)
+ URI = libxml2.buildURI(uri, base)
+ if os.access(URI, os.R_OK) == 0:
+ print "Test %s missing: base %s uri %s" % (URI, base, uri)
+ return -1
+ type = test.prop('TYPE')
+ if type == None:
+ print "Test %s missing TYPE" % (id)
+ return -1
+
+ extra = None
+ if type == "invalid":
+ res = testInvalid(URI, id)
+ elif type == "valid":
+ res = testValid(URI, id)
+ elif type == "not-wf":
+ extra = test.prop('ENTITIES')
+ # print URI
+ #if extra == None:
+ # res = testNotWfEntDtd(URI, id)
+ #elif extra == 'none':
+ # res = testNotWf(URI, id)
+ #elif extra == 'general':
+ # res = testNotWfEnt(URI, id)
+ #elif extra == 'both' or extra == 'parameter':
+ res = testNotWfEntDtd(URI, id)
+ #else:
+ # print "Unknow value %s for an ENTITIES test value" % (extra)
+ # return -1
+ elif type == "error":
+ res = testError(URI, id)
+ else:
+ # TODO skipped for now
+ return -1
+
+ test_nr = test_nr + 1
+ if res > 0:
+ test_succeed = test_succeed + 1
+ elif res == 0:
+ test_failed = test_failed + 1
+ elif res < 0:
+ test_error = test_error + 1
+
+ # Log the ontext
+ if res != 1:
+ log.write(" File: %s\n" % (URI))
+ content = string.strip(test.content)
+ while content[-1] == '\n':
+ content = content[0:-1]
+ if extra != None:
+ log.write(" %s:%s:%s\n" % (type, extra, content))
+ else:
+ log.write(" %s:%s\n\n" % (type, content))
+ if error_msg != '':
+ log.write(" ----\n%s ----\n" % (error_msg))
+ error_msg = ''
+ log.write("\n")
+
+ return 0
+
+
+def runTestCases(case):
+ profile = case.prop('PROFILE')
+ if profile != None and \
+ string.find(profile, "IBM XML Conformance Test Suite - Production") < 0:
+ print "=>", profile
+ test = case.children
+ while test != None:
+ if test.name == 'TEST':
+ runTest(test)
+ if test.name == 'TESTCASES':
+ runTestCases(test)
+ test = test.next
+
+conf = loadNoentDoc(CONF)
+if conf == None:
+ print "Unable to load %s" % CONF
+ sys.exit(1)
+
+testsuite = conf.getRootElement()
+if testsuite.name != 'TESTSUITE':
+ print "Expecting TESTSUITE root element: aborting"
+ sys.exit(1)
+
+profile = testsuite.prop('PROFILE')
+if profile != None:
+ print profile
+
+start = time.time()
+
+case = testsuite.children
+while case != None:
+ if case.name == 'TESTCASES':
+ old_test_nr = test_nr
+ old_test_succeed = test_succeed
+ old_test_failed = test_failed
+ old_test_error = test_error
+ runTestCases(case)
+ print " Ran %d tests: %d suceeded, %d failed and %d generated an error" % (
+ test_nr - old_test_nr, test_succeed - old_test_succeed,
+ test_failed - old_test_failed, test_error - old_test_error)
+ case = case.next
+
+conf.freeDoc()
+log.close()
+
+print "Ran %d tests: %d suceeded, %d failed and %d generated an error in %.2f s." % (
+ test_nr, test_succeed, test_failed, test_error, time.time() - start)
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7956696e/thirdparty/libxml2/check-xsddata-test-suite.py
----------------------------------------------------------------------
diff --git a/thirdparty/libxml2/check-xsddata-test-suite.py b/thirdparty/libxml2/check-xsddata-test-suite.py
new file mode 100755
index 0000000..c946129
--- /dev/null
+++ b/thirdparty/libxml2/check-xsddata-test-suite.py
@@ -0,0 +1,420 @@
+#!/usr/bin/python
+import sys
+import time
+import os
+import string
+import StringIO
+sys.path.insert(0, "python")
+import libxml2
+
+# Memory debug specific
+libxml2.debugMemory(1)
+debug = 0
+verbose = 0
+quiet = 1
+
+#
+# the testsuite description
+#
+CONF=os.path.join(os.path.dirname(__file__), "test/xsdtest/xsdtestsuite.xml")
+LOG="check-xsddata-test-suite.log"
+
+log = open(LOG, "w")
+nb_schemas_tests = 0
+nb_schemas_success = 0
+nb_schemas_failed = 0
+nb_instances_tests = 0
+nb_instances_success = 0
+nb_instances_failed = 0
+
+libxml2.lineNumbersDefault(1)
+#
+# Error and warnng callbacks
+#
+def callback(ctx, str):
+ global log
+ log.write("%s%s" % (ctx, str))
+
+libxml2.registerErrorHandler(callback, "")
+
+#
+# Resolver callback
+#
+resources = {}
+def resolver(URL, ID, ctxt):
+ global resources
+
+ if resources.has_key(URL):
+ return(StringIO.StringIO(resources[URL]))
+ log.write("Resolver failure: asked %s\n" % (URL))
+ log.write("resources: %s\n" % (resources))
+ return None
+
+#
+# handle a valid instance
+#
+def handle_valid(node, schema):
+ global log
+ global nb_instances_success
+ global nb_instances_failed
+
+ instance = node.prop("dtd")
+ if instance == None:
+ instance = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ instance = instance + child.serialize()
+ child = child.next
+
+ mem = libxml2.debugMemory(1);
+ try:
+ doc = libxml2.parseDoc(instance)
+ except:
+ doc = None
+
+ if doc == None:
+ log.write("\nFailed to parse correct instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ return
+
+ if debug:
+ print "instance line %d" % (node.lineNo())
+
+ try:
+ ctxt = schema.relaxNGNewValidCtxt()
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
+ except:
+ ret = -1
+
+ doc.freeDoc()
+ if mem != libxml2.debugMemory(1):
+ print "validating instance %d line %d leaks" % (
+ nb_instances_tests, node.lineNo())
+
+ if ret != 0:
+ log.write("\nFailed to validate correct instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ else:
+ nb_instances_success = nb_instances_success + 1
+
+#
+# handle an invalid instance
+#
+def handle_invalid(node, schema):
+ global log
+ global nb_instances_success
+ global nb_instances_failed
+
+ instance = node.prop("dtd")
+ if instance == None:
+ instance = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ instance = instance + child.serialize()
+ child = child.next
+
+# mem = libxml2.debugMemory(1);
+
+ try:
+ doc = libxml2.parseDoc(instance)
+ except:
+ doc = None
+
+ if doc == None:
+ log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ return
+
+ if debug:
+ print "instance line %d" % (node.lineNo())
+
+ try:
+ ctxt = schema.relaxNGNewValidCtxt()
+ ret = doc.relaxNGValidateDoc(ctxt)
+ del ctxt
+
+ except:
+ ret = -1
+
+ doc.freeDoc()
+# if mem != libxml2.debugMemory(1):
+# print "validating instance %d line %d leaks" % (
+# nb_instances_tests, node.lineNo())
+
+ if ret == 0:
+ log.write("\nFailed to detect validation problem in instance:\n-----\n")
+ log.write(instance)
+ log.write("\n-----\n")
+ nb_instances_failed = nb_instances_failed + 1
+ else:
+ nb_instances_success = nb_instances_success + 1
+
+#
+# handle an incorrect test
+#
+def handle_correct(node):
+ global log
+ global nb_schemas_success
+ global nb_schemas_failed
+
+ schema = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ schema = schema + child.serialize()
+ child = child.next
+
+ try:
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
+ except:
+ rngs = None
+ if rngs == None:
+ log.write("\nFailed to compile correct schema:\n-----\n")
+ log.write(schema)
+ log.write("\n-----\n")
+ nb_schemas_failed = nb_schemas_failed + 1
+ else:
+ nb_schemas_success = nb_schemas_success + 1
+ return rngs
+
+def handle_incorrect(node):
+ global log
+ global nb_schemas_success
+ global nb_schemas_failed
+
+ schema = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ schema = schema + child.serialize()
+ child = child.next
+
+ try:
+ rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
+ rngs = rngp.relaxNGParse()
+ except:
+ rngs = None
+ if rngs != None:
+ log.write("\nFailed to detect schema error in:\n-----\n")
+ log.write(schema)
+ log.write("\n-----\n")
+ nb_schemas_failed = nb_schemas_failed + 1
+ else:
+# log.write("\nSuccess detecting schema error in:\n-----\n")
+# log.write(schema)
+# log.write("\n-----\n")
+ nb_schemas_success = nb_schemas_success + 1
+ return None
+
+#
+# resource handling: keep a dictionary of URL->string mappings
+#
+def handle_resource(node, dir):
+ global resources
+
+ try:
+ name = node.prop('name')
+ except:
+ name = None
+
+ if name == None or name == '':
+ log.write("resource has no name")
+ return;
+
+ if dir != None:
+# name = libxml2.buildURI(name, dir)
+ name = dir + '/' + name
+
+ res = ""
+ child = node.children
+ while child != None:
+ if child.type != 'text':
+ res = res + child.serialize()
+ child = child.next
+ resources[name] = res
+
+#
+# dir handling: pseudo directory resources
+#
+def handle_dir(node, dir):
+ try:
+ name = node.prop('name')
+ except:
+ name = None
+
+ if name == None or name == '':
+ log.write("resource has no name")
+ return;
+
+ if dir != None:
+# name = libxml2.buildURI(name, dir)
+ name = dir + '/' + name
+
+ dirs = node.xpathEval('dir')
+ for dir in dirs:
+ handle_dir(dir, name)
+ res = node.xpathEval('resource')
+ for r in res:
+ handle_resource(r, name)
+
+#
+# handle a testCase element
+#
+def handle_testCase(node):
+ global nb_schemas_tests
+ global nb_instances_tests
+ global resources
+
+ sections = node.xpathEval('string(section)')
+ log.write("\n ======== test %d line %d section %s ==========\n" % (
+
+ nb_schemas_tests, node.lineNo(), sections))
+ resources = {}
+ if debug:
+ print "test %d line %d" % (nb_schemas_tests, node.lineNo())
+
+ dirs = node.xpathEval('dir')
+ for dir in dirs:
+ handle_dir(dir, None)
+ res = node.xpathEval('resource')
+ for r in res:
+ handle_resource(r, None)
+
+ tsts = node.xpathEval('incorrect')
+ if tsts != []:
+ if len(tsts) != 1:
+ print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
+ schema = handle_incorrect(tsts[0])
+ else:
+ tsts = node.xpathEval('correct')
+ if tsts != []:
+ if len(tsts) != 1:
+ print "warning test line %d has more than one <correct> example"% (node.lineNo())
+ schema = handle_correct(tsts[0])
+ else:
+ print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
+
+ nb_schemas_tests = nb_schemas_tests + 1;
+
+ valids = node.xpathEval('valid')
+ invalids = node.xpathEval('invalid')
+ nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
+ if schema != None:
+ for valid in valids:
+ handle_valid(valid, schema)
+ for invalid in invalids:
+ handle_invalid(invalid, schema)
+
+
+#
+# handle a testSuite element
+#
+def handle_testSuite(node, level = 0):
+ global nb_schemas_tests, nb_schemas_success, nb_schemas_failed
+ global nb_instances_tests, nb_instances_success, nb_instances_failed
+ if verbose and level >= 0:
+ old_schemas_tests = nb_schemas_tests
+ old_schemas_success = nb_schemas_success
+ old_schemas_failed = nb_schemas_failed
+ old_instances_tests = nb_instances_tests
+ old_instances_success = nb_instances_success
+ old_instances_failed = nb_instances_failed
+
+ docs = node.xpathEval('documentation')
+ authors = node.xpathEval('author')
+ if docs != []:
+ msg = ""
+ for doc in docs:
+ msg = msg + doc.content + " "
+ if authors != []:
+ msg = msg + "written by "
+ for author in authors:
+ msg = msg + author.content + " "
+ if quiet == 0:
+ print msg
+ sections = node.xpathEval('section')
+ if verbose and sections != [] and level <= 0:
+ msg = ""
+ for section in sections:
+ msg = msg + section.content + " "
+ if quiet == 0:
+ print "Tests for section %s" % (msg)
+ for test in node.xpathEval('testCase'):
+ handle_testCase(test)
+ for test in node.xpathEval('testSuite'):
+ handle_testSuite(test, level + 1)
+
+
+ if verbose and level >= 0 :
+ if sections != []:
+ msg = ""
+ for section in sections:
+ msg = msg + section.content + " "
+ print "Result of tests for section %s" % (msg)
+ elif docs != []:
+ msg = ""
+ for doc in docs:
+ msg = msg + doc.content + " "
+ print "Result of tests for %s" % (msg)
+
+ if nb_schemas_tests != old_schemas_tests:
+ print "found %d test schemas: %d success %d failures" % (
+ nb_schemas_tests - old_schemas_tests,
+ nb_schemas_success - old_schemas_success,
+ nb_schemas_failed - old_schemas_failed)
+ if nb_instances_tests != old_instances_tests:
+ print "found %d test instances: %d success %d failures" % (
+ nb_instances_tests - old_instances_tests,
+ nb_instances_success - old_instances_success,
+ nb_instances_failed - old_instances_failed)
+#
+# Parse the conf file
+#
+libxml2.substituteEntitiesDefault(1);
+testsuite = libxml2.parseFile(CONF)
+
+#
+# Error and warnng callbacks
+#
+def callback(ctx, str):
+ global log
+ log.write("%s%s" % (ctx, str))
+
+libxml2.registerErrorHandler(callback, "")
+
+libxml2.setEntityLoader(resolver)
+root = testsuite.getRootElement()
+if root.name != 'testSuite':
+ print "%s doesn't start with a testSuite element, aborting" % (CONF)
+ sys.exit(1)
+if quiet == 0:
+ print "Running Relax NG testsuite"
+handle_testSuite(root)
+
+if quiet == 0 or nb_schemas_failed != 0:
+ print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
+ nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
+if quiet == 0 or nb_instances_failed != 0:
+ print "found %d test instances: %d success %d failures" % (
+ nb_instances_tests, nb_instances_success, nb_instances_failed)
+
+testsuite.freeDoc()
+
+# Memory debug specific
+libxml2.relaxNGCleanupTypes()
+libxml2.cleanupParser()
+if libxml2.debugMemory(1) == 0:
+ if quiet == 0:
+ print "OK"
+else:
+ print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ libxml2.dumpMemory()
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7956696e/thirdparty/libxml2/chvalid.c
----------------------------------------------------------------------
diff --git a/thirdparty/libxml2/chvalid.c b/thirdparty/libxml2/chvalid.c
new file mode 100644
index 0000000..06e8db0
--- /dev/null
+++ b/thirdparty/libxml2/chvalid.c
@@ -0,0 +1,336 @@
+/*
+ * chvalid.c: this module implements the character range
+ * validation APIs
+ *
+ * This file is automatically generated from the cvs source
+ * definition files using the genChRanges.py Python script
+ *
+ * Generation date: Mon Mar 27 11:09:48 2006
+ * Sources: chvalid.def
+ * William Brack <wb...@mmm.com.hk>
+ */
+
+#define IN_LIBXML
+#include "libxml.h"
+#include <libxml/chvalid.h>
+
+/*
+ * The initial tables ({func_name}_tab) are used to validate whether a
+ * single-byte character is within the specified group. Each table
+ * contains 256 bytes, with each byte representing one of the 256
+ * possible characters. If the table byte is set, the character is
+ * allowed.
+ *
+ */
+const unsigned char xmlIsPubidChar_tab[256] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
+ 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 };
+
+static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131},
+ {0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3},
+ {0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8},
+ {0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c},
+ {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da},
+ {0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3},
+ {0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481},
+ {0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb},
+ {0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559},
+ {0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a},
+ {0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce},
+ {0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939},
+ {0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990},
+ {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9},
+ {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a},
+ {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33},
+ {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e},
+ {0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91},
+ {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9},
+ {0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10},
+ {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39},
+ {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a},
+ {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c},
+ {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5},
+ {0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
+ {0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c},
+ {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
+ {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
+ {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e},
+ {0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82},
+ {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d},
+ {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5},
+ {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0},
+ {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47},
+ {0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100},
+ {0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c},
+ {0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140},
+ {0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155},
+ {0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165},
+ {0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173},
+ {0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab},
+ {0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2},
+ {0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b},
+ {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
+ {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b},
+ {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
+ {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
+ {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
+ {0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
+ {0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
+const xmlChRangeGroup xmlIsBaseCharGroup =
+ {197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0};
+
+static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff},
+ {0xe000, 0xfffd}};
+static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}};
+const xmlChRangeGroup xmlIsCharGroup =
+ {2, 1, xmlIsChar_srng, xmlIsChar_lrng};
+
+static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
+ {0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
+ {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4},
+ {0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df},
+ {0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903},
+ {0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954},
+ {0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be},
+ {0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd},
+ {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c},
+ {0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48},
+ {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc},
+ {0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03},
+ {0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d},
+ {0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
+ {0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44},
+ {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83},
+ {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6},
+ {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d},
+ {0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e},
+ {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd},
+ {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39},
+ {0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b},
+ {0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
+ {0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
+ {0x3099, 0x3099}, {0x309a, 0x309a}};
+const xmlChRangeGroup xmlIsCombiningGroup =
+ {95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0};
+
+static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
+ {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
+ {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
+ {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
+ {0xf20, 0xf29}};
+const xmlChRangeGroup xmlIsDigitGroup =
+ {14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0};
+
+static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0},
+ {0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
+ {0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
+ {0x30fc, 0x30fe}};
+const xmlChRangeGroup xmlIsExtenderGroup =
+ {10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0};
+
+static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007},
+ {0x3021, 0x3029}, {0x4e00, 0x9fa5}};
+const xmlChRangeGroup xmlIsIdeographicGroup =
+ {3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0};
+
+
+/**
+ * xmlCharInRange:
+ * @val: character to be validated
+ * @rptr: pointer to range to be used to validate
+ *
+ * Does a binary search of the range table to determine if char
+ * is valid
+ *
+ * Returns: true if character valid, false otherwise
+ */
+int
+xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
+ int low, high, mid;
+ const xmlChSRange *sptr;
+ const xmlChLRange *lptr;
+
+ if (rptr == NULL) return(0);
+ if (val < 0x10000) { /* is val in 'short' or 'long' array? */
+ if (rptr->nbShortRange == 0)
+ return 0;
+ low = 0;
+ high = rptr->nbShortRange - 1;
+ sptr = rptr->shortRange;
+ while (low <= high) {
+ mid = (low + high) / 2;
+ if ((unsigned short) val < sptr[mid].low) {
+ high = mid - 1;
+ } else {
+ if ((unsigned short) val > sptr[mid].high) {
+ low = mid + 1;
+ } else {
+ return 1;
+ }
+ }
+ }
+ } else {
+ if (rptr->nbLongRange == 0) {
+ return 0;
+ }
+ low = 0;
+ high = rptr->nbLongRange - 1;
+ lptr = rptr->longRange;
+ while (low <= high) {
+ mid = (low + high) / 2;
+ if (val < lptr[mid].low) {
+ high = mid - 1;
+ } else {
+ if (val > lptr[mid].high) {
+ low = mid + 1;
+ } else {
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+
+/**
+ * xmlIsBaseChar:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsBaseChar_ch or xmlIsBaseCharQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsBaseChar(unsigned int ch) {
+ return(xmlIsBaseCharQ(ch));
+}
+
+
+/**
+ * xmlIsBlank:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsBlank_ch or xmlIsBlankQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsBlank(unsigned int ch) {
+ return(xmlIsBlankQ(ch));
+}
+
+
+/**
+ * xmlIsChar:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsChar_ch or xmlIsCharQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsChar(unsigned int ch) {
+ return(xmlIsCharQ(ch));
+}
+
+
+/**
+ * xmlIsCombining:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsCombiningQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsCombining(unsigned int ch) {
+ return(xmlIsCombiningQ(ch));
+}
+
+
+/**
+ * xmlIsDigit:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsDigit_ch or xmlIsDigitQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsDigit(unsigned int ch) {
+ return(xmlIsDigitQ(ch));
+}
+
+
+/**
+ * xmlIsExtender:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsExtender_ch or xmlIsExtenderQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsExtender(unsigned int ch) {
+ return(xmlIsExtenderQ(ch));
+}
+
+
+/**
+ * xmlIsIdeographic:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsIdeographicQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsIdeographic(unsigned int ch) {
+ return(xmlIsIdeographicQ(ch));
+}
+
+
+/**
+ * xmlIsPubidChar:
+ * @ch: character to validate
+ *
+ * This function is DEPRECATED.
+ * Use xmlIsPubidChar_ch or xmlIsPubidCharQ instead
+ *
+ * Returns true if argument valid, false otherwise
+ */
+int
+xmlIsPubidChar(unsigned int ch) {
+ return(xmlIsPubidCharQ(ch));
+}
+
+#define bottom_chvalid
+#include "elfgcchack.h"
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7956696e/thirdparty/libxml2/compile
----------------------------------------------------------------------
diff --git a/thirdparty/libxml2/compile b/thirdparty/libxml2/compile
new file mode 100755
index 0000000..a85b723
--- /dev/null
+++ b/thirdparty/libxml2/compile
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-10-14.11; # UTC
+
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Written by Tom Tromey <tr...@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bu...@gnu.org> or send patches to
+# <au...@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ if test -f "$dir/lib$lib.a"; then
+ found=yes
+ lib=$dir/lib$lib.a
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bu...@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no '-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # '.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End: