source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Switch on cached -width usage in front-ends.
Date: Sun, 13 Jun 2010 17:41:58 -0400 (EDT)	[thread overview]
Message-ID: <201006132141.o5DLfwF8030967@krisdoz.my.domain> (raw)

Log Message:
-----------
Switch on cached -width usage in front-ends.

Modified Files:
--------------
    mdocml:
        mdoc_html.c
        mdoc_term.c

Revision Data
-------------
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.83 -r1.84
--- mdoc_html.c
+++ mdoc_html.c
@@ -1058,14 +1058,14 @@ mdoc_it_pre(MDOC_ARGS)
 		break;
 	}
 
+	if (bl->data.Bl.width)
+		a2width(bl->data.Bl.width, &width);
+
 	wp = -1;
 	for (i = 0; bl->args && i < (int)bl->args->argc; i++) 
 		switch (bl->args->argv[i].arg) {
 		case (MDOC_Column):
 			wp = i; /* Save for later. */
-			break;
-		case (MDOC_Width):
-			a2width(bl->args->argv[i].value[0], &width);
 			break;
 		default:
 			break;
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.153 -r1.154
--- mdoc_term.c
+++ mdoc_term.c
@@ -52,7 +52,7 @@ struct	termact {
 	void	(*post)(DECL_ARGS);
 };
 
-static	size_t	  a2width(const struct mdoc_argv *, int);
+static	size_t	  a2width(const char *);
 static	size_t	  a2height(const struct mdoc_node *);
 static	size_t	  a2offs(const char *);
 
@@ -476,13 +476,13 @@ a2height(const struct mdoc_node *n)
 
 
 static size_t
-a2width(const struct mdoc_argv *arg, int pos)
+a2width(const char *v)
 {
 	struct roffsu	 su;
 
-	assert(arg->value[pos]);
-	if ( ! a2roffsu(arg->value[pos], &su, SCALE_MAX))
-		SCALE_HS_INIT(&su, strlen(arg->value[pos]));
+	assert(v);
+	if ( ! a2roffsu(v, &su, SCALE_MAX))
+		SCALE_HS_INIT(&su, strlen(v));
 
 	return(term_hspan(&su));
 }
@@ -703,7 +703,7 @@ termp_it_pre(DECL_ARGS)
 				nn->prev && i < (int)ncols; 
 				nn = nn->prev, i++)
 			offset += dcol + a2width
-				(&bl->args->argv[vals[1]], i);
+				(bl->args->argv[vals[1]].value[i]);
 
 
 		/*
@@ -719,10 +719,11 @@ termp_it_pre(DECL_ARGS)
 		 * Use the declared column widths, extended as explained
 		 * in the preceding paragraph.
 		 */
-		width = a2width(&bl->args->argv[vals[1]], i) + dcol;
+		width = a2width
+			(bl->args->argv[vals[1]].value[i]) + dcol;
 		break;
 	default:
-		if (vals[0] < 0) 
+		if (NULL == bl->data.Bl.width)
 			break;
 
 		/* 
@@ -730,8 +731,8 @@ termp_it_pre(DECL_ARGS)
 		 * number for buffering single arguments.  See the above
 		 * handling for column for how this changes.
 		 */
-		width = a2width(&bl->args->argv[vals[0]], 0) + 2;
 		assert(bl->data.Bl.width);
+		width = a2width(bl->data.Bl.width) + 2;
 		break;
 	}
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2010-06-13 21:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201006132141.o5DLfwF8030967@krisdoz.my.domain \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).