Re: Re: Is it me?
Dimitris Keletsekis <[email protected]>
| Newsgroups | gmane.comp.windows.gui4cli |
|---|---|
| Message-ID | <[email protected]> |
Hi, Sorry, its a mistake... (I should have tested it first...) > onetwo = "$one\$two" > say "onetwo: $onetwo" The above does correctly result in 12. In the first line, g4c will stop reading the variable name at "\", so will evaluate it as "$one", ie "1". Assignments work the same whether its Say or = Also, the debug output are the raw variable contents (AFAIR) Best regards Dimitris On Sun, May 2, 2010 at 10:36 PM, freedeanna <[email protected]> wrote: > > > > Dimitris, thanks. I'm very confused about all this. If what you say below is true, I don't understand why the first output would be "12" unless variable assignment works completely differently from "say". Looking at the debug output, it says SETVAR ONETWO 1$two. Is that the debug output from my assignment onetwo = "$one\$two"? > > It appears to have translated the first part to "1", not the second, then attached $two. When this is "say-ed", it appears to comes out as "12", which has a kind of logic, but not the logic you've described. > > I realise I was also confused because I expected "say" to reveal the untranslated contents of things in this instance, not translate them. If a variable contains "one$two" I expected say to tell me that, not look for a variable one$two. But I don't usually expect that in day-to-day programming - it was just because I wanted to inspect the direct contents of these variables, and I forgot. Normally, if I know that x contains "$$lv.line" and a listview is at line 24, say $x will give me 24. Sorry, I was being dim there. > > Does "say" do the same as an assignment, translate deeply until no more variables can be translated, or just one layer down? > Can I take it that debug output is the direct contents? > > --- In [email protected], Dimitris Keletsekis <gui4cli@...> wrote: > > > > 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 <freedeanna@...> 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. > > > > > > > > > > > > > ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/gui4cli/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/gui4cli/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/