jazzdman@gmail.com wrote:
> Hi,
> I'm trying to expand the capabilities of the Android testing tool,
> http://www.wildopensource.com/activities/larry-projects/android.php.
> I'm not familiar with Tcl, but I've been learning along the way. This
> if statement :
>
> if { [ check_for_dbl_click $click_line $click_text ] } {
> set fnd_dbl_clk 1
> [ transform_line $click_line ]
> }
>
> causes Tcl to complain : invalid command name "". Those are empty
> quotes. What does this mean? Before I put in the set line, I could
> write the test and command on one line and the Tcl parser would be
> happy. I've tried rewriting this line a few times to try to remove any
> extraneous spaces, but I can't seem to satisfy it. It complains
> spefically about the [ transform_line $click_line ] statement. What am
> I missing?
My guess is that transform_line returns an empty string instead of a valid
command name.
In Tcl the first word on a "line" is the command, in this case the first
word is the value returned by transform_line (square brackets roughly mean
evaluate what is in side of the square brackets as a command and its
arguments and substitute the return value of the command in place of the
square brackets and its contents).
Thus in the above if the value of click_line is foo and the "line" is: [
transform_line $click_line ]
The parser sees the square brackets, pauses execution and evaluates
transform_line $click_line
it sees the the $click_line, substitiutes its value, thus giving
transform_line foo
it then call transform_line with one argument, foo. Let us say it returns
the null string. The parser will then resume the suspended execution os
the original line, substituing in "" for square brackets and its contents.
Thus it attempts to evaluate:
""
From the error message, it would appear you do not have a procedure whose
name is the null string.
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester | "The man who fights for his ideals is |
| Gerald.Lester@cox.net | the man who is alive." -- Cervantes |
+--------------------------------+---------------------------------------+
Received on Thu Sep 29 14:28:01 2005