source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: texi2mdoc: Have line and column number reporting not be affected by the
Date: Wed, 25 Feb 2015 09:49:44 -0500 (EST)	[thread overview]
Message-ID: <13318979973654234576.enqueue@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2015-02-25 14:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13318979973654234576.enqueue@fantadrom.bsd.lv \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).