diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-04 23:13:54 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-04 23:13:54 -0800 |
commit | 27bd6c0b18318a9c43801409bbababf2ceb6302e (patch) | |
tree | 9a0bf89df4ffc1e47346c6958e62d193f918c660 /src/houdini.h | |
parent | ed17cfc71a19e614a437581b6991a43d06ca6e01 (diff) |
Moved source files from src/html into src.
The separate directory presents problems for some simple
extension building systems, like luarocks.
Diffstat (limited to 'src/houdini.h')
-rw-r--r-- | src/houdini.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/houdini.h b/src/houdini.h new file mode 100644 index 0000000..9e1200e --- /dev/null +++ b/src/houdini.h @@ -0,0 +1,52 @@ +#ifndef CMARK_HOUDINI_H +#define CMARK_HOUDINI_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> +#include "config.h" +#include "buffer.h" + +#ifdef HAVE___BUILTIN_EXPECT +# define likely(x) __builtin_expect((x),1) +# define unlikely(x) __builtin_expect((x),0) +#else +# define likely(x) (x) +# define unlikely(x) (x) +#endif + +#ifdef HOUDINI_USE_LOCALE +# define _isxdigit(c) isxdigit(c) +# define _isdigit(c) isdigit(c) +#else +/* + * Helper _isdigit methods -- do not trust the current locale + * */ +# define _isxdigit(c) (strchr("0123456789ABCDEFabcdef", (c)) != NULL) +# define _isdigit(c) ((c) >= '0' && (c) <= '9') +#endif + +#define HOUDINI_ESCAPED_SIZE(x) (((x) * 12) / 10) +#define HOUDINI_UNESCAPED_SIZE(x) (x) + +extern size_t houdini_unescape_ent(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_escape_html(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_escape_html0(strbuf *ob, const uint8_t *src, size_t size, int secure); +extern int houdini_unescape_html(strbuf *ob, const uint8_t *src, size_t size); +extern void houdini_unescape_html_f(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_escape_xml(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_escape_uri(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_escape_url(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_escape_href(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_unescape_uri(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_unescape_url(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_escape_js(strbuf *ob, const uint8_t *src, size_t size); +extern int houdini_unescape_js(strbuf *ob, const uint8_t *src, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif |