VOScript

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ecos
Posts: 91
Joined: Tue Nov 10, 2015 6:49 am

VOScript

Post by ecos »

Hi,
in our VO-Application we have implemented the library VOSCRIPT and we use scripting a lot in order to adjust the behaviour of the programm according to the wishes of our customers. Porting the source of VOSCRIPT to x# is essential for us. In a first test there seems to be only one big problem. Scripting variables are created via

local cVarname as string
local uValue as usual

cVarname := .....
uValue := ...

PRIVATE &cVarname
&cVarname := uValue

x# doesn't accept this code. Is there any chance to make this possible or is there a smarter workaround ?
memvarput() does not show the same result as the original code.

TIA
Karl
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VOScript

Post by Chris »

Hi Karl,

Hmm, good point, I think this was just overlooked. I think it can be implemented, but not totally sure. We will have a look into this and will get back to you in a few days.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

VOScript

Post by wriedmann »

Hi Chris,
VOScript was used by a lot of people - and it was distributed with VO 2.6.
I have a regular (paid) & source code license of it, and I had tried to contact the author a few years ago, but wasn't able to reach him.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VOScript

Post by Chris »

Guys,

The functionality already exists, but not the syntax for handling memvars with the & syntax. This works already just fine:

Code: Select all

FUNCTION Start() AS VOID
LOCAL cVarname AS USUAL
cVarname := "myprivate"

// Declare private:
__MemVardecl(cVarname , TRUE)

// Assign value
__MemVarPut(cVarname , "abc")

// Read value
? __MemVarGet(cVarname)

// this also works of course
? myprivate

so theoretically all the code can be modified above and it should work fine in X# as well. But I *think* it will be possible to support the original syntax as well, so no code changes will be necessary.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
ecos
Posts: 91
Joined: Tue Nov 10, 2015 6:49 am

VOScript

Post by ecos »

Hi Chris,
this seems to work in x#.
As this affects only about 10 lines of code in VOSCRIPT the old syntax is not so important.
In normal coding I will never use PRIVATES

Thanks
Karl
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VOScript

Post by Chris »

Hi Karl,

Ah, so it's should be easy! In that case maybe you could also rewrite this small piece of code so that it uses something different than PRIVATEs, something like a Dictionary maybe for holding the values. It is not necessary, would probably just make the code faster and easier to read.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

VOScript

Post by Karl-Heinz »

Guys,

in the last months i posted a lot memvar samples. I "love" memvars - why struggle with tons of typed locals if the job can be done with two or three privates/publics instead ? Ok, just kidding :-)

regards
Karl-Heinz
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

VOScript

Post by wriedmann »

Hi Karl-Heinz,
I'm using memvars also a lot, but never in "normal" code, but in dynamic code, mostly in my report engine where I use MemVarPut() a lot (to set report variables).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

VOScript

Post by Karl-Heinz »

Hi Wolfgang,

in "normal" VO code memvars are a no go. To be honest, in the past 25 VO years i never had the need to use privates/publics. Of course, for our VFP friends, or if you are using scripting memvars are a must.

regards
Karl-Heinz
Post Reply