source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: `Bl' is now using a struct instead of a single enum mdoc_list
@ 2010-06-12 11:58 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-06-12 11:58 UTC (permalink / raw)
  To: source

Log Message:
-----------
`Bl' is now using a struct instead of a single enum mdoc_list for its
cached values.  You can probably guess where this is going.

Modified Files:
--------------
    mdocml:
        mdoc.c
        mdoc.h
        mdoc_argv.c
        mdoc_html.c
        mdoc_term.c
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.95 -r1.96
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -539,8 +539,9 @@ pre_bl(PRE_ARGS)
 		assert(n->parent);
 		assert(MDOC_BLOCK == n->parent->type);
 		assert(MDOC_Bl == n->parent->tok);
-		assert(LIST__NONE != n->parent->data.list);
-		n->data.list = n->parent->data.list;
+		assert(LIST__NONE != n->parent->data.Bl.type);
+		memcpy(&n->data.Bl, &n->parent->data.Bl,
+				sizeof(struct mdoc_bl));
 		return(1);
 	}
 
@@ -550,7 +551,7 @@ pre_bl(PRE_ARGS)
 	 * ones.  If we find no list type, we default to LIST_item.
 	 */
 
-	assert(LIST__NONE == n->data.list);
+	assert(LIST__NONE == n->data.Bl.type);
 	offs = width = cmpt = -1;
 
 	/* LINTED */
@@ -618,18 +619,18 @@ pre_bl(PRE_ARGS)
 
 		/* Check: multiple list types. */
 
-		if (LIST__NONE != lt && n->data.list != LIST__NONE)
+		if (LIST__NONE != lt && n->data.Bl.type != LIST__NONE)
 			if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTREP))
 				return(0);
 
 		/* Assign list type. */
 
-		if (LIST__NONE != lt && n->data.list == LIST__NONE)
-			n->data.list = lt;
+		if (LIST__NONE != lt && n->data.Bl.type == LIST__NONE)
+			n->data.Bl.type = lt;
 
 		/* The list type should come first. */
 
-		if (n->data.list == LIST__NONE)
+		if (n->data.Bl.type == LIST__NONE)
 			if (width >= 0 || offs >= 0 || cmpt >= 0)
 				if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))
 					return(0);
@@ -639,10 +640,10 @@ pre_bl(PRE_ARGS)
 
 	/* Allow lists to default to LIST_item. */
 
-	if (LIST__NONE == n->data.list) {
+	if (LIST__NONE == n->data.Bl.type) {
 		if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTTYPE))
 			return(0);
-		n->data.list = LIST_item;
+		n->data.Bl.type = LIST_item;
 	}
 
 	/* 
@@ -651,7 +652,7 @@ pre_bl(PRE_ARGS)
 	 * and must also be warned.
 	 */
 
