* texi2mdoc: Have line and column number reporting not be affected by the
@ 2015-02-25 14:49 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2015-02-25 14:49 UTC (permalink / raw)
To: source
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., <code>@ifset</code>) 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.
</aside>
</article>
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-25 14:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 14:49 texi2mdoc: Have line and column number reporting not be affected by the kristaps
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).