ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Lévy-Lambert <anto...@antbuild.com>
Subject AW: Macrodef @{x}
Date Wed, 03 Dec 2003 13:48:35 GMT
Sounds very very good. The light of the 1.6 release seems to come closer to
the horizon.

Cheers from Walldorf,

Antoine

-----Urspr√ľngliche Nachricht-----
Von: Peter Reilly [mailto:peter.reilly@corvil.com]
Gesendet: Mittwoch, 3. Dezember 2003 14:37
An: Ant Developers List; Ant Users List
Betreff: Macrodef @{x}


I have committed the changes to change from ${x} to @{x} for
macro attributes substitution.

Usage of macrodef is now as follows:
<macrodef name="example">
   <attribute name="x"/>
   <sequential>
      <echo>The attribute has the value '@{x}'</echo>
  </sequential>
</macrodef>

This can be called as follows:
<example x="a value"/>

The escape sequence @@{ may be used to escape the substitution:

<macrodef name="example">
   <attribute name="x"/>
   <sequential>
      <echo>The attribute @@{x} has the value '@{x}'</echo>
  </sequential>
</macrodef>

<example x="a value"/>

Will result in:
     [echo] The attribute @{x} has the value 'a value'

The mechanisms for substition are different for properties and
macrodef attributes so one may now do the following:

    <macrodef name="double">
      <attribute name="prop"/>
      <sequential>
        <echo>@@{prop} is '@{prop}', value of $${@{prop}} is
'${@{prop}}'</echo>
      </sequential>
    </macrodef>
    <property name="property" value="A property value"/>
    <double prop="property"/>

resulting in:
     [echo] @{prop} is 'property', value of ${property} is 'A property
value'

These changes will be available for the next ant 1.6 beta build.

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message