autoconf
[Top][All Lists]
Advanced

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

Re: multiline output variables.


From: Dan Manthey
Subject: Re: multiline output variables.
Date: Tue, 25 Jan 2005 19:17:17 -0500

Here's what I hope is a final solution to multiline output variables and
the related rework of _AC_OUTPUT_FILES.

I needed to change the delimeter to not contain @, since I now escape all
@ in output variable values as |address@hidden@#|.  No, there's no really good 
reason
that I chose this string, except that it's ugly enough to be rare, and it
doesn't have @s on its ends, which means that it can be used to escape
itself if need be (ick!).  Also, note that I escape _all_ @s in output
variables so that if I have $fish='@foo', $bait='bar@', and
$foobar='whoops', @fish@@bait@ doesn't become "whoops"  (which would only
happen if I AC_SUBST([fish]) and AC_SUBST([bait]) both before I
AC_SUBST([foobar])).

For similar reasons and lack thereof, I escape the beginning of each
variable with |address@hidden@#|, which I later delete, so that if $shove='ob',
@address@hidden@ar@ doesn't become "whoops" either.  (This would be especially
dangerous if neither $fo nor $ar were output variables, in which case the
user might reasonably expect the @fo@ and @ar@ to be safe.)  Note that
this also allows "@address@hidden@" to be disambiguated into either
"@|address@hidden@#|address@hidden@" or "@fish@|address@hidden@#|bait@".  I 
suppose it would be
possible to detect and gripe to the user about "@address@hidden@", but this
would be a major pain, and I figure it's their own problem.

I believe that these two escapes cause substitutions to now be strictly
non-recursive, and fully deterministic with respect to number and order of
AC_SUBST.

I've changed AC_SUBST_FILE'd output variables to only work on lines by
themselves, and now delete the lines.  I allow spaces and tabs at either
end of the line to reduce confusion and consternation.  (By the way, I
wasn't sure whether "
/@foo@/{
r $foo
d
}
" is two, three, or four sed commands.  I counted it as four.)

I'd like somebody else to try stress-testing this code to see if it plays
well in all cases.  (E.g. did I get the logic right if there are exactly
99 output variables?)  Even just a second brain looking at it would be
nice.

-Dan

Attachment: multi.diff
Description: Text document


reply via email to

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