diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-29 15:21:34 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-29 15:21:34 +0000 |
commit | 52d5f31a5876e53d9864f7b2cba00cd9dbeca047 (patch) | |
tree | a1f1c0ab93070573b225bbd49c73876e69b512b4 /tbl_layout.c | |
parent | 8e25f248df0dc1385f91b1da975e220bd25e4c34 (diff) | |
download | mandoc-52d5f31a5876e53d9864f7b2cba00cd9dbeca047.tar.gz |
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.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/tbl_layout.c b/tbl_layout.c index 004b3337..6262fafe 100644 --- a/tbl_layout.c +++ b/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) { |