version 1.2, 2008/11/22 18:34:06 |
version 1.13, 2008/12/09 00:27:17 |
|
|
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
struct md_rbuf { |
struct md_params_xml { |
int fd; |
int dummy; |
const char *name; |
|
char *buf; |
|
size_t bufsz; |
|
size_t line; |
|
}; |
}; |
|
|
struct md_mbuf { |
struct md_params_html { |
int fd; |
char *css; |
const char *name; |
int flags; |
char *buf; |
#define HTML_CSS_EMBED (1 << 0) |
size_t bufsz; |
|
size_t pos; |
|
}; |
}; |
|
|
|
union md_params { |
|
struct md_params_xml xml; |
|
struct md_params_html html; |
|
}; |
|
|
enum md_type { |
enum md_type { |
MD_DUMMY |
MD_XML, /* XML. */ |
|
MD_HTML /* HTML4.01-strict. */ |
}; |
}; |
|
|
|
struct md_args { |
|
union md_params params;/* Parameters for parser. */ |
|
enum md_type type; /* Type of parser. */ |
|
|
|
int warnings; |
|
#define MD_WARN_ALL (1 << 0) |
|
#define MD_WARN_ERROR (1 << 1) |
|
int verbosity; |
|
}; |
|
|
|
struct md_buf { |
|
int fd; /* Open file descriptor. */ |
|
char *name; /* Name of file/socket/whatever. */ |
|
char *buf; /* Buffer for storing data. */ |
|
size_t bufsz; /* Size of buf. */ |
|
}; |
|
|
__BEGIN_DECLS |
__BEGIN_DECLS |
|
|
int md_run(enum md_type, struct md_mbuf *, struct md_rbuf *); |
/* Run the parser over prepared input and output buffers. Returns -1 on |
|
* failure and 0 on success. |
|
*/ |
|
int md_run(const struct md_args *, |
|
const struct md_buf *, const struct md_buf *); |
|
|
__END_DECLS |
__END_DECLS |
|
|