|
Post by felixp7 on Oct 30, 2019 8:40:30 GMT 1
All right, this seems just wrong. Trying to compile a minimal test program:
INCLUDE "hug.bac"
top = WINDOW("Just a test", 900, 600)
PRINT EVAL("2 + 2")
DISPLAY yields the following error message: EVAL otherwise works fine for me with BaCon 3.9.2 and GCC 7.3.0 on x86-64. And of course HUG by itself also causes no trouble.
Oh wait! This happens even if the call to EVAL is commented out in the test program, like so:
PRINT "Hello!": ' EVAL("2 + 2") Replacing the comment with arbitrary text, or moving it to a line of its own, causes the code to compile and work normally. Weeeird.
|
|
|
Post by Pjot on Oct 30, 2019 20:05:48 GMT 1
Thanks felixp7,
The reason for this problem is not necessarily in EVAL, but rather has to do with the internal variable administration of BaCon.
It only happens when using RECORD variables in combination with the EVAL function. I am working on a solution and will let you know the outcome.
Thanks again, Peter
|
|
|
Post by Pjot on Nov 2, 2019 20:15:07 GMT 1
Hi felixp7, So I have fixed this issue. Some background: historically, BaCon was implemented in Shell script only and to be compatible with really old Unix versions, like Tru64Unix 5.1B or Solaris 8. The shell versions in those Unix versions were limited, and usually did not support associative arrays. Therefore, the Shell script version of BaCon used 'eval' to create a new symbol for each BaCon variable name to maintain a variable registration. However, 'eval' does not accept a '.' (dot) sign as part of a symbol. To workaround this problem, the variable registration ignored the dot sign altogether. And later, the BaCon implementation of BaCon, which was modeled after the Shell script version, did so as well. This caused your errors. Next to this, the EVAL function tried to recreate *all* registered variables as a double. But this did not work for BaCon regular arrays and associative arrays. So to solve your issue, the whole internal variable registration has been redesigned, and now the Shell script version requires at least BASH 4.0 or higher, or the usual KSH or ZSH shell versions. The BaCon implementation has been adapted as well. Furthermore, correct evaluation of the argument for the EVAL function now only will work in case the used variables have been declared as 'double' or FLOATING prior to the EVAL function. If you fetch the latest beta your EVAL program with HUG should work. Best regards, Peter
|
|