gbranden pushed a commit to branch master
in repository groff.

commit c84997f241b388b6654f36309431dc6b8efb3554
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Thu Jul 10 16:50:46 2025 -0500

    [pre-grohtml]: Refactor.
    
    * src/preproc/html/pre-html.cpp (get_resolution, get_image_generator):
      Track the line number in the files we read to process the "resolution"
      and "image_generator" directives (see groff_font(5)).  Pass the line
      number and resolved file name for the file thus opened to
      `get_line()`.
    
      (get_line): Update definition to accept these new arguments.  (We
      don't yet do anything with them.)
---
 ChangeLog                     | 10 ++++++++++
 src/preproc/html/pre-html.cpp |  8 +++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f6fa960b7..7d7335f4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-07-10  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * src/preproc/html/pre-html.cpp (get_resolution)
+       (get_image_generator): Track the line number in the files we
+       read to process the "resolution" and "image_generator"
+       directives (see groff_font(5)).  Pass the line number and
+       resolved file name for the file thus opened to `get_line()`.
+       (get_line): Update definition to accept these new arguments.
+       {We don't yet do anything with them.}
+
 2025-07-10  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/preproc/html/pre-html.cpp (get_resolution)
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 111673164..70dc18ba0 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -262,7 +262,7 @@ void sys_fatal(const char *s)
  *             global line buffer.
  */
 
-static bool get_line(FILE *f)
+static bool get_line(FILE *f, const char *file_name, int lineno)
 {
   if (0 /* nullptr */ == f)
     return false;
@@ -318,7 +318,8 @@ static unsigned int get_resolution(void)
   // XXX: We should break out of this loop if we hit a "charset" line.
   // "This line and everything following it in the file are ignored."
   // (groff_font(5))
-  while (get_line(f))
+  int lineno = 1;
+  while (get_line(f, pathp, lineno++))
     (void) sscanf(linebuf, "res %u", &res);
   free(pathp);
   fclose(f);
@@ -344,7 +345,8 @@ static char *get_image_generator(void)
   // XXX: We should break out of this loop if we hit a "charset" line.
   // "This line and everything following it in the file are ignored."
   // (groff_font(5))
-  while (get_line(f)) {
+  int lineno = 1;
+  while (get_line(f, pathp, lineno++)) {
     char *cursor = linebuf;
     size_t limit = strlen(linebuf);
     char *end = linebuf + limit;

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to