It's not really - its simply taking a few numbers and trying to add and
subtract them.

I found that

<echo>${position - 3}</echo>

Which fails due to a data type mismatch.. will work if rewritten as

<echo>${convert::to-int(position) - 3}</echo>

But convert::to-int is marked as depreciated.. and says

Function convert::to-int is deprecated.  Use type-specific conversion
functions
instead.

But I can't find any reference to what that means.

I'm just trying to use variables to hold values to clean up readability
of the code, and I can't seem to use properties with operators without
this convert function.  


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ron
Grabowski
Sent: Saturday, September 13, 2008 11:58 PM
To: nant
Subject: Re: [NAnt-users] can you nest functions? problems with data
types

It looks like you're doing some serious manipulation...can you just make
your own custom task to do these operations?



----- Original Message ----
From: Steve Kapinos <[EMAIL PROTECTED]>
To: nant-users@lists.sourceforge.net
Sent: Saturday, September 13, 2008 11:23:07 PM
Subject: Re: [NAnt-users] can you nest functions?  problems with data
types

I can simplify this even more..

I have this

    <property name="position"
value="${string::index-of(deploySetupLogContents,'ResultCode=') + 11}"/>
    <echo>${position}</echo>

This outputs 135 for the echo

But when I try

<echo>${position - 3}</echo>

It considers position a string, not an int.  Without the outside ${ }
its not an expression.  How do I reference the property 'position' here
to subtract 3 from it?



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Kapinos
Sent: Saturday, September 13, 2008 11:13 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] can you nest functions? problems with data types

Ok, I'm trying to do some simple expressions to manipulate some values,
but I'm not having luck nesting expressions.  Specifically, I can not
figure out how to use a function as a argument to another function.
This means I have to use incremental steps and assign the value to a
property, then reference that property in a later step rather then doing
it in a single step.  Is it possible to use a function as an arugument
to another function?

Something like..

Value=${stringsubstring(property1, property2, string::length(property3)
- property4}

Any combination I try to nest an expression inside another fails.

I'm also having a problem with specifying properties properly inside an
expression

Here's what I'm trying to do..

I have a string in a property.  I need to get the index location of a
substring, add to that number, get the overall length of the string, do
a subtraction of those two numbers, and then use these two numbers to
get a substring.  The pseudo code would be something like this

Position = string::Pindex-of(string, value) + 11
targetlength = string::length(string) - $position
result = string::substring(string, position, targetlength)

My code currently is

    <target name="test">
    <loadfile file="setup.log" property="deploySetupLogContents" />
    <property name="position"
value="${string::index-of(deploySetupLogContents,'ResultCode=') + 11}"/>
    <property name="length"
value="${string::get-length(deploySetupLogContents) - position}"/>
    <property name="deploySetupResultCode"
value="${string::substring(deploySetupLogContents, position, length)}"/>

    <echo>Result Code is ${deploySetupResultCode}</echo>
    </target>

But the above does not work.  It complains that in line 4, it can't do
the subtraction between an 'int' and 'string'.  Position is not a
string.. it's a property which is holding an init from line 3.  I can't
specify it as ${position}.. so how can I reference the value I need
here?  I need the entire thing inside an ${  } so its evaluated as an
expression and not just saved as a string.

-Steve

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to