From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 53d0f149; for ; Wed, 28 Jan 2015 10:04:15 -0500 (EST) Date: Wed, 28 Jan 2015 10:04:15 -0500 (EST) Message-Id: <10195831924996839069.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: For now, it can't be helped that mandoc tbl(7) ignores X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- For now, it can't be helped that mandoc tbl(7) ignores high-level macros, but stop throwing away their arguments. This fixes information loss in a handful of Xenocara manuals, at the price of a small amount of formatting noise creeping through. Modified Files: -------------- mdocml: libroff.h roff.c tbl.c tbl_data.c tbl_layout.c tbl_opts.c Revision Data ------------- Index: tbl_layout.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/tbl_layout.c,v retrieving revision 1.33 retrieving revision 1.34 diff -Ltbl_layout.c -Ltbl_layout.c -u -p -r1.33 -r1.34 --- tbl_layout.c +++ tbl_layout.c @@ -234,14 +234,11 @@ again: } void -tbl_layout(struct tbl_node *tbl, int ln, const char *p) +tbl_layout(struct tbl_node *tbl, int ln, const char *p, int pos) { struct tbl_row *rp; - int pos; - pos = 0; rp = NULL; - for (;;) { /* Skip whitespace before and after each cell. */ Index: tbl_opts.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/tbl_opts.c,v retrieving revision 1.18 retrieving revision 1.19 diff -Ltbl_opts.c -Ltbl_opts.c -u -p -r1.18 -r1.19 --- tbl_opts.c +++ tbl_opts.c @@ -120,17 +120,19 @@ arg(struct tbl_node *tbl, int ln, const * and some options are followed by arguments. */ void -tbl_option(struct tbl_node *tbl, int ln, const char *p) +tbl_option(struct tbl_node *tbl, int ln, const char *p, int *offs) { int i, pos, len; - pos = 0; + pos = *offs; for (;;) { while (p[pos] == ' ' || p[pos] == '\t' || p[pos] == ',') pos++; - if (p[pos] == ';') + if (p[pos] == ';') { + *offs = pos + 1; return; + } /* Parse one option name. */ Index: tbl_data.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/tbl_data.c,v retrieving revision 1.34 retrieving revision 1.35 diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.34 -r1.35 --- tbl_data.c +++ tbl_data.c @@ -138,13 +138,10 @@ getdata(struct tbl_node *tbl, struct tbl } int -tbl_cdata(struct tbl_node *tbl, int ln, const char *p) +tbl_cdata(struct tbl_node *tbl, int ln, const char *p, int pos) { struct tbl_dat *dat; size_t sz; - int pos; - - pos = 0; dat = tbl->last_span->last; @@ -204,11 +201,10 @@ newspan(struct tbl_node *tbl, int line, } void -tbl_data(struct tbl_node *tbl, int ln, const char *p) +tbl_data(struct tbl_node *tbl, int ln, const char *p, int pos) { struct tbl_span *dp; struct tbl_row *rp; - int pos; /* * Choose a layout row: take the one following the last parsed @@ -259,7 +255,6 @@ tbl_data(struct tbl_node *tbl, int ln, c dp->pos = TBL_SPAN_DATA; - pos = 0; while ('\0' != p[pos]) getdata(tbl, dp, ln, p, &pos); } Index: tbl.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/tbl.c,v retrieving revision 1.34 retrieving revision 1.35 diff -Ltbl.c -Ltbl.c -u -p -r1.34 -r1.35 --- tbl.c +++ tbl.c @@ -32,7 +32,7 @@ enum rofferr -tbl_read(struct tbl_node *tbl, int ln, const char *p, int offs) +tbl_read(struct tbl_node *tbl, int ln, const char *p, int pos) { const char *cp; int active; @@ -46,7 +46,7 @@ tbl_read(struct tbl_node *tbl, int ln, c if (tbl->part == TBL_PART_OPTS) { tbl->part = TBL_PART_LAYOUT; active = 1; - for (cp = p; *cp != '\0'; cp++) { + for (cp = p + pos; *cp != '\0'; cp++) { switch (*cp) { case '(': active = 0; @@ -64,8 +64,8 @@ tbl_read(struct tbl_node *tbl, int ln, c break; } if (*cp == ';') { - tbl_option(tbl, ln, p); - if (*(p = cp + 1) == '\0') + tbl_option(tbl, ln, p, &pos); + if (p[pos] == '\0') return(ROFF_IGN); } } @@ -74,15 +74,15 @@ tbl_read(struct tbl_node *tbl, int ln, c switch (tbl->part) { case TBL_PART_LAYOUT: - tbl_layout(tbl, ln, p); + tbl_layout(tbl, ln, p, pos); return(ROFF_IGN); case TBL_PART_CDATA: - return(tbl_cdata(tbl, ln, p) ? ROFF_TBL : ROFF_IGN); + return(tbl_cdata(tbl, ln, p, pos) ? ROFF_TBL : ROFF_IGN); default: break; } - tbl_data(tbl, ln, p); + tbl_data(tbl, ln, p, pos); return(ROFF_TBL); } Index: roff.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/roff.c,v retrieving revision 1.256 retrieving revision 1.257 diff -Lroff.c -Lroff.c -u -p -r1.256 -r1.257 --- roff.c +++ roff.c @@ -1237,7 +1237,13 @@ roff_parseln(struct roff *r, int ln, str if (r->tbl != NULL && (t == ROFF_MAX || t == ROFF_TS)) { mandoc_msg(MANDOCERR_TBLMACRO, r->parse, ln, pos, buf->buf + spos); - return(ROFF_IGN); + if (t == ROFF_TS) + return(ROFF_IGN); + while (buf->buf[pos] != '\0' && buf->buf[pos] != ' ') + pos++; + while (buf->buf[pos] != '\0' && buf->buf[pos] == ' ') + pos++; + return(tbl_read(r->tbl, ln, buf->buf, pos)); } /* Index: libroff.h =================================================================== RCS file: /home/cvs/mdocml/mdocml/libroff.h,v retrieving revision 1.35 retrieving revision 1.36 diff -Llibroff.h -Llibroff.h -u -p -r1.35 -r1.36 --- libroff.h +++ libroff.h @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2014 Ingo Schwarze + * Copyright (c) 2014, 2015 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -69,10 +69,10 @@ void tbl_restart(int, int, struct tbl_ void tbl_free(struct tbl_node *); void tbl_reset(struct tbl_node *); enum rofferr tbl_read(struct tbl_node *, int, const char *, int); -void tbl_option(struct tbl_node *, int, const char *); -void tbl_layout(struct tbl_node *, int, const char *); -void tbl_data(struct tbl_node *, int, const char *); -int tbl_cdata(struct tbl_node *, int, const char *); +void tbl_option(struct tbl_node *, int, const char *, int *); +void tbl_layout(struct tbl_node *, int, const char *, int); +void tbl_data(struct tbl_node *, int, const char *, int); +int tbl_cdata(struct tbl_node *, int, const char *, int); const struct tbl_span *tbl_span(struct tbl_node *); void tbl_end(struct tbl_node **); struct eqn_node *eqn_alloc(int, int, struct mparse *); -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv