summaryrefslogtreecommitdiff
path: root/src/xmlstar.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlstar.h')
-rw-r--r--src/xmlstar.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/xmlstar.h b/src/xmlstar.h
new file mode 100644
index 0000000..36133f2
--- /dev/null
+++ b/src/xmlstar.h
@@ -0,0 +1,43 @@
+#ifndef XMLSTAR_H
+#define XMLSTAR_H
+
+#include <config.h>
+#include <stdlib.h>
+
+#if HAVE_SETMODE && HAVE_DECL_O_BINARY
+# include <io.h>
+# include <fcntl.h>
+# define set_stdout_binary() setmode(1, O_BINARY)
+#else
+# define set_stdout_binary()
+#endif
+
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+#include <libxml/xmlreader.h>
+
+typedef enum { /* EXIT_SUCCESS = 0, EXIT_FAILURE = 1, */
+ EXIT_BAD_ARGS = EXIT_FAILURE+1, EXIT_BAD_FILE,
+ EXIT_LIB_ERROR, EXIT_INTERNAL_ERROR } exit_status;
+
+#define COUNT_OF(array) (sizeof(array)/sizeof(*array))
+
+typedef enum { QUIET, VERBOSE } Verbosity;
+
+typedef struct _errorInfo {
+ const char *filename; /* file error occured in, if any, else NULL */
+ xmlTextReaderPtr xmlReader;
+ Verbosity verbose;
+} ErrorInfo;
+
+void reportError(void *ptr, xmlErrorPtr error);
+
+void registerXstarVariable(xmlXPathContextPtr ctxt,
+ const char* name, xmlXPathObjectPtr value);
+void registerXstarNs(xmlXPathContextPtr ctxt);
+
+int parseNSArr(xmlChar** ns_arr, int* plen, int argc, char **argv);
+void cleanupNSArr(xmlChar **ns_arr);
+extern xmlChar *ns_arr[];
+
+#endif /* XMLSTAR_H */