diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-13 12:08:19 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-13 12:09:25 -0800 |
commit | 8d6efe632aaeb1831c86b27e120a344c5e3ee7d4 (patch) | |
tree | 709393e79901bb426bd853c231e20442948e1551 /src/cmark.h | |
parent | a6a7d2f8f47df7144e636ae2875a8d2ffc0173ae (diff) |
API improvements: cmark_event_type parameter for walk handlers.
Added cmark_event_type enum, which is used as the second
parameter of the handler passed to cmark_walk.
See #224.
Diffstat (limited to 'src/cmark.h')
-rw-r--r-- | src/cmark.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cmark.h b/src/cmark.h index 224ef3a..a43703a 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -85,7 +85,14 @@ typedef enum { typedef struct cmark_node cmark_node; typedef struct cmark_parser cmark_parser; -typedef int (*cmark_node_handler)(cmark_node*, int, void*); +typedef enum { + CMARK_EVENT_DONE, + CMARK_EVENT_ENTER, + CMARK_EVENT_EXIT +} cmark_event_type; + +typedef int (*cmark_node_handler)(cmark_node *node, cmark_event_type ev_type, + void *state); /** * .SH CREATING AND DESTROYING NODES @@ -311,7 +318,7 @@ char *cmark_render_html(cmark_node *root); /** Walks the tree starting from root, applying handler to each node. * Nodes that can have children are visited twice, once on the way in * and once on the way out. handler is a function that takes a node - * pointer, an integer direction (1 for entering, 0 for leaving), + * pointer, a cmark_event_type, * and a pointer to a state structure that can be consulted and * updated by the handler. The handler should return 1 on success, * 0 on failure. cmark_walk returns 1 if it traversed the entire |