diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-29 14:53:31 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-29 14:53:31 +0000 |
commit | 8e25f248df0dc1385f91b1da975e220bd25e4c34 (patch) | |
tree | 2c2f9a601f450969482355c97ce7d698615fc0f2 | |
parent | 9864cb8baea0db37f74a5bca120318017b215c1f (diff) | |
download | mandoc-8e25f248df0dc1385f91b1da975e220bd25e4c34.tar.gz |
Add handling for `T&', which restarts a table except for its options.
-rw-r--r-- | libroff.h | 1 | ||||
-rw-r--r-- | roff.c | 16 | ||||
-rw-r--r-- | tbl.c | 8 |
3 files changed, 25 insertions, 0 deletions
@@ -84,6 +84,7 @@ struct tbl { (*(tblp)->msg)((type), (tblp)->data, (line), (col), NULL) struct tbl *tbl_alloc(void *, mandocmsg); +void tbl_restart(struct tbl *); void tbl_free(struct tbl *); void tbl_reset(struct tbl *); enum rofferr tbl_read(struct tbl *, int, const char *, int); @@ -59,6 +59,7 @@ enum rofft { ROFF_tr, ROFF_TS, ROFF_TE, + ROFF_T_, ROFF_cblock, ROFF_ccond, /* FIXME: remove this. */ ROFF_USERDEF, @@ -143,6 +144,7 @@ static void roff_setstr(struct roff *, static enum rofferr roff_so(ROFF_ARGS); static enum rofferr roff_TE(ROFF_ARGS); static enum rofferr roff_TS(ROFF_ARGS); +static enum rofferr roff_T_(ROFF_ARGS); static enum rofferr roff_userdef(ROFF_ARGS); /* See roff_hash_find() */ @@ -175,6 +177,7 @@ static struct roffmac roffs[ROFF_MAX] = { { "tr", roff_line_ignore, NULL, NULL, 0, NULL }, { "TS", roff_TS, NULL, NULL, 0, NULL }, { "TE", roff_TE, NULL, NULL, 0, NULL }, + { "T&", roff_T_, NULL, NULL, 0, NULL }, { ".", roff_cblock, NULL, NULL, 0, NULL }, { "\\}", roff_ccond, NULL, NULL, 0, NULL }, { NULL, roff_userdef, NULL, NULL, 0, NULL }, @@ -1123,6 +1126,19 @@ roff_TE(ROFF_ARGS) /* ARGSUSED */ static enum rofferr +roff_T_(ROFF_ARGS) +{ + + if (NULL == r->tbl) + (*r->msg)(MANDOCERR_NOSCOPE, r->data, ln, ppos, NULL); + else + tbl_restart(r->tbl); + + return(ROFF_IGN); +} + +/* ARGSUSED */ +static enum rofferr roff_TS(ROFF_ARGS) { @@ -120,3 +120,11 @@ tbl_reset(struct tbl *tbl) tbl_init(tbl); } +void +tbl_restart(struct tbl *tbl) +{ + + tbl_clear(tbl); + tbl->part = TBL_PART_LAYOUT; +} + |