> Agreed. It also affects the __file__ macro. Here's a patch that will
> make it in 1.4.6 that does just that:
>
> 2006-07-29 Eric Blake <[EMAIL PROTECTED]>
>
> * src/path.c (path_search): Add result parameter, so that
> -I can be accounted for. Debian bug 53685.
This deserves testsuite exposure, as patched below.
Also, I find it annoying that m4wrap always claims to be in
__file__ NONE and __line__ 0. I hope to improve that situation
on head when I fix m4wrap to be FIFO, by storing the current
file and line number of where each piece of wrapped text was
captured along with the wrapped text.
2006-07-30 Eric Blake <[EMAIL PROTECTED]>
* doc/m4.texinfo (Errprint): Add example for last patch.
* checks/check-them): Account for VPATH in latest example.
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.55
diff -u -p -r1.1.1.1.2.55 m4.texinfo
--- doc/m4.texinfo 28 Jul 2006 01:45:04 -0000 1.1.1.1.2.55
+++ doc/m4.texinfo 30 Jul 2006 21:28:14 -0000
@@ -3995,6 +3995,26 @@ errprint(`m4:'__file__:__line__: `input
@result{}
@end example
+Line numbers start at 1 for each file. If the file was found due to the
[EMAIL PROTECTED] option or @env{M4PATH} environment variable, that is
+reflected in the file name. The syncline option (@option{-s}) uses the
+same notion of current file and line. Assume this example is run in the
[EMAIL PROTECTED] directory of the @acronym{GNU} M4 package, using
[EMAIL PROTECTED]/examples} in the command line to find the file
[EMAIL PROTECTED] mentioned earlier:
+
[EMAIL PROTECTED]
+define(`foo', ``$0' called at __file__:__line__')
[EMAIL PROTECTED]
+foo
[EMAIL PROTECTED] called at stdin:2
+include(`incl.m4')
[EMAIL PROTECTED] file start
[EMAIL PROTECTED] called at ../examples/incl.m4:2
[EMAIL PROTECTED] file end
[EMAIL PROTECTED]
[EMAIL PROTECTED] example
+
@node M4exit
@section Exiting from @code{m4}
Index: checks/check-them
===================================================================
RCS file: /sources/m4/m4/checks/Attic/check-them,v
retrieving revision 1.1.1.1.2.8
diff -u -p -r1.1.1.1.2.8 check-them
--- checks/check-them 8 Jul 2006 21:20:44 -0000 1.1.1.1.2.8
+++ checks/check-them 30 Jul 2006 21:28:14 -0000
@@ -54,7 +54,8 @@ do
continue
fi
- sed -e '/^dnl @result{}/!d' -e 's///' "$file" > $xout
+ sed -e '/^dnl @result{}/!d' -e 's///' -e "s|\.\./examples|$examples|" \
+ "$file" > $xout
if cmp -s $out $xout; then
:
_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches