bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #58016] Add an option "--label=<name>" to show an origin of diagnos


From: Bjarni Ingi Gislason
Subject: [bug #58016] Add an option "--label=<name>" to show an origin of diagnostics
Date: Tue, 12 May 2020 19:20:37 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #4, bug #58016 (project groff):

  There is no need to add code to "groff" in this case.

  Add it to "test-groff.in" and the makefiles that now produce output
on standard error.

  The relevant part for "test-groff.in" is the last part of the
diff-file.

  Patches (based on older master repository):

1) test-groff.in

  Add code to process the additional option "--label <output file>"

2) doc/doc.am

  Add the option "--label <output file>" where "DOC_GROFF" or
"DOC_GROFF_ONLY" is used.


--- ../new-groff/test-groff.in  2020-05-12 22:28:53.000000000 +0000
+++ test-groff.in       2020-05-12 22:29:07.000000000 +0000
@@ -28,11 +28,23 @@ GROFF_BIN_PATH=$builddir
 XENVIRONMENT=$srcdir/src/devices/xditview/GXditview.ad
 export XENVIRONMENT
 
+if [ ! -d $srcdir/tmac/mdoc ] && [ ! -d $builddir/tmac/mdoc ] ; then
+  printf '%s\n' "${0}: Macros in the \".../tmac/mdoc\" directory can't be
used" 1>&2
+  printf '\t%s\n'  "See the file \"PROBLEMS\" (or bug #51073)" 1>&2
+fi
+
 GROFF_COMMAND_PREFIX=
 GROFF_FONT_PATH=$builddir/font\
 $SEP$srcdir/font\
 
-GROFF_TMAC_PATH=$srcdir/tmac\
+if test -n "$TEST_GROFF_TMAC_PATH"; then
+  GROFF_TMAC_PATH=$TEST_GROFF_TMAC_PATH$SEP
+else
+  GROFF_TMAC_PATH=''
+fi
+
+GROFF_TMAC_PATH=$GROFF_TMAC_PATH\
+$SEP$srcdir/tmac\
 $SEP$builddir/tmac\
 $SEP$srcdir/contrib/mom\
 $SEP$builddir/contrib/mom\
@@ -47,4 +59,39 @@ $SEP$builddir/contrib/pdfmark\
 
 export GROFF_BIN_PATH GROFF_COMMAND_PREFIX GROFF_FONT_PATH GROFF_TMAC_PATH
 
-exec $builddir/groff -b -ww ${1+"$@"}
+
+filename=''
+lastitem=''
+
+for item ; do
+  if test "$lastitem" = '--label' ; then
+    filename=$item
+    break
+  fi
+  case "$item" in
+    --label) lastitem='--label'
+       continue
+    ;;
+  esac
+done
+
+#filename=''
+arguments=$(echo ${1+"$@"} | sed -e 's%--label  *[^ ]*%%' )
+
+if test -n "$filename" ; then
+  temp=$builddir/test-groff.error.${filename##**/}
+  $builddir/groff -b -ww $arguments  2> $temp
+  if test -s "$temp" ; then
+    sed -i -e \
+      's%stdin:%'"$filename"':%
+      s%<standard input>:%'"$filename"':%
+      T a; b
+      :a ; s%^%'"$filename"': %' \
+      $temp
+    cat $temp 1>&2
+  else
+    rm $temp
+  fi
+else
+  exec $builddir/groff -b -ww $arguments
+fi

#### Part 2 for doc/doc.am ####

--- doc.am      2020-05-12 22:35:30.000000000 +0000
+++ ../../new-groff/doc/doc.am  2020-05-12 22:35:21.000000000 +0000
@@ -28,7 +28,7 @@ DOC_GROFF_ONLY=\
   GROFF_COMMAND_PREFIX= \
   GROFF_BIN_PATH="$(GROFF_BIN_PATH)" \
   $(GROFFBIN) -I$(abs_top_builddir) -M $(doc_srcdir) \
-       $(TFLAG) $(FFLAG) -Upet -ww 
+       $(TFLAG) $(FFLAG) -Upet -ww -b
 
 DOC_GROFF = $(DOC_SED) $< | $(DOC_GROFF_ONLY)
 
@@ -124,21 +124,21 @@ SUFFIXES += .me .ms .ps .html .txt .texi
 # For simplicity, we always call preconv, grn, and eqn.
 .me.txt:
        $(GROFF_V)$(MKDIR_P) `dirname $@` \
-       && $(DOC_GROFF) -k -Tutf8 -ge -me >$@
+       && $(DOC_GROFF) -k -Tutf8 -ge -me --label $@ >$@
 .me.ps:
        $(GROFF_V)$(MKDIR_P) `dirname $@` \
-       && $(DOC_GROFF) -k -Tps -ge -me >$@
+       && $(DOC_GROFF) -k -Tps -ge -me --label $@ >$@
 
 .ms.html:
        $(GROFF_V)$(MKDIR_P) `dirname $@` \
        && $(DOC_GROFF) -P-p -P-b -P-I`basename $< | sed -e 's|.ms$$||'` \
-                       -P-D$(imagedir) -Thtml -ms >$@
+                       -P-D$(imagedir) -Thtml -ms --label $@ >$@
 .ms.txt:
        $(GROFF_V)$(MKDIR_P) `dirname $@` \
-       && $(DOC_GROFF) -Tascii -ms -mwww >$@
+       && $(DOC_GROFF) -Tascii -ms -mwww --label $@ >$@
 .ms.ps:
        $(GROFF_V)$(MKDIR_P) `dirname $@` \
-       && $(DOC_GROFF) -Tps -ms -mwww >$@
+       && $(DOC_GROFF) -Tps -ms -mwww --label $@ >$@
 
 $(PROCESSEDEXAMPLEFILES): $(bin_PROGRAMS) $(prefixexecbin_PROGRAMS) gnu.eps
 $(PROCESSEDEXAMPLEFILES): $(dist_devpsfont_DATA) $(nodist_devpsfont_DATA)
$(hdtbltmac_DATA)
@@ -154,7 +154,8 @@ doc/pic.html: $(doc_srcdir)/pic.ms $(dev
        && cd $(doc_builddir) \
        && $(DOC_SED) $(doc_srcdir)/pic.ms \
           | $(DOC_GROFF_ONLY) -P-p -P-Ipic -P-D$(imagedir) -P-jpic \
-                              -Thtml -ms > pic.html
+                              -Thtml -ms \
+                               --label pic.html -- > pic.html
 
 doc/examples.stamp: doc/groff.css
        @$(MKDIR_P) $(doc_builddir)
@@ -169,7 +170,8 @@ doc/webpage.html: $(doc_srcdir)/webpage.
        && cd $(doc_builddir) \
        && $(DOC_SED) $(doc_srcdir)/webpage.ms \
           | $(DOC_GROFF_ONLY) -P-jwebpage -P-nrpb -P-Iwebpage \
-                              -P-D$(imagedir) -Thtml -ms > webpage.html
+                              -P-D$(imagedir) -Thtml -ms \
+                               --label webpage.html -- > webpage.html
 
 doc/grnexmpl.ps: doc/grnexmpl.me doc/grnexmpl.g
 
@@ -472,5 +474,7 @@ dist-gnueps:
 
 
 # Local Variables:
+# fill-column: 72
 # mode: makefile-automake
 # End:
+# vim: set autoindent filetype=automake textwidth=72:



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58016>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]