ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Macrodef @{x}
Date Wed, 03 Dec 2003 13:37:29 GMT
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message