Hi Gary, Gary V. Vaughan <gary <at> gnu.org> writes:
> > I propose adding this to the testsuite; it currently fails, but must pass > > before we can release m4 2.0. Otherwise, if you install autoconf with > > frozen files generated by 1.4.x, then upgrade m4, autoconf will break > > because m4 2.0 can't reload the frozen files. Any comments before I commit? > > Nice idea. You forgot to 'cvs add tests/freeze.at' before generating > your patch tho' :-/ Phooey. I did it in one tree, but not in the tree where I made my canonical diff (I guess that means I am maintaining too many simultaneous trees on my disk, to play with different ideas :). See below. > Yes, in fact we even jump through some hoops to make that possible > (see deferred options loop in main.c). > > > Or should we claim that all options that affect state > > are invalid in combination with -R, since the state should instead be set > > by virtue of the reloaded state? It could certainly make implementation > > easier (even your new -r option to set resyntax would qualify as something > > incompatible with -R). > > It would save a couple of dozen lines of code that we already have, > but I like the flexibility of being able to, say: > > # Freeze a macro base using RE_SYNTAX_EMACS > m4 -F base.m4f base.m4 > # Use it with another macro set developed using RE_SYNTAX_EXTENDED > m4 -r extended -R base.m4f macros.m4 OK, I can see how that might be useful (but it is more complex to get right). And it means my proposed AT_CHECK_M4_FROZEN really needs two sets of args, for true testing of all argument scenarios we want to support: `m4 ARGS1 file1 file2' should match `m4 ARGS1 -F file1.f file1; m4 ARGS2 -R file1.f file2'. > > And no need to go in and edit either file > > Hmmm... on second thoughts, we need another hoop to accomplish that: > each frozen macro would need to record what regexp syntax it assumes. > I'll add it to my todo list. I'm not sure I follow. Any `F' directive in the frozen file of one of the three regex builtins just says that the following name maps to the builtin, without regards to which syntax. Any `T' directive in the frozen file that contains a string that can be rescanned with one of the three regex macros can either explicitly asks for the right regex syntax, by supplying the optional parameter, or uses the current default, even if the current default is different than the one when the text macro was defined. But I don't see any reason for a macro's definition to remember what the default syntax was at the time it was defined, any more than a macro's definition should remember what the quoting was at the time it was defined. Anyway, here's my first cut at freeze.at; I'm also checking it in. ============ # Hand crafted tests for GNU M4. -*- Autotest -*- # Copyright 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. AT_BANNER([Freezing state.]) ## ---------------- ## ## loading format 1 ## ## ---------------- ## AT_SETUP([loading format 1]) AT_KEYWORDS([frozen]) m4_if([ Note: frozen.m4f was obtained by deleting unneeded lines from the output of a version of m4 1.4.5 with changeword support. Deleting lines is in effect equivalent to using undefine(name) in the input. This test ensures we behave well with the old format, including \ parsing, disappearing builtins (okay so long as the input does not try to use them), and restoring sane defaults for features that were only added in version 2 frozen format. $ m4 --version | head -n1 GNU M4 1.4.5 $ cat frozen.m4 divert(`-1') define(`foo', `\FOO') pushdef(`foo', `bar') define(`my_define', defn(`define')) define(`my_changeword', defn(`changeword')) pushdef(`my_define', `define') pushdef(`my_define', defn(`define')) divert(`1')dnl foo divert`'dnl changequote([,])dnl changecom([/*], [*/])dnl dnl Implied sequence of undefine(`name') due to hand-edits $ m4 -F frozen.m4f frozen.m4 $ ]) AT_DATA([[frozen.m4f]], [[# This is a frozen state file generated by GNU M4 1.4.5 V1 Q1,1 [] C2,2 /**/ F6,6 popdefpopdef F13,10 my_changewordchangeword F9,6 my_definedefine T9,6 my_definedefine F9,6 my_definedefine T3,4 foo\FOO T3,3 foobar F3,3 dnldnl D1,4 bar D0,0 # End of frozen state file ]]) AT_DATA([[input.m4]], [[foo /* foo */ popdef([foo])foo my_define([bar], [1])[]popdef([my_define]) bar my_define([bar], [2])[]popdef([my_define]) bar my_define([bar], [3])[]popdef([my_define]) bar ]]) AT_CHECK_M4([-R frozen.m4f input.m4], 0, [[bar /* foo */ \FOO 1 define 1 3 bar ]]) AT_CLEANUP _______________________________________________ M4-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/m4-patches
