From 46330867a8d82bf45f2ea575b93c5f0d4496ca0c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 11 Jul 2015 23:15:31 -0700 Subject: Restructured common renderer code. * Added functions for cr, blankline, out to renderer object. * Removed lit (we'll handle this with a macro). * Changed type of out so it takes a regular string instead of a chunk. * Use macros LIT, OUT, BLANKLINE, CR in renderers to simplify code. (Not sure about this, but `renderer->out(renderer, ...)` sure is verbose.) --- src/render.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/render.h') diff --git a/src/render.h b/src/render.h index 718050e..cf5b078 100644 --- a/src/render.h +++ b/src/render.h @@ -32,21 +32,16 @@ struct cmark_renderer { cmark_escaping, int32_t, unsigned char); + void (*cr)(struct cmark_renderer*); + void (*blankline)(struct cmark_renderer*); + void (*out)(struct cmark_renderer*, + const char *, + bool, + cmark_escaping); }; typedef struct cmark_renderer cmark_renderer; -void cr(cmark_renderer *renderer); - -void blankline(cmark_renderer *renderer); - -void out(cmark_renderer *renderer, - cmark_chunk str, - bool wrap, - cmark_escaping escape); - -void lit(cmark_renderer *renderer, char *s, bool wrap); - char* cmark_render(cmark_node *root, int options, -- cgit v1.2.3