 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Hopkins Guest
|
Posted: Wed Oct 26, 2005 1:16 pm Post subject: Parser library for input of function (object) |
|
|
Hi all
I am looking around to find a C++ library that will allow me to load the
definition of a function from a file and turn this into a callable function
or functor for use within an already compiled program. The function
signature would almost always be of the form:
double function( double* x )
As an example, for the Cauchy density function:
1.0/( pi * ( 1.0 + x^2 ))
....the file could contain something like:
1 # the number of independent variables - might make things easier
1.0 / ( PI * ( 1.0 + SQR( _x1 ) ) )
Thanks in advance for any ideas or pointers and feel free to CC replies to
this email
Michael
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ _/ _/_/_/ Hopkins Research Ltd
_/ _/ _/ _/
_/_/_/_/ _/_/_/ http://www.hopkins-research.com/
_/ _/ _/ _/
_/ _/ _/ _/ 'touch the future'
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Valentin Samko Guest
|
Posted: Wed Oct 26, 2005 11:16 pm Post subject: Re: Parser library for input of function (object) |
|
|
Michael Hopkins wrote:
| Quote: | Hi all
I am looking around to find a C++ library that will allow me to load the
definition of a function from a file and turn this into a callable function
or functor for use within an already compiled program. The function
signature would almost always be of the form:
|
Try http://warp.povusers.org/FunctionParser/ .
--
Valentin Samko - http://val.samko.info
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Tony Delroy Guest
|
Posted: Thu Oct 27, 2005 11:14 am Post subject: Re: Parser library for input of function (object) |
|
|
Hi Michael,
Valentin's suggestion seems by far the best, but if you encounter
problems or need more power you could consider either CINT (see
http://root.cern.ch/root/Cint.html) , or (probably only practical if
your app is for a few in-house users) actually calling the C++ compiler
from your program, and dynamically linking the library/ies it produces.
Cheers,
Tony
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
mlybbert Guest
|
Posted: Thu Oct 27, 2005 2:55 pm Post subject: Re: Parser library for input of function (object) |
|
|
/* I am looking around to find a C++ library that will allow me to load
the definition of a function from a file and turn this into a callable
function or functor for use within an already compiled program.
*/
You're probably not going to find what you want in C++. You may
consider Lua ([url]www.lua.org)[/url], Perl ([url]www.perl.com)[/url], Python
([url]www.python.org)[/url], TOOL ([url]www.codeproject.com/tools/ToolPublic.asp)[/url], or
another interpreted language.
Otherwise, you'll be looking at getting a parser, such as Boost.Spirit
(www.boost.org/libs/spirit/) or YARD (www.ootl.org/yard/) to read the
file, and then you'd roll your own virtual machine -- effectively
making an interpreted language.
My suggestion, btw, is Lua.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Roland Pibinger Guest
|
Posted: Fri Oct 28, 2005 9:03 am Post subject: Re: Parser library for input of function (object) |
|
|
On 26 Oct 2005 09:16:34 -0400, Michael Hopkins
<michael.hopkins (AT) hopkins-research (DOT) com> wrote:
| Quote: | I am looking around to find a C++ library that will allow me to load the
definition of a function from a file and turn this into a callable function
or functor for use within an already compiled program. The function
signature would almost always be of the form:
double function( double* x )
|
Maybe this?
http://www.codeproject.com/cpp/FastMathParser.asp
Best wishes,
Roland Pibinger
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|