-	switch (n->data.list) {
+	switch (n->data.Bl.type) {
 	case (LIST_tag):
 		if (width >= 0)
 			break;
@@ -1031,7 +1032,7 @@ post_it(POST_ARGS)
 		return(1);
 
 	n = mdoc->last->parent->parent;
-	lt = n->data.list;
+	lt = n->data.Bl.type;
 
 	if (LIST__NONE == lt) {
 		mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_LISTTYPE);
@@ -1123,7 +1124,7 @@ post_bl_head(POST_ARGS) 
 	assert(mdoc->last->parent);
 	n = mdoc->last->parent;
 
-	if (LIST_column == n->data.list) {
+	if (LIST_column == n->data.Bl.type) {
 		for (i = 0; i < (int)n->args->argc; i++)
 			if (MDOC_Column == n->args->argv[i].arg)
 				break;
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.80 -r1.81
--- mdoc_html.c
+++ mdoc_html.c
@@ -1035,7 +1035,7 @@ mdoc_it_pre(MDOC_ARGS)
 	if (MDOC_BLOCK != n->type)
 		bl = bl->parent;
 
-	type = bl->data.list;
+	type = bl->data.Bl.type;
 
 	/* Set default width and offset. */
 
@@ -1123,7 +1123,7 @@ mdoc_bl_pre(MDOC_ARGS)
 		return(0);
 	if (MDOC_BLOCK != n->type)
 		return(1);
-	if (LIST_enum != n->data.list)
+	if (LIST_enum != n->data.Bl.type)
 		return(1);
 
 	ord = malloc(sizeof(struct ord));
@@ -1147,7 +1147,7 @@ mdoc_bl_post(MDOC_ARGS)
 
 	if (MDOC_BLOCK != n->type)
 		return;
-	if (LIST_enum != n->data.list)
+	if (LIST_enum != n->data.Bl.type)
 		return;
 
 	ord = h->ords.head;
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.148 -r1.149
--- mdoc_term.c
+++ mdoc_term.c
@@ -570,6 +570,7 @@ print_bvspace(struct termp *p, 
 {
 	const struct mdoc_node	*nn;
 
+	/* FIXME: MDOC_Bd == bl->tok && bl->data.Bd.comp */
 	term_newln(p);
 	if (arg_hasattr(MDOC_Compact, bl))
 		return;
@@ -590,13 +591,13 @@ print_bvspace(struct termp *p, 
 
 	/* A `-column' does not assert vspace within the list. */
 
-	if (MDOC_Bl == bl->tok && LIST_column == bl->data.list)
+	if (MDOC_Bl == bl->tok && LIST_column == bl->data.Bl.type)
 		if (n->prev && MDOC_It == n->prev->tok)
 			return;
 
 	/* A `-diag' without body does not vspace. */
 
-	if (MDOC_Bl == bl->tok && LIST_diag == bl->data.list)
+	if (MDOC_Bl == bl->tok && LIST_diag == bl->data.Bl.type)
 		if (n->prev && MDOC_It == n->prev->tok) {
 			assert(n->prev->body);
 			if (NULL == n->prev->body->child)
@@ -661,7 +662,7 @@ termp_it_pre(DECL_ARGS)
 
 	arg_getattrs(keys, vals, 3, bl);
 
-	type = bl->data.list;
+	type = bl->data.Bl.type;
 
 	/* 
 	 * First calculate width and offset.  This is pretty easy unless
@@ -989,7 +990,7 @@ termp_it_post(DECL_ARGS)
 	if (MDOC_BLOCK == n->type)
 		return;
 
-	type = n->parent->parent->parent->data.list;
+	type = n->parent->parent->parent->data.Bl.type;
 
 	switch (type) {
 	case (LIST_item):
Index: mdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -Lmdoc.h -Lmdoc.h -u -p -r1.85 -r1.86
--- mdoc.h
+++ mdoc.h
@@ -278,6 +278,10 @@ struct	mdoc_bd {
 	int		  comp;
 };
 
+struct	mdoc_bl {
+	enum mdoc_list	  type;
+};
+
 /* Node in AST. */
 struct	mdoc_node {
 	struct mdoc_node *parent; /* parent AST node */
@@ -305,7 +309,7 @@ struct	mdoc_node {
 	char		 *string;	/* TEXT */
 
 	union {
-		enum mdoc_list list; /* `Bl' nodes */
+		struct mdoc_bl Bl;
 		struct mdoc_bd Bd;
 	} data;
 };
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -Lmdoc.c -Lmdoc.c -u -p -r1.145 -r1.146
--- mdoc.c
+++ mdoc.c
@@ -568,7 +568,7 @@ mdoc_ptext(struct mdoc *m, int line, cha
 	 */
 
 	if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&
-			LIST_column == n->data.list) {
+			LIST_column == n->data.Bl.type) {
 		/* `Bl' is open without any children. */
 		m->flags |= MDOC_FREECOL;
 		return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));
@@ -577,7 +577,7 @@ mdoc_ptext(struct mdoc *m, int line, cha
 	if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
 			NULL != n->parent &&
 			MDOC_Bl == n->parent->tok &&
-			LIST_column == n->parent->data.list) {
+			LIST_column == n->parent->data.Bl.type) {
 		/* `Bl' has block-level `It' children. */
 		m->flags |= MDOC_FREECOL;
 		return(mdoc_macro(m, MDOC_It, line, offs, &offs, buf));
@@ -783,7 +783,7 @@ mdoc_pmacro(struct mdoc *m, int ln, char
 	 */
 
 	if (MDOC_Bl == n->tok && MDOC_BODY == n->type &&
-			LIST_column == n->data.list) {
+			LIST_column == n->data.Bl.type) {
 		m->flags |= MDOC_FREECOL;
 		if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf)) 
 			goto err;
@@ -799,7 +799,7 @@ mdoc_pmacro(struct mdoc *m, int ln, char
 	if (MDOC_It == n->tok && MDOC_BLOCK == n->type &&
 			NULL != n->parent &&
 			MDOC_Bl == n->parent->tok &&
-			LIST_column == n->parent->data.list) {
+			LIST_column == n->parent->data.Bl.type) {
 		m->flags |= MDOC_FREECOL;
 		if ( ! mdoc_macro(m, MDOC_It, ln, sv, &sv, buf)) 
 			goto err;
Index: mdoc_argv.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_argv.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -Lmdoc_argv.c -Lmdoc_argv.c -u -p -r1.52 -r1.53
--- mdoc_argv.c
+++ mdoc_argv.c
@@ -359,7 +359,7 @@ mdoc_args(struct mdoc *m, int line, int 
 		if (MDOC_Bl == n->tok)
 			break;
 
-	if (n && LIST_column == n->data.list) {
+	if (n && LIST_column == n->data.Bl.type) {
 		fl |= ARGS_TABSEP;
 		fl &= ~ARGS_DELIM;
 	}
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-12 11:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-12 11:58 mdocml: `Bl' is now using a struct instead of a single enum mdoc_list kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).