Re: Is it me?

Dimitris Keletsekis <[email protected]>
Newsgroups gmane.comp.windows.gui4cli
Message-ID <[email protected]>
Hi,

I think the problem is you are confusing the variable names with the
variable contents (which I also did when I first ran the gui).

The first "$" applies to the whole variable. The subsequent "$" (if attached
to the variable name) will be translated and attached to the variable's name
(not contents) and then g4c will look for the whole variable.

So, say "$one$two"
means - look for a variable named "one2"

and say "$one\$two"
means - look for a variable named "one$two"
which when re-translated will result in - look for variable "one2"

Dimitris




On Sat, May 1, 2010 at 8:05 PM, freedeanna <[email protected]> wrote:

>
>
> G4C STRING_TEST
>
> /* ===============================================================
> Description: What's happening here? It seems like the same process gives
> different results the second time round and according to which end a
> variable is attached to another.
> =============================================================== */
>
> WINDOW 50 30 300 80 "String Test gui"
> WinAttr style resize
>
> xOnLoad
> GuiOpen #this
>
> one = "1"
> two = "2"
> three = "3"
>
> xOnClose
> GuiQuit #this
>
> xbutton 20 20 -40 30 "concatenate"
> say "\n"
> onetwo = "$one\$two"
> say "onetwo: $onetwo"
> onetwothree = "$onetwo\$three"
> say "onetwothree: $onetwothree"
> further = "$three\$onetwo"
> say "further: $further"
> addabit = "$onetwo\LITERAL"
> say "addabit: $addabit"
> oneplusliteral = "$one\LITERAL"
> say "oneplusliteral: $oneplusliteral"
> literalplusonetwo = "LITERAL\$onetwo"
> say "literalplusonetwo: $literalplusonetwo"
> appvar onetwo " literal appvar-ed ok"
> say "onetwo by appvar: $onetwo"
>
> // END ////////////////////
>
> Here's the output:
>
> onetwo: 12
> onetwothree: 1
> further: 312
> addabit: 1
> oneplusliteral: 1LITERAL
> literalplusonetwo: LITERAL12
> onetwo by appvar: 12 literal appvar-ed ok
>
> and the relevant part of the debug output is:
>
> 20: SAY
>
> 21: SETVAR ONETWO 1$two
> 22: SAY onetwo: 12
> * Variable "two3" was not found
> 23: SETVAR ONETWOTHREE 1
> 24: SAY onetwothree: 1
> 25: SETVAR FURTHER 3$onetwo
> 26: SAY further: 312
> * Variable "twoLITERAL" was not found
> 27: SETVAR ADDABIT 1
> 28: SAY addabit: 1
> 29: SETVAR ONEPLUSLITERAL 1LITERAL
> 30: SAY oneplusliteral: 1LITERAL
> 31: SETVAR LITERALPLUSONETWO LITERAL$onetwo
> 32: SAY literalplusonetwo: LITERAL12
> 33: APPVAR onetwo literal appvar-ed ok
> 34: SAY onetwo by appvar: 12 literal appvar-ed ok
> ====| End of Commands.
>
> At the first setvar, does onetwo contain "1$two" or "12"? If the former, as
> per the help file, the "say" output is translating it, which seems
> unhelpful. Shouldn't the say report it directly as "1$two".
>
> Strangely, to my mind, variable "onetwothree" isn't set to either
> "1$two$three" or "12$three". Instead, the variable three is being translated
> and attached to "$two", and Gui4Cli is looking for variable "two3", which it
> fails to find.
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.