use typedef structs that are compatible with both c and c++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
diff --git a/md4c/md4c.h b/md4c/md4c.h
index 080be38..ec173e5 100644
--- a/md4c/md4c.h
+++ b/md4c/md4c.h
@@ -54,8 +54,7 @@ typedef unsigned MD_OFFSET;
/* Block represents a part of document hierarchy structure like a paragraph
* or list item. */
-typedef enum MD_BLOCKTYPE_tag MD_BLOCKTYPE;
-enum MD_BLOCKTYPE_tag {
+typedef enum MD_BLOCKTYPE {
/* <body>...</body> */
MD_BLOCK_DOC = 0,
@@ -102,13 +101,12 @@ enum MD_BLOCKTYPE_tag {
MD_BLOCK_TR,
MD_BLOCK_TH,
MD_BLOCK_TD
-};
+} MD_BLOCKTYPE;
/* Span represents an in-line piece of a document which should be rendered with
* the same font, color and other attributes. A sequence of spans forms a block
* like paragraph or list item. */
-typedef enum MD_SPANTYPE_tag MD_SPANTYPE;
-enum MD_SPANTYPE_tag {
+typedef enum MD_SPANTYPE {
/* <em>...</em> */
MD_SPAN_EM,
@@ -129,11 +127,10 @@ enum MD_SPANTYPE_tag {
/* <code>...</code> */
MD_SPAN_CODE
-};
+} MD_SPANTYPE;
/* Text is the actual textual contents of span. */
-typedef enum MD_TEXTTYPE_tag MD_TEXTTYPE;
-enum MD_TEXTTYPE_tag {
+typedef enum MD_TEXTTYPE {
/* Normal text. */
MD_TEXT_NORMAL = 0,
@@ -169,17 +166,16 @@ enum MD_TEXTTYPE_tag {
* an inline raw HTML), then MD_TEXT_BR and MD_TEXT_SOFTBR are not used.
* The text contains verbatim '\n' for the new lines. */
MD_TEXT_HTML
-};
+} MD_TEXTTYPE;
/* Alignment enumeration. */
-typedef enum MD_ALIGN_tag MD_ALIGN;
-enum MD_ALIGN_tag {
+typedef enum MD_ALIGN {
MD_ALIGN_DEFAULT = 0, /* When unspecified. */
MD_ALIGN_LEFT,
MD_ALIGN_CENTER,
MD_ALIGN_RIGHT
-};
+} MD_ALIGN;
/* String attribute.
@@ -202,62 +198,54 @@ enum MD_ALIGN_tag {
* -- substr_offsets[LAST+1] == size
* -- Only MD_TEXT_NORMAL and MD_TEXT_ENTITY substrings can appear.
*/
-typedef struct MD_ATTRIBUTE_tag MD_ATTRIBUTE;
-struct MD_ATTRIBUTE_tag {
+typedef struct MD_ATTRIBUTE {
const MD_CHAR* text;
MD_SIZE size;
const MD_TEXTTYPE* substr_types;
const MD_OFFSET* substr_offsets;
-};
+} MD_ATTRIBUTE;
/* Detailed info for MD_BLOCK_UL_DETAIL. */
-typedef struct MD_BLOCK_UL_DETAIL_tag MD_BLOCK_UL_DETAIL;
-struct MD_BLOCK_UL_DETAIL_tag {
+typedef struct MD_BLOCK_UL_DETAIL {
int is_tight; /* Non-zero if tight list, zero of loose. */
MD_CHAR mark; /* Item bullet character in MarkDown source of the list, e.g. '-', '+', '*'. */
-};
+} MD_BLOCK_UL_DETAIL;
/* Detailed info for MD_BLOCK_OL_DETAIL. */
-typedef struct MD_BLOCK_OL_DETAIL_tag MD_BLOCK_OL_DETAIL;
-struct MD_BLOCK_OL_DETAIL_tag {
+typedef struct MD_BLOCK_OL_DETAIL {
unsigned start; /* Start index of the ordered list. */
int is_tight; /* Non-zero if tight list, zero of loose. */
MD_CHAR mark_delimiter; /* Character delimiting the item marks in MarkDown source, e.g. '.' or ')' */
-};
+} MD_BLOCK_OL_DETAIL;
/* Detailed info for MD_BLOCK_H. */
-typedef struct MD_BLOCK_H_DETAIL_tag MD_BLOCK_H_DETAIL;
-struct MD_BLOCK_H_DETAIL_tag {
+typedef struct MD_BLOCK_H_DETAIL {
unsigned level; /* Header level (1 - 6) */
-};
+} MD_BLOCK_H_DETAIL;
/* Detailed info for MD_BLOCK_CODE. */
-typedef struct MD_BLOCK_CODE_DETAIL_tag MD_BLOCK_CODE_DETAIL;
-struct MD_BLOCK_CODE_DETAIL_tag {
+typedef struct MD_BLOCK_CODE_DETAIL {
MD_ATTRIBUTE info;
MD_ATTRIBUTE lang;
-};
+} MD_BLOCK_CODE_DETAIL;
/* Detailed info for MD_BLOCK_TH and MD_BLOCK_TD. */
-typedef struct MD_BLOCK_TD_DETAIL_tag MD_BLOCK_TD_DETAIL;
-struct MD_BLOCK_TD_DETAIL_tag {
+typedef struct MD_BLOCK_TD_DETAIL {
MD_ALIGN align;
-};
+} MD_BLOCK_TD_DETAIL;
/* Detailed info for MD_SPAN_A. */
-typedef struct MD_SPAN_A_DETAIL_tag MD_SPAN_A_DETAIL;
-struct MD_SPAN_A_DETAIL_tag {
+typedef struct MD_SPAN_A_DETAIL {
MD_ATTRIBUTE href;
MD_ATTRIBUTE title;
-};
+} MD_SPAN_A_DETAIL;
/* Detailed info for MD_SPAN_IMG. */
-typedef struct MD_SPAN_IMG_DETAIL_tag MD_SPAN_IMG_DETAIL;
-struct MD_SPAN_IMG_DETAIL_tag {
+typedef struct MD_SPAN_IMG_DETAIL {
MD_ATTRIBUTE src;
MD_ATTRIBUTE title;
-};
+} MD_SPAN_IMG_DETAIL;
/* Flags specifying extensions/deviations from CommonMark specification.
@@ -286,8 +274,7 @@ struct MD_SPAN_IMG_DETAIL_tag {
/* Renderer structure.
*/
-typedef struct MD_RENDERER_tag MD_RENDERER;
-struct MD_RENDERER_tag {
+typedef struct MD_RENDERER {
/* Caller-provided rendering callbacks.
*
* For some block/span types, more detailed information is provided in a
@@ -322,7 +309,7 @@ struct MD_RENDERER_tag {
/* Dialect options. Bitmask of MD_FLAG_xxxx values.
*/
unsigned flags;
-};
+} MD_RENDERER;
/* Parse the Markdown document stored in the string 'text' of size 'size'.