Sample Header Ad - 728x90

is it possible to integrate bc calculator in an app (script interpreter) as a library?

0 votes
0 answers
44 views
is it possible to integrate bc command line calculator in an app (script interpreter) as a library? I am not asking if that can be done, I am asking if there is something ready already that wraps bc and make it work as a library. In ubuntu 22.04 I can't find any packages like bc-dev libbc-dev libbc ... Searching for this subject on google doesnt help either. My goal is to integrate the command line calculator interpreter bc inside a GPL game script interpreter called Arx Libertatis (Arx Fatalis). So, when the game starts and it reads and interprets it's .asl script, it will find a line like ex.: Calc @result "(~@val1~*33)/~@val2~" (where ~@val1~ will expand to 0.25 and ~@val2~ will expand to 7.123) That script line shall send "(0.25*33)/7.123" to bc and assign it's result at @result. But for that, I need to access the bc main function directly and not call the compiled bc binary. So I am loogin for a libbc-dev somewhere, but I just can't find it. Will I have to wrap it in a lib myself? btw, it must have high performance, and if there is an alternative to bc that provides a faster result, it is important because it is a game and the calculations must happen as fast as possible. Also, I could use flags to the Calc script command to determine what calculator interpreter will be used so Calc -b ... would use bc, while Calc -d ... could use some other library (and therefore mod developers must prepare it in a syntax that is recognized by the other library).
Asked by Gussak Thor (11 rep)
Dec 7, 2023, 04:11 PM
Last activity: Dec 7, 2023, 04:34 PM