split up some headers + rename markdown_io to parser
authorMichael Göhler <somebody.here@gmx.de>
Sun, 17 Aug 2014 20:50:12 +0000 (22:50 +0200)
committerMichael Göhler <somebody.here@gmx.de>
Sun, 17 Aug 2014 20:50:12 +0000 (22:50 +0200)
Makefile
include/bitops.h [new file with mode: 0644]
include/markdown.h
include/parser.h [new file with mode: 0644]
parser.c [moved from markdown_io.c with 98% similarity]
tmp.c

index ee57e1d..ec4c76e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
-tmp: tmp.c cstring.o markdown.o markdown_io.o
-       cc -g -o tmp tmp.c cstring.o markdown.o markdown_io.o
+tmp: tmp.c cstring.o markdown.o parser.o
+       cc -g -o tmp tmp.c cstring.o markdown.o parser.o
 
-markdown_io.o: markdown_io.c cstring.o markdown.o
-       cc -g -c markdown_io.c -o markdown_io.o -lmarkdown
+parser.o: parser.c cstring.o markdown.o
+       cc -g -c parser.c -o parser.o -lmarkdown
 
 markdown.o: markdown.c cstring.o
        cc -g -c markdown.c -o markdown.o -lcstring
diff --git a/include/bitops.h b/include/bitops.h
new file mode 100644 (file)
index 0000000..e18f3b0
--- /dev/null
@@ -0,0 +1,9 @@
+#if !defined( BITOPS_H )
+#define BITOPS_H
+
+#define SET_BIT(var, pos)    ((var) |= (1<<(pos)))
+#define CLEAR_BIT(var, pos)  ((var) &= (~(1<<(pos))))
+#define TOGGLE_BIT(var, pos) ((var) ^= (1<<(pos)))
+#define CHECK_BIT(var, pos)  ((var) &  (1<<(pos)))
+
+#endif // !defined( BITOPS_H )
index 9c29d86..b26765e 100644 (file)
@@ -7,11 +7,7 @@
  */
 
 #include "cstring.h"
-
-#define SET_BIT(var, pos)    ((var) |= (1<<(pos)))
-#define CLEAR_BIT(var, pos)  ((var) &= (~(1<<(pos))))
-#define TOGGLE_BIT(var, pos) ((var) ^= (1<<(pos)))
-#define CHECK_BIT(var, pos)  ((var) &  (1<<(pos)))
+#include "bitops.h"
 
 enum line_bitmask {
     IS_H1,
@@ -46,9 +42,5 @@ line_t *next_line(line_t *prev);
 page_t *new_page();
 page_t *next_page(page_t *prev);
 document_t *new_document();
-int is_utf8(char ch);
-int next_nonblank(cstring_t *text, int i);
-int next_blank(cstring_t *text, int i);
-document_t *markdown_load(FILE *input);
 
 #endif // !defined( MARKDOWN_H )
diff --git a/include/parser.h b/include/parser.h
new file mode 100644 (file)
index 0000000..7ade17c
--- /dev/null
@@ -0,0 +1,12 @@
+#if !defined( PARSER_H )
+#define PARSER_H
+
+#include "markdown.h"
+
+document_t *markdown_load(FILE *input);
+int markdown_analyse(cstring_t *text);
+int is_utf8(char ch);
+int next_nonblank(cstring_t *text, int i);
+int next_blank(cstring_t *text, int i);
+
+#endif // !defined( PARSER_H )
similarity index 98%
rename from markdown_io.c
rename to parser.c
index 7c80695..0343509 100644 (file)
+++ b/parser.c
@@ -1,8 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "include/cstring.h"
-#include "include/markdown.h"
+#include "include/parser.h"
 
 document_t *markdown_load(FILE *input) {
 
diff --git a/tmp.c b/tmp.c
index bcb624e..eeec4a4 100644 (file)
--- a/tmp.c
+++ b/tmp.c
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "include/markdown.h"
+#include "include/parser.h"
 
 void usage() {
     fprintf(stderr, "Usage: tmp [OPTION]... [FILE]\n");