source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Update (still-commented) manual bits for tbl.
@ 2010-12-29 15:21 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-12-29 15:21 UTC (permalink / raw)
  To: source

Log Message:
-----------
Update (still-commented) manual bits for tbl.

Also removed lots of superfluous switch cases by using tolower() and
handling only the lowercase keys.

Modified Files:
--------------
    mdocml:
        roff.7
        tbl_layout.c

Revision Data
-------------
Index: roff.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.7,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lroff.7 -Lroff.7 -u -p -r1.18 -r1.19
--- roff.7
+++ roff.7
@@ -535,6 +535,11 @@ This request is intended to have one arg
 consisting of an even number of characters.
 Currently, it is ignored including its arguments,
 and the number of arguments is not checked.
+.\" .Ss \&T&
+.\" Re-start a table layout, retaining the options of the prior table
+.\" invocation.
+.\" See
+.\" .Sx \&TS .
 .\" .Ss \&TE
 .\" End a table context.
 .\" See
@@ -581,6 +586,81 @@ and the number of arguments is not check
 .\" .Pp
 .\" in the case of
 .\" .Xr man 7 .
+.\" .Pp
+.\" The first line of a table consists of its options, which consists of
+.\" space-separated keys and modifiers terminated by a semicolon.
+.\" If the first line does not have a terminating semicolon, it is assumed
+.\" that no options are specified and instead a layout is processed.
+.\" Some options accept arguments enclosed by paranthesis.
+.\" The following case-insensitive options are available:
+.\" .Bl -tag -width Ds
+.\" .It Cm center
+.\" This may also be invoked with
+.\" .Cm centre .
+.\" .It Cm delim
+.\" Accepts a two-character argument.
+.\" This option is ignored.
+.\" .It Cm expand
+.\" .It Cm box
+.\" This may also be invoked with
+.\" .Cm frame .
+.\" .It Cm doublebox
+.\" This may also be invoked with
+.\" .Cm doubleframe .
+.\" .It Cm allbox
+.\" .It Cm tab
+.\" Accepts a single character argument used as the delimiter for cells in
+.\" data rows.
+.\" .It Cm linesize
+.\" Accepts a natural number (all digits) used as the line width for drawing
+.\" boxes.
+.\" .It Cm nokeep
+.\" .It Cm decimalpoint
+.\" .It Cm nospaces
+.\" .El
+.\" .Pp
+.\" The table layout follows table options, except in the case of
+.\" .Sx \&T& ,
+.\" where it immediately procedes invocation.
+.\" Layout specifies how data rows are displayed on output.
+.\" Each layout line corresponds to a line of data; the last layout line
+.\" applies to all remaining data lines.
+.\" Layout lines may also be separated by a comma.
+.\" Each layout cell consists of one of the following case-insensitive keys:
+.\" .Bl -tag -width Ds
+.\" .It Cm c
+.\" .It Cm r
+.\" .It Cm l
+.\" .It Cm n
+.\" .It Cm s
+.\" .It Cm a
+.\" .It Cm ^
+.\" .It Cm \-
+.\" This may also be invoked with
+.\" .Cm _ .
+.\" .It Cm =
+.\" .It Cm \(ba
+.\" .It Cm \(ba\(ba
+.\" .El
+.\" Keys may be followed by a set of modifiers.
+.\" A modifier is either a modifier key or a natural number for specifying
+.\" spacing.
+.\" The following case-insensitive modifier keys are available:
+.\" .Bl -tag -width Ds
+.\" .It Cm z
+.\" .It Cm u
+.\" .It Cm e
+.\" .It Cm t
+.\" .It Cm d
+.\" .It Cm f
+.\" Must be followed by a case-insensitive font style:
+.\" .Cm b
+.\" for bold or
+.\" .Cm i
+.\" for italic.
+.\" .It Cm b
+.\" .It Cm i
+.\" .El
 .Sh COMPATIBILITY
 This section documents compatibility between mandoc and other other
 .Nm
@@ -612,6 +692,12 @@ using the next-line syntax.
 .Xr man 7 ,
 .Xr mandoc_char 7 ,
 .Xr mdoc 7
