Re: how to use FXExpression

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: how to use FXExpression

by Jeroen van der Zijp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 15 September 2009, yufeng230@... wrote:
>  hi:
>   FXExpression expr;
>   result=expr.parse("3+5"); result=8
> can  evaluate  "a+5*(c+d)"?
>  ....
>   a=6;c=3;d=5;
>   result=expr.evaluate( "a+5*(c+d)");
> ...  
>  result=46?


The intent is something like:

        FXExpression expr;
        double acd[4];

        acd[0]=6.0; // 'a'
        acd[1]=3.0; // 'c'
        acd[2]=5.0; // 'd'

        expr.parse("a+5*(c+d)","a,c,d");

        result=expr.evaluate(acd);

When you parse() the expression, if you have any symbolic variables then
you can pass a list of their names in the order that they will be placed
in the parameter array passed to evaluate().

You can then (repeatedly) execute expr.evaluate(), each time with different
values in the parameter array.


Hope this helps,

                - Jeroen

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users