0
@@ -29,10 +29,10 @@ int yyparse(void);
0
***********************************************************************/
0
/* cons - cons an element onto a list, returning pointer to new head */
0
-static item *cons(element new, item *list) {
0
- item *head = malloc(sizeof(item));
0
+static element *cons(element new, element *list) {
0
+ element *head = malloc(sizeof(element));
0
@@ -44,35 +44,35 @@ static void pushelt(element new, element *lst) {
0
/* reverse - reverse a list, returning pointer to new list */
0
-static item *reverse(item *list) {
0
+static element *reverse(element *list) {
0
- new = cons((*list).val, new);
0
+ new = cons(*list, new);
0
-/* length_of_strings - returns sum of length of strings in an item list of STR elements */
0
-static int length_of_strings(item *list) {
0
+/* length_of_strings - returns sum of length of strings in a list of STR elements */
0
+static int length_of_strings(element *list) {
0
- assert((*list).val.key == STR);
0
- assert((*list).val.contents.str != NULL);
0
- len += strlen((*list).val.contents.str);
0
+ assert((*list).key == STR);
0
+ assert((*list).contents.str != NULL);
0
+ len += strlen((*list).contents.str);
0
/* concat_string_list - concatenates string contents of list of STR elements */
0
-static char *concat_string_list(item *list) {
0
+static char *concat_string_list(element *list) {
0
char *result = malloc(length_of_strings(list) + 2); /* leave room for optional \n and \0 */
0
- assert((*list).val.key == STR);
0
- assert((*list).val.contents.str != NULL);
0
- result = strcat(result, (*list).val.contents.str);
0
+ assert((*list).key == STR);
0
+ assert((*list).contents.str != NULL);
0
+ result = strcat(result, (*list).contents.str);
0
@@ -85,7 +85,7 @@ static char *concat_string_list(item *list) {
0
***********************************************************************/
0
static char *charbuf = ""; /* Buffer of characters to be parsed. */
0
-static item *references; /* List of link references found. */
0
+static element *references; /* List of link references found. */
0
static int output_format;
0
static element parse_result; /* Results of parse. */
0
static int syntax_extensions; /* Syntax extensions selected. */
0
@@ -118,7 +118,7 @@ static element mk_list(int key, element lst) {
0
/* mk_link - constructor for LINK element */
0
-static element mk_link(item *label, char *url, char *title) {
0
+static element mk_link(element *label, char *url, char *title) {
0
result.contents.link.label = label;
0
@@ -128,25 +128,25 @@ static element mk_link(item *label, char *url, char *title) {
0
/* match_inlines - returns true if inline lists match (case-insensitive...) */
0
-static bool match_inlines(item *l1, item *l2) {
0
+static bool match_inlines(element *l1, element *l2) {
0
while (l1 != NULL && l2 != NULL) {
0
- if ((*l1).val.key != (*l2).val.key)
0
+ if ((*l1).key != (*l2).key)
0
- switch ((*l1).val.key) {
0
- if (strcasecmp((*l1).val.contents.str, (*l2).val.contents.str) == 0)
0
+ if (strcasecmp((*l1).contents.str, (*l2).contents.str) == 0)
0
- if (match_inlines((*l1).val.contents.list, (*l2).val.contents.list))
0
+ if (match_inlines((*l1).contents.list, (*l2).contents.list))
0
@@ -154,7 +154,7 @@ static bool match_inlines(item *l1, item *l2) {
0
return false; /* No links or images within links */
0
- fprintf(stderr, "match_inlines encountered unknown key = %d\n", (*l1).val.key);
0
+ fprintf(stderr, "match_inlines encountered unknown key = %d\n", (*l1).key);
0
@@ -166,11 +166,11 @@ static bool match_inlines(item *l1, item *l2) {
0
/* find_reference - return true if link found in references matching label.
0
* 'link' is modified with the matching url and title. */
0
-static bool find_reference(link *result, item *label) {
0
- item *cur = references; /* pointer to walk up list of references */
0
+static bool find_reference(link *result, element *label) {
0
+ element *cur = references; /* pointer to walk up list of references */
0
- curitem = (*cur).val.contents.link;
0
+ curitem = (*cur).contents.link;
0
if (match_inlines(label, curitem.label)) {
0
@@ -293,7 +293,7 @@ BulletListLoose = a:StartList
0
( b:BulletListItem BlankLine*
0
{ char *bplus = malloc(strlen(b.contents.str) + 3);
0
strcpy(bplus, b.contents.str);
0
- strcat(bplus, "\n\n"); /* In loose list, \n\n added to end of each item */
0
+ strcat(bplus, "\n\n"); /* In loose list, \n\n added to end of each element */
Comments
No one has commented yet.