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 9d25bbd0; for ; Wed, 25 Feb 2015 09:49:44 -0500 (EST) Date: Wed, 25 Feb 2015 09:49:44 -0500 (EST) Message-Id: <13318979973654234576.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: texi2mdoc: Have line and column number reporting not be affected by the X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Have line and column number reporting not be affected by the splice. Modified Files: -------------- texi2mdoc: extern.h util.c version_0_1_2.xml Revision Data ------------- Index: util.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/util.c,v retrieving revision 1.14 retrieving revision 1.15 diff -Lutil.c -Lutil.c -u -p -r1.14 -r1.15 --- util.c +++ util.c @@ -122,12 +122,19 @@ texiabort(struct texi *p, const char *er void texiwarn(const struct texi *p, const char *fmt, ...) { - va_list ap; + va_list ap; + const struct texifile *f; + + f = &p->files[p->filepos - 1]; + + if (f->insplice) + fprintf(stderr, "%s:%zu:%zu (%zuB left in splice): " + "warning: ", f->name, f->line + 1, + f->col + 1, f->insplice); + else + fprintf(stderr, "%s:%zu:%zu: warning: ", + f->name, f->line + 1, f->col + 1); - fprintf(stderr, "%s:%zu:%zu: warning: ", - p->files[p->filepos - 1].name, - p->files[p->filepos - 1].line + 1, - p->files[p->filepos - 1].col + 1); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); @@ -141,12 +148,19 @@ texiwarn(const struct texi *p, const cha void texierr(struct texi *p, const char *fmt, ...) { - va_list ap; + va_list ap; + struct texifile *f; + + f = &p->files[p->filepos - 1]; + + if (f->insplice) + fprintf(stderr, "%s:%zu:%zu: (%zuB left in splice): " + "error: ", f->name, f->line + 1, + f->col + 1, f->insplice); + else + fprintf(stderr, "%s:%zu:%zu: error: ", + f->name, f->line + 1, f->col + 1); - fprintf(stderr, "%s:%zu:%zu: error: ", - p->files[p->filepos - 1].name, - p->files[p->filepos - 1].line + 1, - p->files[p->filepos - 1].col + 1); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); @@ -306,12 +320,18 @@ texivspace(struct texi *p) void advance(struct texi *p, size_t *pos) { + struct texifile *f; - if ('\n' == BUF(p)[*pos]) { - p->files[p->filepos - 1].line++; - p->files[p->filepos - 1].col = 0; + f = &p->files[p->filepos - 1]; + + if (0 == f->insplice) { + if ('\n' == BUF(p)[*pos]) { + f->line++; + f->col = 0; + } else + f->col++; } else - p->files[p->filepos - 1].col++; + --f->insplice; (*pos)++; } @@ -871,6 +891,7 @@ texisplice(struct texi *p, const char *b f->map = cp; } + f->insplice += sz; memmove(f->map + *pos + sz, f->map + *pos, f->mapsz - *pos); memcpy(f->map + *pos, buf, sz); f->mapsz += sz; Index: extern.h =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/extern.h,v retrieving revision 1.15 retrieving revision 1.16 diff -Lextern.h -Lextern.h -u -p -r1.15 -r1.16 --- extern.h +++ extern.h @@ -301,6 +301,7 @@ struct texifile { char *map; /* allocated file buffer */ size_t mapsz; /* size of map */ size_t mapmaxsz; /* full size of map */ + size_t insplice; /* how many bytes left in splice */ }; struct texi; Index: version_0_1_2.xml =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/version_0_1_2.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -Lversion_0_1_2.xml -Lversion_0_1_2.xml -u -p -r1.3 -r1.4 --- version_0_1_2.xml +++ version_0_1_2.xml @@ -10,5 +10,6 @@ Also allow reading from standard input (instead of always from a file). Consolidate mdoc(7)-escaping of opaque output. Let conditionally-ignored text (e.g., @ifset) allow for nested conditionals as stipulate in the Texinfo manual. + Paste macro and value bodies into the file as Texinfo stipulates and fix the trailing macro newline to conform as well. -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv