Bookstore

Recent

Author Topic: JCL: JclExprEval.pas replacements?  (Read 5169 times)

CsO237

  • New member
  • *
  • Posts: 6
JCL: JclExprEval.pas replacements?
« on: June 09, 2014, 12:37:52 am »
is there any good replacement of JEDI JclExprEval.pas for lazarus under Linux?
pascal script is not what I am looking for.

« Last Edit: June 09, 2014, 12:46:57 am by CsO237 »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8162
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: JCL: JclExprEval.pas replacements?
« Reply #1 on: June 09, 2014, 12:23:17 pm »
I guess the unit doesn't have windows specific dependency, so you can just port the unit. Otherwise, you might want to consider symbolic package.

CsO237

  • New member
  • *
  • Posts: 6
Re: JCL: JclExprEval.pas replacements?
« Reply #2 on: June 09, 2014, 04:56:46 pm »
the code of JEDI depends on each units.
and It is not possible to isolate the only part for evaluation.
and some units are heavily dependent on Windows.
I tried to port them  into Lazarus on Linux, but it failed.

so, I have to choose another component, that is similar to JCL.

they have user defind variables, and mathmatic evaluations.

BASH shell is also convenient for evaluation. but I prefer not depend on BASH.

is there any good replacement?
« Last Edit: June 09, 2014, 05:17:10 pm by CsO237 »

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: JCL: JclExprEval.pas replacements?
« Reply #3 on: June 09, 2014, 05:04:44 pm »
well turbopower systools had a math expression parser and there is this http://wiki.lazarus.freepascal.org/FpSystools port you can take a look at. Be warned I never used my self so far so I can't vouch for it.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

wp

  • Hero Member
  • *****
  • Posts: 6833
Re: JCL: JclExprEval.pas replacements?
« Reply #4 on: June 09, 2014, 05:22:16 pm »
There is also "fpexprpars" which comes with fpc/Lazarus. It is quite flexible since you can add your own functions, and you can also parse text and boolean expressions. Search the forum for "fpexprpars", I posted here some details on its usage some time ago (oh - I should add this to the wiki...)

And fpc/Lazarus has also "symbolic", but I never have used it so far.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8072
Re: JCL: JclExprEval.pas replacements?
« Reply #5 on: June 09, 2014, 06:31:05 pm »
And fpc/Lazarus has also "symbolic", but I never have used it so far.

Symbolic is an expression parser with a parsing - calculation separation, so you can evaluate repeatedly faster (e.g. for a graph or iterative algorithm).

It supports user defined constants and variables (the difference is that constants are inserted into the "bytecode", while variabeles are assumed to change every evaluation), and
allows to get a stringlist back with all unknown symbols in an expression. This allows to look up unknown variables in expressions that users typed in in your own structures.

No user defined functions yet (*), but basic one or two argument functions are easily added.

I don't know how it compares to fpexprpars, since that is a fairly recent addition, and frankly I don't know why this redundant unit was added.

CsO237

  • New member
  • *
  • Posts: 6
Re: JCL: JclExprEval.pas replacements?
« Reply #6 on: June 10, 2014, 12:51:34 am »
thank you for so much replies!
fpexprpars looks great, so I MUST use this..:)
« Last Edit: June 10, 2014, 12:53:36 am by CsO237 »

jmpessoa

  • Hero Member
  • *****
  • Posts: 1486
Re: JCL: JclExprEval.pas replacements?
« Reply #7 on: June 10, 2014, 01:02:09 am »
So, You Can try

TFPMathExpressionBridge

A warapper for [math]* subset of TFPExpressionParse** attempting to establish a easy semantics for construction of function graph and expression evaluete.

https://github.com/jmpessoa/tfpmathexpressionbridge

*FParser.BuiltIns:= [bcMath]
**(freepascal fpexprpars.pas) More specifically a WP revision and addOns.
   See: http://www.lazarus.freepascal.org/index.php/topic,19627.0.html

Greetings!


Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

CsO237

  • New member
  • *
  • Posts: 6
Re: JCL: JclExprEval.pas replacements?
« Reply #8 on: June 10, 2014, 10:46:13 am »
TFPMathExpressionBridge is what I am looking for!
Thank you!
jmpessoa saved me:)

wp

  • Hero Member
  • *****
  • Posts: 6833
Re: JCL: JclExprEval.pas replacements?
« Reply #9 on: June 26, 2014, 05:34:13 pm »
For those interested: I began collecting my experience with fpexprpars in the wiki (http://wiki.lazarus.freepascal.org/How_To_Use_TFPExpressionParser)
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10