Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TCL commands across multiple lines

9,098 views
Skip to first unread message

steve_blah

unread,
Aug 11, 2008, 10:26:17 PM8/11/08
to
Hey folks,

I'm using incremented tcl and have been running into problems lately.
With many of my procedure calls I was finding that, given long
variable names, I was having lines far exceeding 70 characters. For
example:

set l_danglingRange [generate_expected_key_event_ranges -dangling
$i_keyType $i_confHT $i_pressTime $i_releaseTime ]

Which I try to clean up as:

set l_danglingRange [generate_expected_key_event_ranges -dangling \
$i_keyType \
$i_confHT \
$i_pressTime \
$i_releaseTime ]

In some cases I have problems with the '\' version while the other is
fine.

But it seems that the following is OK:
set l_stops [ list \
[ expr { $CLASS_PTI_OFFSET + 1 } ] \
[ expr { $CLASS_EVENT_CODE_OFFSET + 3 } ] \
[ expr { $CLASS_KEY_CODE_OFFSET + 1 } ] ]

Can someone explain or point me to a good reference that can explain
when I can and when I can not escape the end of a line in this way?

Thanks alot,

Steve

Ronnie Brunner

unread,
Aug 12, 2008, 5:33:09 AM8/12/08
to
steve_blah wrote:
> set l_danglingRange [generate_expected_key_event_ranges -dangling \
> $i_keyType \
> $i_confHT \
> $i_pressTime \
> $i_releaseTime ]
>
> In some cases I have problems with the '\' version while the other is
> fine.

"In some cases" sounds like you might have some trailing spaces after
some of your backslashes? A long as your '\'s are immediately followed
by '\n' or '\r\n' you should be fine. Not just some times.

hth
Ronnie

Robert Heller

unread,
Aug 12, 2008, 11:30:44 AM8/12/08
to

You have to be careful of quoted strings -- you could end up with extra
characters.

You also need to be sure that the newline is right after the backslash
and that you DON'T have spaces or tabs between the backslash and the newline.

>
> Thanks alot,
>
> Steve
>

--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
hel...@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk

steve_blah

unread,
Aug 18, 2008, 8:42:50 AM8/18/08
to
On Aug 12, 5:33 am, Ronnie Brunner <ronnie.brun...@netcetera.ch>
wrote:

Ah thanks. That was it.

steve_blah

unread,
Aug 18, 2008, 8:43:03 AM8/18/08
to
On Aug 12, 11:30 am, Robert Heller <hel...@deepsoft.com> wrote:

> At Mon, 11 Aug 2008 19:26:17 -0700 (PDT) steve_blah <srpen...@gmail.com> wrote:
>
>
>
>
>
> > Hey folks,
>
> > I'm using incrementedtcland have been running into problems lately.

> > With many of my procedure calls I was finding that, given long
> > variable names, I was having lines far exceeding 70 characters.  For
> > example:
>
> > set l_danglingRange [generate_expected_key_event_ranges -dangling
> > $i_keyType $i_confHT $i_pressTime $i_releaseTime ]
>
> > Which I try to clean up as:
>
> > set l_danglingRange [generate_expected_key_event_ranges -dangling \
> >                                $i_keyType \
> >                                 $i_confHT \
> >                                $i_pressTime \
> >                                 $i_releaseTime ]
>
> > In some cases I have problems with the '\' version while the other is
> > fine.
>
> > But it seems that the following is OK:
> > set l_stops [ list                                       \
> >                     [ expr { $CLASS_PTI_OFFSET + 1 } ]         \
> >                     [ expr { $CLASS_EVENT_CODE_OFFSET + 3 } ]  \
> >                     [ expr { $CLASS_KEY_CODE_OFFSET + 1 } ]    ]
>
> > Can someone explain or point me to a good reference that can explain
> > when I can and when I can not escape the end of alinein this way?

>
> You have to be careful of quoted strings -- you could end up with extra
> characters.
>
> You also need to be sure that the newline is right after the backslash
> and that you DON'T have spaces or tabs between the backslash and the newline.
>
>
>
> > Thanks alot,
>
> > Steve
>
> --
> Robert Heller             -- Get the Deepwoods Software FireFox Toolbar!
> Deepwoods Software        -- Linux Installation and Administrationhttp://www.deepsoft.com/ -- Web Hosting, with CGI and Database

> hel...@deepsoft.com       -- Contract Programming: C/C++,Tcl/Tk

Thanks, that was it.

0 new messages