aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl_layout.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-29 15:21:34 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-29 15:21:34 +0000
commit49a42ed31bc096bbf4d171de778bb39f1d883e8c (patch)
treec2e03e66ac73c7286d28f487e6f30491044cce52 /tbl_layout.c
parented9a4d16c1a2d80761d345659efdc86d2c919b82 (diff)
downloadmandoc-49a42ed31bc096bbf4d171de778bb39f1d883e8c.tar.gz
mandoc-49a42ed31bc096bbf4d171de778bb39f1d883e8c.tar.zst
mandoc-49a42ed31bc096bbf4d171de778bb39f1d883e8c.zip
Update (still-commented) manual bits for tbl.
Also removed lots of superfluous switch cases by using tolower() and handling only the lowercase keys.
Diffstat (limited to 'tbl_layout.c')
-rw-r--r--tbl_layout.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/tbl_layout.c b/tbl_layout.c
index 477a677a..a2be7e4b 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_layout.c,v 1.1 2010/12/29 14:38:14 kristaps Exp $ */
+/* $Id: tbl_layout.c,v 1.2 2010/12/29 15:21:34 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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) {