summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmark.c3
-rw-r--r--src/cmark.h33
-rw-r--r--src/main.c2
3 files changed, 33 insertions, 5 deletions
diff --git a/src/cmark.c b/src/cmark.c
index 1d7a500..2ec9be9 100644
--- a/src/cmark.c
+++ b/src/cmark.c
@@ -6,6 +6,9 @@
#include "cmark.h"
#include "buffer.h"
+const int cmark_version = CMARK_VERSION;
+const char cmark_version_string[] = CMARK_VERSION_STRING;
+
char *cmark_markdown_to_html(const char *text, int len)
{
cmark_node *doc;
diff --git a/src/cmark.h b/src/cmark.h
index 8177fa8..faa5150 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -18,10 +18,6 @@ extern "C" {
* ## Simple Interface
*/
-/** Current version of library.
- */
-#define CMARK_VERSION "0.1"
-
/** Convert 'text' (assumed to be a UTF-8 encoded string with length
* 'len' from CommonMark Markdown to HTML, returning a null-terminated,
* UTF-8-encoded string.
@@ -499,6 +495,35 @@ char *cmark_render_man(cmark_node *root, long options);
*/
#define CMARK_OPT_NORMALIZE 4
+/**
+ * ## Version information
+ */
+
+/** Macro containing the library version as integer for compile time
+ * checks.
+ *
+ * * Bits 16-23 contain the major version.
+ * * Bits 8-15 contain the minor version.
+ * * Bits 0-7 contain the patchlevel.
+ *
+ * In hexadecimal format, the number 0x010203 represents version 1.2.3.
+ */
+#define CMARK_VERSION 0x000100
+
+/** Macro containing the library version string for compile time checks.
+ */
+#define CMARK_VERSION_STRING "0.1.0"
+
+/** The library version as integer for runtime checks.
+ */
+CMARK_EXPORT
+extern const int cmark_version;
+
+/** The library version string for runtime checks.
+ */
+CMARK_EXPORT
+extern const char cmark_version_string[];
+
/** # AUTHORS
*
* John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer.
diff --git a/src/main.c b/src/main.c
index 5855868..ef40a88 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "--version") == 0) {
- printf("cmark %s", CMARK_VERSION);
+ printf("cmark %s", CMARK_VERSION_STRING);
printf(" - CommonMark converter (c) 2014 John MacFarlane\n");
exit(0);
} else if (strcmp(argv[i], "--sourcepos") == 0) {