From: Dave D. <dde...@es...> - 2004-07-10 15:20:28
|
Daniel J Sebald <dan...@ie...> writes: > the bottom of df_readline() is the important code which knows how and > where to put data in the v[] variables, and there may even be some > scripts there, as I don't really understand the "at" stuff and that. > The "at" stuff is just the way expressions are stored. All (?) expression evaluation in gnuplot is done by compiling the expression into an action table, then stepping through the actions to compute a result. There is (or used to be) an undocumented command show at to show the internal representation of an expression. gnuplot> f(x)=x+2 gnuplot> show at f(sin(x)-cos(y+z)) push x sin push y push z plus cos minus call f pushd1 f dummy pushc 2 plus action tables are clearly stack-based, and user-defined functions are (not surprisingly) stored as action tables. For plot ... using (expression), each expression gets compiled into an action table, and then the action table is evaluated for each datafile line to calculate the required values. In the version I'm looking at, parse.c does the compiling of expressions, and eval.c does the evaluation (by just running through the function pointers stored in the at) Looks like a global variable "undefined" gets set if something goes wrong during the evaluation. dd -- Dave Denholm <dde...@es...> http://www.esmertec.com |