summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-10-24 20:22:05 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-10-24 20:26:03 -0700
commitabc95bdfa1fd4f4ffb5b0727aec34791a6e472e5 (patch)
tree41d7aadcb3a91edd0610da1cd85d9c0a1c02fff7 /src
parent7f0d1a80c7871a97dcf6495fba9f0e3c8d86be81 (diff)
Renamed c program and library stmd -> cmark.
Also renamed internal library functions accordingly.
Diffstat (limited to 'src')
-rw-r--r--src/blocks.c10
-rw-r--r--src/cmark.h (renamed from src/stmd.h)10
-rw-r--r--src/html/html.c4
-rw-r--r--src/inlines.c2
-rw-r--r--src/main.c18
-rw-r--r--src/print.c4
-rw-r--r--src/references.c2
-rw-r--r--src/scanners.h2
-rw-r--r--src/utf8.h4
9 files changed, 28 insertions, 28 deletions
diff --git a/src/blocks.c b/src/blocks.c
index bcec27a..ae106d2 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -4,7 +4,7 @@
#include <stdbool.h>
#include <ctype.h>
-#include "stmd.h"
+#include "cmark.h"
#include "utf8.h"
#include "scanners.h"
#include "inlines.h"
@@ -253,7 +253,7 @@ static node_block* add_child(node_block* parent,
}
// Free a node_block list and any children.
-void stmd_free_nodes(node_block *e)
+void cmark_free_nodes(node_block *e)
{
node_block * next;
while (e != NULL) {
@@ -265,7 +265,7 @@ void stmd_free_nodes(node_block *e)
} else if (e->tag == BLOCK_DOCUMENT) {
reference_map_free(e->as.document.refmap);
}
- stmd_free_nodes(e->children);
+ cmark_free_nodes(e->children);
free(e);
e = next;
}
@@ -380,7 +380,7 @@ static node_block *finalize_document(node_block *document, int linenum)
return document;
}
-extern node_block *stmd_parse_file(FILE *f)
+extern node_block *cmark_parse_file(FILE *f)
{
strbuf line = GH_BUF_INIT;
unsigned char buffer[4096];
@@ -398,7 +398,7 @@ extern node_block *stmd_parse_file(FILE *f)
return finalize_document(document, linenum);
}
-extern node_block *stmd_parse_document(const unsigned char *buffer, size_t len)
+extern node_block *cmark_parse_document(const unsigned char *buffer, size_t len)
{
strbuf line = GH_BUF_INIT;
int linenum = 1;
diff --git a/src/stmd.h b/src/cmark.h
index 552e60e..ff2f9a2 100644
--- a/src/stmd.h
+++ b/src/cmark.h
@@ -104,12 +104,12 @@ struct node_block {
typedef struct node_block node_block;
-node_block *stmd_parse_document(const unsigned char *buffer, size_t len);
-node_block *stmd_parse_file(FILE *f);
+node_block *cmark_parse_document(const unsigned char *buffer, size_t len);
+node_block *cmark_parse_file(FILE *f);
-void stmd_free_nodes(node_block *e);
+void cmark_free_nodes(node_block *e);
-void stmd_debug_print(node_block *root);
-void stmd_render_html(strbuf *html, node_block *root);
+void cmark_debug_print(node_block *root);
+void cmark_render_html(strbuf *html, node_block *root);
#endif
diff --git a/src/html/html.c b/src/html/html.c
index ab6fc35..fde1cb4 100644
--- a/src/html/html.c
+++ b/src/html/html.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <assert.h>
-#include "stmd.h"
+#include "cmark.h"
#include "debug.h"
#include "html/houdini.h"
@@ -222,7 +222,7 @@ static void blocks_to_html(strbuf *html, node_block *b, bool tight)
}
}
-void stmd_render_html(strbuf *html, node_block *root)
+void cmark_render_html(strbuf *html, node_block *root)
{
blocks_to_html(html, root, false);
}
diff --git a/src/inlines.c b/src/inlines.c
index 4744312..7a7f08a 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -4,7 +4,7 @@
#include <stdbool.h>
#include <ctype.h>
-#include "stmd.h"
+#include "cmark.h"
#include "html/houdini.h"
#include "utf8.h"
#include "scanners.h"
diff --git a/src/main.c b/src/main.c
index 99d14f8..b2404f6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,12 +1,12 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "stmd.h"
+#include "cmark.h"
#include "debug.h"
void print_usage()
{
- printf("Usage: stmd [FILE*]\n");
+ printf("Usage: cmark [FILE*]\n");
printf("Options: --help, -h Print usage information\n");
printf(" --ast Print AST instead of HTML\n");
printf(" --version Print version\n");
@@ -17,9 +17,9 @@ static void print_document(node_block *document, bool ast)
strbuf html = GH_BUF_INIT;
if (ast) {
- stmd_debug_print(document);
+ cmark_debug_print(document);
} else {
- stmd_render_html(&html, document);
+ cmark_render_html(&html, document);
printf("%s", html.ptr);
strbuf_free(&html);
}
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "--version") == 0) {
- printf("stmd %s", VERSION);
+ printf("cmark %s", VERSION);
printf(" - CommonMark converter (c) 2014 John MacFarlane\n");
exit(0);
} else if ((strcmp(argv[i], "--help") == 0) ||
@@ -52,9 +52,9 @@ int main(int argc, char *argv[])
}
if (numfps == 0) {
- document = stmd_parse_file(stdin);
+ document = cmark_parse_file(stdin);
print_document(document, ast);
- stmd_free_nodes(document);
+ cmark_free_nodes(document);
} else {
for (i = 0; i < numfps; i++) {
FILE *fp = fopen(argv[files[i]], "r");
@@ -65,9 +65,9 @@ int main(int argc, char *argv[])
exit(1);
}
- document = stmd_parse_file(fp);
+ document = cmark_parse_file(fp);
print_document(document, ast);
- stmd_free_nodes(document);
+ cmark_free_nodes(document);
fclose(fp);
}
}
diff --git a/src/print.c b/src/print.c
index f3bd8e5..be3bced 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "stmd.h"
+#include "cmark.h"
#include "debug.h"
static void print_str(const unsigned char *s, int len)
@@ -170,7 +170,7 @@ static void print_blocks(node_block* b, int indent)
}
}
-void stmd_debug_print(node_block *root)
+void cmark_debug_print(node_block *root)
{
print_blocks(root, 0);
}
diff --git a/src/references.c b/src/references.c
index 6759c2c..04b9025 100644
--- a/src/references.c
+++ b/src/references.c
@@ -1,4 +1,4 @@
-#include "stmd.h"
+#include "cmark.h"
#include "utf8.h"
#include "references.h"
#include "inlines.h"
diff --git a/src/scanners.h b/src/scanners.h
index 785d424..86dbcf5 100644
--- a/src/scanners.h
+++ b/src/scanners.h
@@ -1,4 +1,4 @@
-#include "stmd.h"
+#include "cmark.h"
extern int _scan_autolink_uri(const unsigned char *p);
extern int _scan_autolink_email(const unsigned char *p);
diff --git a/src/utf8.h b/src/utf8.h
index c971250..496eae9 100644
--- a/src/utf8.h
+++ b/src/utf8.h
@@ -1,5 +1,5 @@
-#ifndef _H_STMD_UTF8_
-#define _H_STMD_UTF8_
+#ifndef _H_cmark_UTF8_
+#define _H_cmark_UTF8_
#include <stdint.h>
#include "buffer.h"