Questions tagged [tcl]

Tool Command Language was invented by John Ousterhout as a way to make it easy to write little languages for configuring EDA tools, but it has grown far beyond those humble beginnings to become a general scripting language with built-in asynchronous I/O and Unicode strings while supporting paradigms such as object-oriented programming and coroutines.

Tool Command Language was invented by John Ousterhout as a way to make it easy to write little languages for configuring EDA tools, but it has grown far beyond those humble beginnings to become a general scripting language with built-in asynchronous I/O and Unicode strings while supporting paradigms such as object-oriented programming and coroutines. See the Wikipedia page for Tcl for more information.

The current recommended production release of Tcl is Tcl/Tk 8.6.13 (Nov 22, 2022).

Previous versions of the language are currently relatively common. Tcl 8.5 is widely deployed (current patch version 8.5.18). As is Tcl 8.4 in more conservative deployments (8.4.20 is current, but end-of-lifed there). Use of Tcl 8.4 or earlier is usually not recommended, as it does not receive security-fix support from the Tcl developers.

Naming

You may write the language name as either TCL or Tcl; practitioners tend to prefer the latter on the grounds that it means they don't have to hold the shift key down so long. For pronunciation purposes, either “tee cee ell” or “tickle” are acceptable, depending on audience.

Resources

Questions:

Books:

Websites:

7879 questions
2
votes
1 answer

Using TCL eval command with "set"

Here is the code I am testing: proc check_eval {} { set cmd {set return_val {}; set return_val} puts "Command to evaluate : $cmd" uplevel eval $cmd } I encountered the following problem: when I am calling "check_eval", it looks like the…
mkostya
  • 922
  • 3
  • 10
  • 14
2
votes
3 answers

How can i subtract one list from another list and check the a pattern is in sequence?

Suppose if i have a big list which looks like : A ab1 ab2 ab3 ab5 ab6 ac1 ac2 ac3 ac4 ac5 ac6 ac7 ac8 ac9 xy1 xy2 xy3 xy4 xy5 xy6 xy7 xy8 xy9 xy10 xy11 and B ac1 ac4 ac5 ac6 ac7 ac8 xy2 xy3 xy4 xy5 xy6 after doing A - B pattern becomes like…
munish
  • 4,505
  • 14
  • 53
  • 83
2
votes
2 answers

Is there a "native" way to convert from numbers to dB in Tcl

dB or decibel is a unit that is used to show ratio in logarithmic scale, and specifecly, the definition of dB that I'm interested in is X(dB) = 20log(x) where x is the "normal" value, and X(dB) is the value in dB. When wrote a code converted between…
SIMEL
  • 8,745
  • 28
  • 84
  • 130
2
votes
2 answers

how to create log file for tcl script

I am running Tcl script for connecting Telnet port. For this script I want to store all the CMD output in a log file. how to do this in Tcl script? Script as below: #!/usr/bin/expect -f #!usr/bin/expect package require Expect spawn telnet…
Piyush
  • 5,145
  • 16
  • 49
  • 71
2
votes
1 answer

Case matching regexp

I have been wondering about a regexp matching pattern in Tcl for some time and I've remained stumped as to how it was working. I'm using Wish and Tcl/Tk 8.5 by the way. I have a random string MmmasidhmMm stored in $line and the code I have is: while…
Jerry
  • 70,495
  • 13
  • 100
  • 144
2
votes
3 answers

Importing proc variable into namespace

proc foo {param} { namespace eval foo_ns { uplevel {set foo_ns::x $param } } } This just looks ugly. [upvar] will not work, because it can't link to 'param'. Thanks. Code from answers does not work…
name
  • 5,095
  • 5
  • 27
  • 36
2
votes
4 answers

Read wrapped line

I have a file with wrapped lines. It happens to be TCL code that wraps multiple lines. (but it could be anything that as rule of line wrapping.) like : set long [ some cmd { some long stuff \ more stuff \ even more stuff \ end of cmd} but…
Gert Gottschalk
  • 1,658
  • 3
  • 25
  • 37
2
votes
2 answers

log all trace info during a debug session in eclipse

I would like to log all the debug information on each step (to crunch all these data later) of a debugging session, such as the name of the method called, the parameter value, all the variables values, etc. Is there any option that enables this?…
user1073494
2
votes
1 answer

Label inside a frame won't align the same

So I'm making an interface using TCL/TK and I'm having a weird issue, pictured below. The two frames on the left (colored red) are made in the same way. The labels should be stickying to the e and w but as you can see the frame under the first one…
Leo
  • 500
  • 5
  • 15
2
votes
2 answers

tcl getting a regexp match when iterating over items in a list

I am a newbie, and I'm having some trouble getting my tcl script working. I've searched around online, and can't seem to understand what I'm doing wrong. Here is what I wrote: set list {f01-1 f01-2 f02-1 m01-1 m01-2 m02-1} foreach item $list { …
KaleidoEscape
  • 115
  • 1
  • 13
2
votes
2 answers

absolute value in TCL

What is the function to get absolute value of a expr statement. For example expr [$a - $b ]. Now the solution can be -ve or +positive number. But I want the +ve value out. I want to use it like if { |$diff_a| > 0 & |$diff_b| >0 } { .... Im using tcl…
user2095095
  • 31
  • 1
  • 3
  • 5
2
votes
1 answer

TCL Client hangs when I send "invalid command" to python server

I have a python server and a TCL client in my setup both running on the same machine using port 8020. I basically have some functions implemented in python server to perform some operations. And I am trying to add some exception handling in the…
san802k
  • 23
  • 6
2
votes
1 answer

Scrolling canvas

This is probably something really basic as a tcl/tk newbie, but I've spent all day on it and have no idea where I'm going wrong: I'm teaching myself from a mix of code I've been given (which probably isn't very well written), and the main tcl/tk…
ChrisW
  • 4,970
  • 7
  • 55
  • 92
2
votes
3 answers

non-case-sensitive version of file exists command

Well, not sure what to do in this regard. A little while ago I modified a logging script for an eggdrop bot.. but now an issue unfolds that for some reason, it is logging actions/text in separate files because of an issue of character case. …
Daedalus
  • 7,586
  • 5
  • 36
  • 61
2
votes
1 answer

Can doxygen extract protection levels from itcl class members?

I am trying to use doxygen to document my itcl code (version 1.8.2). However, it seems to miss the protection levels (public/protected/private). In addition, it lumps common variables in with instance variables, labelling all as static (only…
Mark Armstrong
  • 440
  • 1
  • 3
  • 11