[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: saving AC development strength
From: |
Bruce Korb |
Subject: |
Re: saving AC development strength |
Date: |
Tue, 29 Jan 2002 18:52:36 -0800 |
Akim Demaille wrote:
> | I have three choices:
> |
> | 1. changequote to something certain to not be confused (probably would
> | have been a really good idea way back when, but likely not now)
> | 2. replace autoconf-special characters with the quadrigraphs
> | (my current choice)
> | 3. lexically analyize the user supplied text for square
> | bracket constructs that confuses M4's quoting scheme. Then,
> | if detected, only replace those characters that would enable
> | M4 to properly not do substitutions in that text.
Did you understand that last sentence? I don't. [[I had just
arrived home from a 9 hour drive...]]
Then, if detected, only replace those characters that would
keep autoconf's M4 processing from becoming confused.
> | ...I [still] think, not worth doing.
>
> OK, as long as you are sure you are not quadrigraphing actual M4
> quotes, it's correct.
It's correct, but so are #1 and #3. The real question is,
"What is the best solution?" given that none of them are
very pleasing....
Here's an example. Please note that *only* user supplied
text has the quadrigraph substitutions done. The text I
have control over, I don't do that. Oh, I still have a question,
too: Given that I have complete control over the macro, I can
test to see if a full language "push" is required by testing
to see if it is the current language. Is it worth doing?
The alternative is to blindly push & pop.
> AC_DEFUN([AG_RUN_QUOTING],
> AC_MSG_CHECKING([whether M4 quotes are handled properly])
> AC_CACHE_VAL([ag_cv_run_quoting],[
> if test "${LANGUAGE}" != "C"
> then
> ag_poplang=true
> AC_LANG_PUSH(C)
> else
> ag_poplang=false
> fi
> AC_TRY_RUN(address@hidden:@include <stumble.h>
> static const char foo@<:@32@:>@ = "@S|@val";
> int main( int argc, char* argv@<:@@:>@ ) {
> return (strlen(foo) == 4) ? 0 : strlen(foo); }],
> [ag_cv_run_quoting=yes],[ag_cv_run_quoting=no],[ag_cv_run_quoting=no]
> ) # end of TRY_RUN
> if $ag_poplang
> then
> AC_LANG_POP(C)
> fi]) # end of CACHE_VAL
> AC_MSG_RESULT([${ag_cv_run_quoting}])
>
> if test "X${ag_cv_run_quoting}" != Xno
> then
> @%:@ @S|@xx @<:@ `date` @:>@
> echo okay
> AC_DEFINE(HAVE_QUOTING,1,
> [Define this if M4 quotes are handled properly])
> AG_QUOTING="@S|@{ag_cv_run_quoting}"
> else
> AC_DEFINE(NEED_QUOTING,0,
> [Define this if 'M4 quotes are handled properly' is not true])
> AG_QUOTING=''
> fi
> AC_SUBST([AG_QUOTING])
> ]) # end of AC_DEFUN of AG_RUN_QUOTING
============== The source definitions: ===================
> AutoGen Definitions conftest.tpl;
> author = "Bruce Korb";
> group = ag;
> test = {
> name = "quoting";
> type = "run";
> language = C;
> check = "M4 quotes are handled properly";
> code = <<- _END_OF_CODE_
> #include <stumble.h>
> static const char foo[32] = "$val";
> int main( int argc, char* argv[] ) {
> return (strlen(foo) == 4) ? 0 : strlen(foo); }
> _END_OF_CODE_;
>
> action = { yes; act-type=define; act-text = "1"; };
> action = { no; act-type=define; act-text = "0"; };
> action = { yes; act-type=subst; act-text = "${ag_cv_run_quoting}"; };
> action = { yes;
> act-type = script;
> act-text = <<- _END_OF_SCRIPT_
> # $xx [ `date` ]
> echo okay
> _END_OF_SCRIPT_; };
> };
--
Bruce Korb <first initial + last name at gnu dot org>
AG URL: http://autogen.sourceforge.net
Message not available
- Message not available
- Message not available
- Message not available
- Re: saving AC development strength, Bruce Korb, 2002/01/25
- Re: saving AC development strength, Akim Demaille, 2002/01/27
- Re: saving AC development strength, Bruce Korb, 2002/01/28
- Re: saving AC development strength, Akim Demaille, 2002/01/29
- Re: saving AC development strength,
Bruce Korb <=
- Re: saving AC development strength, Akim Demaille, 2002/01/30
- Re: saving AC development strength, Bruce Korb, 2002/01/30
- Re: saving AC development strength, Paul Eggert, 2002/01/31
- Re: saving AC development strength, Bruce Korb, 2002/01/31
Re: saving AC development strength, Thomas E. Dickey, 2002/01/31
Re: saving AC development strength, Akim Demaille, 2002/01/31
Re: saving AC development strength, Akim Demaille, 2002/01/31