+.\" .Rs
+.\" .%A M. E. Lesk
+.\" .%T Tbl\(emA Program to Format Tables
+.\" .%D June 11, 1976
+.\" .%U http://www.kohala.com/start/troff/v7/man/tbl/tbl.ps
+.\" .Re
 .Rs
 .%A Joseph F. Ossanna
 .%A Brian W. Kernighan
Index: tbl_layout.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_layout.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ltbl_layout.c -Ltbl_layout.c -u -p -r1.1 -r1.2
--- tbl_layout.c
+++ tbl_layout.c
@@ -28,21 +28,15 @@ struct	tbl_phrase {
 	enum tbl_cellt	 key;
 };
 
-#define	KEYS_MAX	 17
+#define	KEYS_MAX	 11
 
 static	const struct tbl_phrase keys[KEYS_MAX] = {
 	{ 'c',		 TBL_CELL_CENTRE },
-	{ 'C',		 TBL_CELL_CENTRE },
 	{ 'r',		 TBL_CELL_RIGHT },
-	{ 'R',		 TBL_CELL_RIGHT },
 	{ 'l',		 TBL_CELL_LEFT },
-	{ 'L',		 TBL_CELL_LEFT },
 	{ 'n',		 TBL_CELL_NUMBER },
-	{ 'N',		 TBL_CELL_NUMBER },
 	{ 's',		 TBL_CELL_SPAN },
-	{ 'S',		 TBL_CELL_SPAN },
 	{ 'a',		 TBL_CELL_LONG },
-	{ 'A',		 TBL_CELL_LONG },
 	{ '^',		 TBL_CELL_DOWN },
 	{ '-',		 TBL_CELL_HORIZ },
 	{ '_',		 TBL_CELL_HORIZ },
@@ -111,56 +105,39 @@ mod:
 
 	/* TODO: GNU has many more extensions. */
 
-	switch (p[(*pos)++]) {
+	switch (tolower(p[(*pos)++])) {
 	case ('z'):
-		/* FALLTHROUGH */
-	case ('Z'):
 		cp->flags |= TBL_CELL_WIGN;
 		goto mod;
 	case ('u'):
-		/* FALLTHROUGH */
-	case ('U'):
 		cp->flags |= TBL_CELL_UP;
 		goto mod;
 	case ('e'):
-		/* FALLTHROUGH */
-	case ('E'):
 		cp->flags |= TBL_CELL_EQUAL;
 		goto mod;
 	case ('t'):
-		/* FALLTHROUGH */
-	case ('T'):
 		cp->flags |= TBL_CELL_TALIGN;
 		goto mod;
 	case ('d'):
-		/* FALLTHROUGH */
-	case ('D'):
 		cp->flags |= TBL_CELL_BALIGN;
 		goto mod;
 	case ('f'):
-		/* FALLTHROUGH */
-	case ('B'):
-		/* FALLTHROUGH */
-	case ('I'):
-		/* FALLTHROUGH */
+		break;
 	case ('b'):
 		/* FALLTHROUGH */
 	case ('i'):
+		(*pos)--;
 		break;
 	default:
 		TBL_MSG(tbl, MANDOCERR_TBLLAYOUT, ln, *pos - 1);
 		return(0);
 	}
 
-	switch (p[(*pos)++]) {
+	switch (tolower(p[(*pos)++])) {
 	case ('b'):
-		/* FALLTHROUGH */
-	case ('B'):
 		cp->flags |= TBL_CELL_BOLD;
 		goto mod;
 	case ('i'):
-		/* FALLTHROUGH */
-	case ('I'):
 		cp->flags |= TBL_CELL_ITALIC;
 		goto mod;
 	default:
@@ -182,7 +159,7 @@ cell(struct tbl *tbl, struct tbl_row *rp
 	/* Parse the column position (`r', `R', `|', ...). */
 
 	for (i = 0; i < KEYS_MAX; i++)
-		if (p[*pos] == keys[i].name)
+		if (tolower(p[*pos]) == keys[i].name)
 			break;
 
 	if (KEYS_MAX == i) {
--
 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-12-29 15:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-29 15:21 mdocml: Update (still-commented) manual bits for tbl 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).