summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-11-16 11:08:28 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-11-16 11:08:28 -0800
commitb3a96dc9f5f8896ce3341da9029c844afb5c5209 (patch)
treee307117ed2c9cdb118394c822b7cd5b9ac9cca5a
parent5a26ca5cf9481289ad77d6049b55c48feea7cc38 (diff)
Moved inline/block-making functions to ast.h.
Now we no longer depend on buffer.h or chunk.h in the public API. Install cmark.h and cmark_export.h into PREFIX/include instead of PREFIX/include/cmark.
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/ast.h33
-rw-r--r--src/cmark.h39
3 files changed, 36 insertions, 40 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7da839f..9bae3b5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -89,8 +89,8 @@ install(TARGETS ${PROGRAM} ${LIBRARY}
LIBRARY DESTINATION lib
)
-install(FILES cmark.h chunk.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
- DESTINATION include/${PROJECT_NAME}
+install(FILES cmark.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
+ DESTINATION include
)
include (CheckIncludeFile)
diff --git a/src/ast.h b/src/ast.h
index b4427c0..263b9cb 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -128,6 +128,27 @@ struct cmark_doc_parser {
cmark_strbuf *curline;
};
+struct cmark_node_inl *cmark_make_link(struct cmark_node_inl *label, unsigned char *url, unsigned char *title);
+
+struct cmark_node_inl* cmark_make_autolink(struct cmark_node_inl* label, cmark_chunk url, int is_email);
+
+struct cmark_node_inl* cmark_make_inlines(int t, struct cmark_node_inl* contents);
+
+struct cmark_node_inl* cmark_make_literal(int t, cmark_chunk s);
+
+struct cmark_node_inl* cmark_make_simple(int t);
+
+// Macros for creating various kinds of simple.
+#define cmark_make_str(s) cmark_make_literal(INL_STRING, s)
+#define cmark_make_code(s) cmark_make_literal(INL_CODE, s)
+#define cmark_make_raw_html(s) cmark_make_literal(INL_RAW_HTML, s)
+#define cmark_make_linebreak() cmark_make_simple(INL_LINEBREAK)
+#define cmark_make_softbreak() cmark_make_simple(INL_SOFTBREAK)
+#define cmark_make_emph(contents) cmark_make_inlines(INL_EMPH, contents)
+#define cmark_make_strong(contents) cmark_make_inlines(INL_STRONG, contents)
+
+
+
#ifndef CMARK_NO_SHORT_NAMES
#define node_inl cmark_node_inl
#define INL_STRING CMARK_INL_STRING
@@ -154,6 +175,18 @@ struct cmark_doc_parser {
#define BLOCK_SETEXT_HEADER CMARK_BLOCK_SETEXT_HEADER
#define BLOCK_HRULE CMARK_BLOCK_HRULE
#define BLOCK_REFERENCE_DEF CMARK_BLOCK_REFERENCE_DEF
+ #define make_link cmark_make_link
+ #define make_autolink cmark_make_autolink
+ #define make_str cmark_make_str
+ #define make_code cmark_make_code
+ #define make_raw_html cmark_make_raw_html
+ #define make_linebreak cmark_make_linebreak
+ #define make_softbreak cmark_make_softbreak
+ #define make_emph cmark_make_emph
+ #define make_strong cmark_make_strong
+ #define make_simple cmark_make_simple
+ #define make_literal cmark_make_literal
+ #define make_inlines cmark_make_inlines
#endif
#ifdef __cplusplus
diff --git a/src/cmark.h b/src/cmark.h
index 3dfb2de..7591766 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -3,7 +3,7 @@
#include <stdbool.h>
#include <stdio.h>
-#include "chunk.h"
+#include "cmark_export.h"
#ifdef __cplusplus
extern "C" {
@@ -53,31 +53,6 @@ void cmark_free_blocks(cmark_node_block *e);
CMARK_EXPORT
void cmark_free_inlines(cmark_node_inl* e);
-CMARK_EXPORT
-cmark_node_inl *cmark_make_link(cmark_node_inl *label, unsigned char *url, unsigned char *title);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_autolink(cmark_node_inl* label, cmark_chunk url, int is_email);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_inlines(int t, cmark_node_inl* contents);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_literal(int t, cmark_chunk s);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_simple(int t);
-
-// Macros for creating various kinds of simple.
-#define cmark_make_str(s) cmark_make_literal(INL_STRING, s)
-#define cmark_make_code(s) cmark_make_literal(INL_CODE, s)
-#define cmark_make_raw_html(s) cmark_make_literal(INL_RAW_HTML, s)
-#define cmark_make_linebreak() cmark_make_simple(INL_LINEBREAK)
-#define cmark_make_softbreak() cmark_make_simple(INL_SOFTBREAK)
-#define cmark_make_emph(contents) cmark_make_inlines(INL_EMPH, contents)
-#define cmark_make_strong(contents) cmark_make_inlines(INL_STRONG, contents)
-
-
#ifndef CMARK_NO_SHORT_NAMES
#define VERSION CMARK_VERSION
#define CODE_INDENT CMARK_CODE_INDENT
@@ -109,18 +84,6 @@ cmark_node_inl* cmark_make_simple(int t);
#define BLOCK_REFERENCE_DEF CMARK_BLOCK_REFERENCE_DEF
#define free_simple cmark_free_simple
#define free_blocks cmark_free_blocks
- #define make_link cmark_make_link
- #define make_autolink cmark_make_autolink
- #define make_str cmark_make_str
- #define make_code cmark_make_code
- #define make_raw_html cmark_make_raw_html
- #define make_linebreak cmark_make_linebreak
- #define make_softbreak cmark_make_softbreak
- #define make_emph cmark_make_emph
- #define make_strong cmark_make_strong
- #define make_simple cmark_make_simple
- #define make_literal cmark_make_literal
- #define make_inlines cmark_make_inlines
#define doc_parser cmark_doc_parser
#define new_doc_parser cmark_new_doc_parser
#define free_doc_parser cmark_free_doc_parser