]> granicus.if.org Git - multimarkdown/commitdiff
UPDATED: Refactor header file inclusion
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 13 Apr 2019 03:00:20 +0000 (23:00 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 13 Apr 2019 03:00:20 +0000 (23:00 -0400)
17 files changed:
Sources/libMultiMarkdown/beamer.c
Sources/libMultiMarkdown/epub.c
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/html.h
Sources/libMultiMarkdown/itmz-reader.c
Sources/libMultiMarkdown/itmz.c
Sources/libMultiMarkdown/latex.c
Sources/libMultiMarkdown/mmd.c
Sources/libMultiMarkdown/mmd.h
Sources/libMultiMarkdown/opendocument-content.c
Sources/libMultiMarkdown/opml-reader.c
Sources/libMultiMarkdown/opml.c
Sources/libMultiMarkdown/parser.c
Sources/libMultiMarkdown/parser.y
Sources/libMultiMarkdown/textbundle.c
Sources/libMultiMarkdown/writer.c
Sources/libMultiMarkdown/writer.h

index 48fd69ff208b7070de23c07760012d1db5b179e6..479ac1d40069415fb0ba2b9542b985f1403e79fc 100644 (file)
@@ -56,6 +56,7 @@
 #include "latex.h"
 #include "beamer.h"
 #include "parser.h"
+#include "stack.h"
 
 #define print(x) d_string_append(out, x)
 #define print_const(x) d_string_append_c_array(out, x, sizeof(x) - 1)
index e16a51f11abf2d3c39e0856b733a598ca169a134..b0ff9ef0daab647994f4fb9e3e1853c41770646a 100644 (file)
@@ -82,6 +82,7 @@
 #include "html.h"
 #include "i18n.h"
 #include "miniz.h"
+#include "stack.h"
 #include "uuid.h"
 #include "writer.h"
 #include "zip.h"
index 1c6606b727cbf82240b35a35a21dd6feb5e452d4..321fb1026061ccc5ed6099284cc2150c5f5af8cc 100644 (file)
 #include "html.h"
 #include "i18n.h"
 #include "libMultiMarkdown.h"
+#include "mmd.h"
 #include "parser.h"
 #include "token.h"
 #include "scanners.h"
+#include "stack.h"
 #include "writer.h"
 
 
@@ -1699,6 +1701,7 @@ parse_citation:
                        break;
 
                case PAIR_CRITIC_ADD:
+                       stack_push(scratch->critic_stack, t);
 
                        // Ignore if we're rejecting
                        if (scratch->extensions & EXT_CRITIC_REJECT) {
@@ -1723,6 +1726,7 @@ parse_citation:
                        break;
 
                case PAIR_CRITIC_DEL:
+                       stack_push(scratch->critic_stack, t);
 
                        // Ignore if we're accepting
                        if (scratch->extensions & EXT_CRITIC_ACCEPT) {
@@ -1747,6 +1751,7 @@ parse_citation:
                        break;
 
                case PAIR_CRITIC_COM:
+                       stack_push(scratch->critic_stack, t);
 
                        // Ignore if we're rejecting or accepting
                        if ((scratch->extensions & EXT_CRITIC_REJECT) ||
@@ -1798,6 +1803,8 @@ parse_citation:
                        break;
 
                case PAIR_CRITIC_SUB_DEL:
+                       stack_push(scratch->critic_stack, t);
+
                        if ((scratch->extensions & EXT_CRITIC) &&
                                        (t->next) &&
                                        (t->next->type == PAIR_CRITIC_SUB_ADD)) {
@@ -1820,6 +1827,8 @@ parse_citation:
                        break;
 
                case PAIR_CRITIC_SUB_ADD:
+                       stack_push(scratch->critic_stack, t);
+
                        if ((scratch->extensions & EXT_CRITIC) &&
                                        (t->prev) &&
                                        (t->prev->type == PAIR_CRITIC_SUB_DEL)) {
index 3a0bc84dd08144a74a7bb138e01e3c12fe5aa7c0..0ffbdb9bf5afd15163056e2eb7646422e262a0a8 100644 (file)
@@ -56,7 +56,8 @@
 #ifndef HTML_MULTIMARKDOWN_H
 #define HTML_MULTIMARKDOWN_H
 
-#include "d_string.h"
+typedef struct DString DString;
+
 #include "token.h"
 #include "writer.h"
 
index b3160ad604bfe4a6deddc6320eb02664108fe3fa..9fdbcd9efd984be5e0ae64fdba9a07fd68c835f3 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "d_string.h"
 #include "mmd.h"
 #include "itmz-reader.h"
 #include "itmz-lexer.h"
index ea5871969c6bb98726425eae90dc9c9a77b9fa9c..a06834c9681a441436114307b6aad6fca7237419 100644 (file)
 
 #include "itmz.h"
 #include "parser.h"
+#include "stack.h"
 #include "uuid.h"
 #include "zip.h"
 
index 936b79f29220b440b8e1915b57db275ec22cef81..12c0392995cb6a0f983f273022ebcff15ee7a2f0 100644 (file)
@@ -62,6 +62,8 @@
 #include "latex.h"
 #include "parser.h"
 #include "scanners.h"
+#include "stack.h"
+
 
 #define print(x) d_string_append(out, x)
 #define print_const(x) d_string_append_c_array(out, x, sizeof(x) - 1)
index 7728d2d4cab3162cb81844bd7f88790f5706be9a..e33480ee8815cdee2d03238b094e30659d8b161e 100644 (file)
@@ -126,6 +126,7 @@ mmd_engine * mmd_engine_create(DString * d, unsigned long extensions) {
                e->quotes_lang = ENGLISH;
 
                e->abbreviation_stack = stack_new(0);
+               e->critic_stack = stack_new(0);
                e->citation_stack = stack_new(0);
                e->definition_stack = stack_new(0);
                e->footnote_stack = stack_new(0);
@@ -309,6 +310,7 @@ void mmd_engine_reset(mmd_engine * e) {
        }
 
        // Reset other stacks
+       e->critic_stack->size = 0;
        e->definition_stack->size = 0;
        e->header_stack->size = 0;
        e->table_stack->size = 0;
@@ -339,6 +341,7 @@ void mmd_engine_free(mmd_engine * e, bool freeDString) {
 
        // Takedown
        stack_free(e->abbreviation_stack);
+       stack_free(e->critic_stack);
        stack_free(e->citation_stack);
        stack_free(e->footnote_stack);
        stack_free(e->glossary_stack);
index 026b17f1817fc40af547de0d56d4de71011a3cb4..25d56908ab8a89eb5074cbc9056b7b4b6dafa0ef 100644 (file)
 #ifndef MMD_MULTIMARKDOWN_H
 #define MMD_MULTIMARKDOWN_H
 
-#include "d_string.h"
 #include "libMultiMarkdown.h"
-#include "stack.h"
-#include "token.h"
-#include "token_pairs.h"
 #include "uthash.h"
 
+typedef struct token_pair_engine toke_pair_engine;
 
 #define kMaxParseRecursiveDepth 1000           //!< Maximum recursion depth when parsing -- to prevent stack overflow with "pathologic" input
 
@@ -75,13 +72,14 @@ struct mmd_engine {
 
        bool                                    allow_meta;
 
-       token_pair_engine       *       pairings1;
-       token_pair_engine       *       pairings2;
-       token_pair_engine       *       pairings3;
-       token_pair_engine       *       pairings4;
+       struct token_pair_engine        *       pairings1;
+       struct token_pair_engine        *       pairings2;
+       struct token_pair_engine        *       pairings3;
+       struct token_pair_engine        *       pairings4;
 
        stack           *                       abbreviation_stack;
        stack           *                       citation_stack;
+       stack           *                       critic_stack;
        stack           *                       definition_stack;
        stack           *                       footnote_stack;
        stack           *                       glossary_stack;
@@ -113,7 +111,7 @@ void is_list_loose(token * list);
 struct asset {
        char            *               url;
        char            *               asset_path;
-       UT_hash_handle          hh;
+       struct UT_hash_handle           hh;
 };
 
 typedef struct asset asset;
index ba0dd6826df83e49f26a767ddd2cda002456b2c5..9a30999d4707b2e6bba47c484446152bc7e95483 100644 (file)
 #include <string.h>
 
 #include "char.h"
+#include "d_string.h"
 #include "opendocument-content.h"
+#include "mmd.h"
 #include "parser.h"
 #include "scanners.h"
+#include "stack.h"
+#include "token.h"
 
 
 #define print(x) d_string_append(out, x)
index bfa6d72d0593df3aed2983636086aec6f41dccd8..0fd2bf8247630e00d9b3f4d5acd458c8d4ae9a28 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "d_string.h"
 #include "mmd.h"
 #include "opml-reader.h"
 #include "opml-lexer.h"
index e2ea8b4c44e5d969a87640cc0a3ce9162f323124..0025d0fceda74601643378a7dbefc0bd5fec1a9a 100644 (file)
 
 #include "opml.h"
 #include "parser.h"
+#include "stack.h"
+
 
 #define print(x) d_string_append(out, x)
 #define print_const(x) d_string_append_c_array(out, x, sizeof(x) - 1)
index 1ce6a9880615882ec23cdbe94296f1895ebf9b86..1ae42aaa1ca90a81f786971553b33c95f285fe85 100644 (file)
@@ -32,6 +32,7 @@
        #include "libMultiMarkdown.h"
        #include "mmd.h"
        #include "parser.h"
+       #include "stack.h"
        #include "token.h"
 /**************** End of %include directives **********************************/
 /* These constants specify the various numeric values for terminal symbols
index 8ff3bd265592fdc0bca7a213c49de18e4d2993de..c8c4d080267dea2235132bb81a241fef954741fd 100644 (file)
@@ -380,6 +380,7 @@ para                                ::= defs.
        #include "libMultiMarkdown.h"
        #include "mmd.h"
        #include "parser.h"
+       #include "stack.h"
        #include "token.h"
 }
 
index 44e67badb4b30ec5853a56fd7845288c9b293f62..b1f4637224925a6b38c993d7d881e6cb2c2d9750 100644 (file)
 
 #include "file.h"
 #include "miniz.h"
+#include "stack.h"
 #include "textbundle.h"
+#include "token.h"
 #include "writer.h"
 #include "zip.h"
 
index 06962308dfb84f95cc18f513ca4144ee291dc7ca..2a7e0c3d14a34a07861da8d073f7e7d85183e0a1 100644 (file)
@@ -73,6 +73,7 @@
 #include "opml.h"
 #include "parser.h"
 #include "scanners.h"
+#include "stack.h"
 #include "token.h"
 #include "uuid.h"
 #include "writer.h"
@@ -257,6 +258,8 @@ scratch_pad * scratch_pad_new(mmd_engine * e, short format) {
                p->asset_hash = NULL;
                p->store_assets = 0;
                p->remember_assets = 0;
+
+               p->critic_stack = e->critic_stack;
        }
 
        return p;
index fbe97c83671dea0b8b26ab3078e24bde238e3a91..45b9395633515071bad6e284d2eafea0335f62c6 100644 (file)
        #include "CuTest.h"
 #endif
 
-#include "d_string.h"
+#include "libMultiMarkdown.h"
+#include "uthash.h"
+
+/*
+ #include "d_string.h"
 #include "mmd.h"
 #include "stack.h"
 #include "token.h"
 #include "uthash.h"
-
+*/
 
 #define kMaxExportRecursiveDepth 1000          //!< Maximum recursion depth when exporting token tree -- to prevent stack overflow with "pathologic" input
 
 #define kMaxTableColumns 48                                    //!< Maximum number of table columns for specifying alignment
 
+typedef struct asset asset;
+typedef struct stack stack;
+
 typedef struct {
        struct link     *       link_hash;
        struct meta     *       meta_hash;
@@ -130,6 +137,8 @@ typedef struct {
        struct asset    *       asset_hash;
        short                           store_assets;
        short                           remember_assets;
+
+       stack *                         critic_stack;
 } scratch_pad;