| 1 |
#ifndef XMLSTAR_H |
| 2 |
#define XMLSTAR_H |
| 3 |
|
| 4 |
#include <config.h> |
| 5 |
#include <stdlib.h> |
| 6 |
|
| 7 |
#if HAVE_SETMODE && HAVE_DECL_O_BINARY |
| 8 |
# include <io.h> |
| 9 |
# include <fcntl.h> |
| 10 |
# define set_stdout_binary() setmode(1, O_BINARY) |
| 11 |
#else |
| 12 |
# define set_stdout_binary() |
| 13 |
#endif |
| 14 |
|
| 15 |
#include <libxml/xpath.h> |
| 16 |
#include <libxml/xpathInternals.h> |
| 17 |
#include <libxml/xmlreader.h> |
| 18 |
|
| 19 |
typedef enum { /* EXIT_SUCCESS = 0, EXIT_FAILURE = 1, */ |
| 20 |
EXIT_BAD_ARGS = EXIT_FAILURE+1, EXIT_BAD_FILE, |
| 21 |
EXIT_LIB_ERROR, EXIT_INTERNAL_ERROR } exit_status; |
| 22 |
|
| 23 |
#define COUNT_OF(array) (sizeof(array)/sizeof(*array)) |
| 24 |
|
| 25 |
typedef enum { QUIET, VERBOSE } Verbosity; |
| 26 |
typedef enum { CONTINUE, STOP } ErrorStop; |
| 27 |
|
| 28 |
typedef struct _errorInfo { |
| 29 |
const char *filename; /* file error occured in, if any, else NULL */ |
| 30 |
xmlTextReaderPtr xmlReader; |
| 31 |
Verbosity verbose; |
| 32 |
ErrorStop stop; |
| 33 |
} ErrorInfo; |
| 34 |
|
| 35 |
void reportError(void *ptr, xmlErrorPtr error); |
| 36 |
void suppressErrors(void); |
| 37 |
|
| 38 |
typedef struct _gOptions { |
| 39 |
int quiet; /* no error output */ |
| 40 |
int doc_namespace; /* extract namespace bindings from input doc */ |
| 41 |
} gOptions; |
| 42 |
|
| 43 |
typedef gOptions *gOptionsPtr; |
| 44 |
|
| 45 |
extern gOptions globalOptions; |
| 46 |
|
| 47 |
void registerXstarVariable(xmlXPathContextPtr ctxt, |
| 48 |
const char* name, xmlXPathObjectPtr value); |
| 49 |
void registerXstarNs(xmlXPathContextPtr ctxt); |
| 50 |
|
| 51 |
extern const xmlChar *default_ns; |
| 52 |
|
| 53 |
int parseNSArr(xmlChar** ns_arr, int* plen, int argc, char **argv); |
| 54 |
void cleanupNSArr(xmlChar **ns_arr); |
| 55 |
extern xmlChar *ns_arr[]; |
| 56 |
|
| 57 |
#endif /* XMLSTAR_H */ |