Macro Substitution
Jim Ault
JimAultWins at yahoo.com
Mon Oct 9 16:34:33 EDT 2006
On 10/6/06 9:09 PM, "Robert Sneidar" <bobs at twft.com> wrote:
> I am a bit stumped as to what to do to convert macro substitutions in
> the fox code I am porting. Macro substitution is when I can refer to
> a variable using a delimiter and the variable will be substituted for
> the value it contains at runtime. So if bobtest contained "blah" then
> I could "get $bobtest.1" and the code at runtime would give me the
> value of blah1. I won't go into the virtues of macro substitution
> here. There are times when it is quite handy.
>
> I know Revolution has no such convention. I am hoping to avoid a lot
> of extra coding to convert macro substitutions in the Foxpro code.
> Any ideas?
I think you are doing simple substitution so
use the normal Rev syntax... +one less character
Rev == Foxpro
get bobTest&1 == get $ bobtest.1
get jimTest&1 == get $jimtest.2
on mouseDoubleUp
put "happy" into bobTest
put "I am glad" into jimTest
--simple ---------------
get bobTest&1
get jimTest&2
--indirection using 'do' ------------
put " get $bobtest.1" into foxString
replace "$" with empty in foxString
replace "." with "&" in foxString
do foxString
put it into part1
put " get $jimtest.2" into foxString
replace "$" with empty in foxString
replace "." with "&" in foxString
do foxString
put ". "& it after part1
answer part1
end mouseDoubleUp
Jim Ault
Las Vegas
More information about the use-livecode
mailing list