[Top][All Lists]

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

Re: I think binary-branch is almost ready for play time

From: Bruce Korb
Subject: Re: I think binary-branch is almost ready for play time
Date: Sun, 13 May 2001 17:31:34 -0700

Alexandre Oliva wrote:
> > In other words, your new macro should not need to do this:
> >    [= test-and-exit  test = (get "test")  ...  =]
> > because it would be redundant.
> Good.  But I had meant to write ``I'd like *you* to implement ...''
> :-)

Then I would need to understand better what you wanted to have

> I'm not even sure I'd know how to start implementing one macro in
> terms of another.  I recall your having stated this was impossible in
> earlier versions of AutoGen; I'm very happy this is now possible.


   [= test-OR-exit  msg = "start-[= gather-the-message =]-end" =]

is now accepted.  What happens is that the string "sta...end"
is gathered up at load time.  When this invocation fires,
an "anonymous template" is created with that text and then processed.
The output is redirected to an unlinked file (no Windows here),
and read back in.

I remember your message referring to an "else" clause.
I would not nest macros, I would add an argument, and
maybe some sanity checks thus:

DEFINE test-or-exit
  #  if there is no test, then just a message and exit
  % test "\nif (%s) > /dev/null 2>&1 ; then" =][=

  (if (and (not (exist? "test"))
           (or  (exist? "invert")
                (exist? "else")
      )    )  (error "both 'else' and 'invert' require a 'test'))

  (if (and (exist? "invert") (exist? "else"))
      (error "Both 'invert' and 'else' ??")) =][=

  invert "  :\nelse"  =]
  $echo "$modename: [=msg=]" 1>&2[=

  ! no_help "\n  $echo \"$help\" 1>&2" =]
  exit 1[=

  % else "\nelse\n%s" =][=

  test "\nfi"         =][=
ENDDEF                =]

> Yep.  I guess it's just a matter of my getting use to it.  I'm happy
> you're giving me good reasons to learn more about AutoGen :-)

:-)  It took a long time....

reply via email to

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