]> granicus.if.org Git - multimarkdown/commitdiff
UPDATED: Tweaked astyle settings
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 22 Jul 2017 00:44:13 +0000 (20:44 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 22 Jul 2017 00:44:13 +0000 (20:44 -0400)
Sources/libMultiMarkdown/char_lookup.c
Sources/libMultiMarkdown/epub.c
Sources/libMultiMarkdown/mmd.c
Sources/libMultiMarkdown/opendocument.c
Sources/libMultiMarkdown/rng.c
Sources/libMultiMarkdown/textbundle.c
Sources/libMultiMarkdown/token.c
Sources/libMultiMarkdown/token_pairs.c
Sources/libMultiMarkdown/transclude.c
Sources/libMultiMarkdown/writer.c
Sources/multimarkdown/main.c

index 26799a8041cd2c8ba41fe76cb68d16405c12a402..e61a36c1bb49aee35af36cffed538e815bc3108f 100644 (file)
@@ -138,7 +138,7 @@ int main( int argc, char** argv ) {
 
 
        // Extended ASCII
-#ifdef USE_EXTENDED_ASCII
+       #ifdef USE_EXTENDED_ASCII
        // Punctuation ranges
        for (int i = 132; i < 138; ++i) {
                punctuation(i);
@@ -192,7 +192,7 @@ int main( int argc, char** argv ) {
                                break;
                }
        }
-#endif
+       #endif
 
 
        // Print output as 16 x 16 table
index e07bb99197d281bbcecbe19732dba4a9026537ab..eb82d56cbdd9507bfc604ef60995063babbea204 100644 (file)
@@ -59,7 +59,7 @@
 #include <sys/stat.h>
 
 #ifdef USE_CURL
-#include <curl/curl.h>
+       #include <curl/curl.h>
 #endif
 
 #include "epub.h"
index 328e57f2cdf1d4e367002e2e516b3c15c53e996a..87e3ff5d22ad458a9270af4386716cde42764731 100644 (file)
@@ -957,9 +957,9 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) {
        token * walker = chain->child;                          // Walk the existing tree
        token * remainder;                                                      // Hold unparsed tail of chain
 
-#ifndef NDEBUG
+       #ifndef NDEBUG
        ParseTrace(stderr, "parser >>");
-#endif
+       #endif
 
        // Remove existing token tree
        e->root = NULL;
@@ -974,9 +974,9 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) {
                if (remainder)
                        remainder->prev = NULL;
 
-#ifndef NDEBUG
+               #ifndef NDEBUG
                fprintf(stderr, "\nNew line\n");
-#endif
+               #endif
 
                Parse(pParser, walker->type, walker, e);
 
@@ -984,9 +984,9 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) {
        }
 
        // Signal finish to parser
-#ifndef NDEBUG
+       #ifndef NDEBUG
        fprintf(stderr, "\nFinish parse\n");
-#endif
+       #endif
        Parse(pParser, 0, NULL, e);
 
        // Disconnect of (now empty) root
@@ -1775,10 +1775,10 @@ void strip_line_tokens_from_block(mmd_engine * e, token * block) {
        if ((block == NULL) || (block->child == NULL))
                return;
 
-#ifndef NDEBUG
+       #ifndef NDEBUG
        fprintf(stderr, "Strip line tokens from %d (%lu:%lu) (child %d)\n", block->type, block->start, block->len, block->child->type);
        token_tree_describe(block, NULL);
-#endif
+       #endif
 
        token * l = block->child;
 
@@ -1955,9 +1955,9 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt
 
                pair_emphasis_tokens(doc);
 
-#ifndef NDEBUG
+               #ifndef NDEBUG
                token_tree_describe(doc, e->dstr->str);
-#endif
+               #endif
        }
 
        return doc;
index d3e318b9f1787c392d4e6c3e56acd1db9537737c..6d4253694e53a50d491f36d534bc4e352d07905c 100644 (file)
 */
 
 #ifdef USE_CURL
-#include <curl/curl.h>
+       #include <curl/curl.h>
 #endif
 
 #include "miniz.h"
index 1a239dab4dec46c6b877b1f84551812757314502..8646399fe68c438a185a46852eb5b84d91611d65 100644 (file)
 long ran_x[KK];                    /* the generator state */
 
 #ifdef __STDC__
-void ran_array(long aa[],int n)
+       void ran_array(long aa[],int n)
 #else
-void ran_array(aa,n)    /* put n new random numbers in aa */
-long *aa;   /* destination */
-int n;      /* array length (must be at least KK) */
+       void ran_array(aa,n)    /* put n new random numbers in aa */
+       long *aa;   /* destination */
+       int n;      /* array length (must be at least KK) */
 #endif
 {
        register int i,j;
@@ -52,10 +52,10 @@ long *ran_arr_ptr=&ran_arr_dummy; /* the next random number, or -1 */
 #define is_odd(x)  ((x)&1)          /* units bit of x */
 
 #ifdef __STDC__
-void ran_start(long seed)
+       void ran_start(long seed)
 #else
-void ran_start(seed)    /* do this before using ran_array */
-long seed;            /* selector for different streams */
+       void ran_start(seed)    /* do this before using ran_array */
+       long seed;            /* selector for different streams */
 #endif
 {
        register int t,j;
index bdd1d78f312019b7b7ea3d48c046c397f3ad3f78..07b93f3b72f1b816479141ef61fcefcfb0445c60 100644 (file)
 #include <sys/stat.h>
 
 #ifdef USE_CURL
-#include <curl/curl.h>
+       #include <curl/curl.h>
 #endif
 
 #include "textbundle.h"
index de6aa619be51c358425a680aed82d25188863b4d..6af41a12115fc8f00045a26ab5dd7d14607be63e 100644 (file)
@@ -114,11 +114,11 @@ void token_pool_free(void) {
 token * token_new(unsigned short type, size_t start, size_t len) {
 
 
-#ifdef kUseObjectPool
+       #ifdef kUseObjectPool
        token * t = pool_allocate_object(token_pool);
-#else
+       #else
        token * t = malloc(sizeof(token));
-#endif
+       #endif
 
        if (t) {
                t->type = type;
@@ -144,11 +144,11 @@ token * token_new(unsigned short type, size_t start, size_t len) {
 
 /// Duplicate an existing token
 token * token_copy(token * original) {
-#ifdef kUseObjectPool
+       #ifdef kUseObjectPool
        token * t = pool_allocate_object(token_pool);
-#else
+       #else
        token * t = malloc(sizeof(token));
-#endif
+       #endif
 
        if (t) {
                * t = * original;
@@ -360,24 +360,24 @@ token * token_prune_graft(token * first, token * last, unsigned short container_
 
 /// Free token
 void token_free(token * t) {
-#ifdef kUseObjectPool
+       #ifdef kUseObjectPool
        return;
-#else
+       #else
        if (t == NULL)
                return;
 
        token_tree_free(t->child);
 
        free(t);
-#endif
+       #endif
 }
 
 
 /// Free token chain
 void token_tree_free(token * t) {
-#ifdef kUseObjectPool
+       #ifdef kUseObjectPool
        return;
-#else
+       #else
        token * n;
 
        while (t != NULL) {
@@ -386,7 +386,7 @@ void token_tree_free(token * t) {
 
                t = n;
        }
-#endif
+       #endif
 }
 
 
index e19622afc6f96a2b491962314a8b04cd0f10d1da..c55e086bc3cc017f88e18f062076a071c8034bbb 100644 (file)
@@ -204,9 +204,9 @@ close:
                                                peek = stack_pop(s);
                                                opener_count[peek->type]--;
                                        }
-#ifndef NDEBUG
+                                       #ifndef NDEBUG
                                        fprintf(stderr, "stack now sized %lu\n", s->size);
-#endif
+                                       #endif
                                        // Prune matched section
 
                                        if (e->should_prune[pair_type]) {
@@ -220,11 +220,11 @@ close:
 
                                        break;
                                }
-#ifndef NDEBUG
+                               #ifndef NDEBUG
                                else {
                                        fprintf(stderr, "token type %d failed to match stack element\n", walker->type);
                                }
-#endif
+                               #endif
                                i--;
                        }
                }
@@ -234,17 +234,17 @@ open:
                if (walker->can_open && e->can_open_pair[walker->type] && walker->unmatched) {
                        stack_push(s, walker);
                        opener_count[walker->type]++;
-#ifndef NDEBUG
+                       #ifndef NDEBUG
                        fprintf(stderr, "push token type %d to stack (%lu elements)\n", walker->type, s->size);
-#endif
+                       #endif
                }
 
                walker = walker->next;
        }
 
-#ifndef NDEBUG
+       #ifndef NDEBUG
        fprintf(stderr, "token stack has %lu elements (of %lu)\n", s->size, s->capacity);
-#endif
+       #endif
 
        // Remove unused tokens from stack and return to parent
        s->size = start_counter;
index d6e24df4ed30d96f4d59dc8c65fc116187b22fc3..41a0226c38fe29f06440b2cb212b62ba64d2fc0b 100644 (file)
@@ -60,7 +60,7 @@
 #include "transclude.h"
 
 #if defined(__WIN32)
-#include <windows.h>
+       #include <windows.h>
 #endif
 
 #define kBUFFERSIZE 4096       // How many bytes to read at a time
@@ -106,11 +106,11 @@ static char * my_strdup(const char * source) {
 /// Windows can use either `\` or `/` as a separator -- thanks to t-beckmann on github
 ///    for suggesting a fix for this.
 bool is_separator(char c) {
-#if defined(__WIN32)
+       #if defined(__WIN32)
        return c == '\\' || c == '/';
-#else
+       #else
        return c == '/';
-#endif
+       #endif
 }
 
 
@@ -118,25 +118,25 @@ bool is_separator(char c) {
 void Test_is_separator(CuTest* tc) {
        char * test = "a/\\";
 
-#if defined(__WIN32)
+       #if defined(__WIN32)
        CuAssertIntEquals(tc, false, is_separator(test[0]));
        CuAssertIntEquals(tc, true, is_separator(test[1]));
        CuAssertIntEquals(tc, true, is_separator(test[2]));
-#else
+       #else
        CuAssertIntEquals(tc, false, is_separator(test[0]));
        CuAssertIntEquals(tc, true, is_separator(test[1]));
        CuAssertIntEquals(tc, false, is_separator(test[2]));
-#endif
+       #endif
 }
 #endif
 
 
 void add_trailing_sep(DString * path) {
-#if defined(__WIN32)
+       #if defined(__WIN32)
        char sep = '\\';
-#else
+       #else
        char sep = '/';
-#endif
+       #endif
 
        // Ensure that folder ends in separator
        if (!is_separator(path->str[path->currentStringLength - 1])) {
@@ -182,11 +182,11 @@ void Test_path_from_dir_base(CuTest* tc) {
 
        char * path = path_from_dir_base(dir, base);
 
-#if defined(__WIN32)
+       #if defined(__WIN32)
        CuAssertStrEquals(tc, "/foo\\bar", path);
-#else
+       #else
        CuAssertStrEquals(tc, "/foo/bar", path);
-#endif
+       #endif
 
        free(path);
        strcpy(base, "/bar");
@@ -209,11 +209,11 @@ void Test_path_from_dir_base(CuTest* tc) {
 void split_path_file(char ** dir, char ** file, const char * path) {
        const char * slash = path, * next;
 
-#if defined(__WIN32)
+       #if defined(__WIN32)
        const char sep[] = "\\/";       // Windows allows either variant
-#else
+       #else
        const char sep[] = "/";
-#endif
+       #endif
 
        while ((next = strpbrk(slash + 1, sep)))
                slash = next;
@@ -238,13 +238,13 @@ void Test_split_path_file(CuTest* tc) {
        path = "\\foo\\bar.txt";
        split_path_file(&dir, &file, path);
 
-#if defined(__WIN32)
+       #if defined(__WIN32)
        CuAssertStrEquals(tc, "\\foo\\", dir);
        CuAssertStrEquals(tc, "bar.txt", file);
-#else
+       #else
        CuAssertStrEquals(tc, "", dir);
        CuAssertStrEquals(tc, "\\foo\\bar.txt", file);
-#endif
+       #endif
 }
 #endif
 
@@ -258,15 +258,15 @@ DString * scan_file(const char * fname) {
 
        FILE * file;
 
-#if defined(__WIN32)
+       #if defined(__WIN32)
        int wchars_num = MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0);
        wchar_t wstr[wchars_num];
        MultiByteToWideChar(CP_UTF8, 0, fname, -1, wstr, wchars_num);
 
        if ((file = _wfopen(wstr, L"r")) == NULL) {
-#else
+       #else
        if ((file = fopen(fname, "r")) == NULL ) {
-#endif
+       #endif
 
                return NULL;
        }
index 80b6263ee0383a353076c71a86c77c051722be7e..73e26f323dde372b5cb74d7cae4296b69a50d047 100644 (file)
@@ -1051,11 +1051,11 @@ footnote * footnote_new(const char * source, token * label, token * content, boo
 void footnote_free(footnote * f) {
        if (f) {
                if (f->free_para) {
-#ifdef kUseObjectPool
+                       #ifdef kUseObjectPool
                        // Nothing to do here
-#else
+                       #else
                        free(f->content);
-#endif
+                       #endif
                }
                free(f->clean_text);
                free(f->label_text);
index ab11e0e6e0cfea02a1713518099e1d423fce8219..97b257e0b4196654024f04ed7a8aa781ada8e48e 100644 (file)
@@ -326,9 +326,9 @@ int main(int argc, char** argv) {
        char * output_filename;
 
        // Increment counter and prepare token pool
-#ifdef kUseObjectPool
+       #ifdef kUseObjectPool
        token_pool_init();
-#endif
+       #endif
 
        // Seed random numbers
        custom_seed_rand();
@@ -401,9 +401,9 @@ int main(int argc, char** argv) {
                        }
 
                        // Increment counter and prepare token pool
-#ifdef kUseObjectPool
+                       #ifdef kUseObjectPool
                        token_pool_init();
-#endif
+                       #endif
                        if (a_meta->count > 0) {
                                // List metadata keys
                                char_result = mmd_string_metadata_keys(buffer->str);
@@ -488,20 +488,20 @@ int main(int argc, char** argv) {
                        // Perform transclusion(s)
 
                        // Convert to absolute path for first file to enable proper path resolution
-#ifdef PATH_MAX
+                       #ifdef PATH_MAX
                        // If PATH_MAX defined, use it
                        char absolute[PATH_MAX + 1];
                        realpath(a_file->filename[0], absolute);
                        folder = dirname((char *) a_file->filename[0]);
 
                        mmd_transclude_source(buffer, folder, absolute, format, NULL, NULL);
-#else
+                       #else
                        // If undefined, then we *should* be able to use a NULL pointer to allocate
                        char * absolute = realpath(a_file->filename[0], NULL);
                        folder = dirname((char *) a_file->filename[0]);
                        mmd_transclude_source(buffer, folder, absolute, format, NULL, NULL);
                        free(absolute);
-#endif
+                       #endif
                        // Don't free folder -- owned by dirname
                }
 
@@ -578,9 +578,9 @@ exit:
        // Decrement counter and clean up token pool
        token_pool_drain();
 
-#ifdef kUseObjectPool
+       #ifdef kUseObjectPool
        token_pool_free();
-#endif
+       #endif
 
 exit2: