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

TCL: pass an object as an argument of a procedure with ActiveTcl 8.6

I'm new to object-oriented programming in TCL. I installed ActiveTCL 8.6 which includes the package TclOO in order to use classes and objects in TCL. I would like to create an object and call various procedures in order to use it. For instance, I…
2
votes
1 answer

What are module-info mode switch statements?

The package Environment Modules defines the module-info mode command. The man page for modulefile lists the possible modes as: load, remove, display, help, whatis, switch, switch1, switch2, or switch3. What are the multiple switch statements?
Pete
  • 10,310
  • 7
  • 53
  • 59
2
votes
1 answer

TCL puts stream: Can I know what stream is? stdout? stderr? file?

For complicated reasons I have to hijack the "puts" routine. I would like to do different things based on what "stream" is proc myPuts { stream msg } { if < stream is stdout > .... elseif < stream is stderr > ... …
user2410881
  • 143
  • 1
  • 7
2
votes
1 answer

Is there a suitable hook for intercepting all POSTs to an OpenACS/AOLServer system?

I'd like to disable all POSTs to an OpenACS/AOLServer installation. Is there an good singular place – a request-hook or wrapper/middleware – to do this? (Bonus points if the intercept can let a few URI patterns or logged-in users through.)
gojomo
  • 52,260
  • 14
  • 86
  • 115
2
votes
3 answers

Remove space from a string

Say I have a string like this: set str "BAT-CAT, DOG,ELEPHANT ,LION & MOUSE-ANT ,MONKEY, DONKEY" Now I want to get STRING as follows: "BAT-CAT,DOG,ELEPHANT,LION&MOUSE-ANT,MONKEY,DONKEY" I am using trim function to remove white space but it is not…
user2901871
  • 219
  • 5
  • 6
  • 10
2
votes
2 answers

add a space every 2 charaters in a string

I have mac addresses in this shape "001122334455" that I want to turn into "00 11 22 33 44 55". I guess there is a way to do this in one line, but the only way I found is the following ridiculously horrible proc. Can someone show me how to do this…
little-dude
  • 1,544
  • 2
  • 17
  • 33
2
votes
2 answers

TCL huddle and strip

How to I construct a huddle structure, in a way that huddle strip generates {a {b}} {c {d}}? For example #create as a dict % set bb [huddle create a b c d] HUDDLE {D {a {s b} c {s d}}} #create as a list % set cc [huddle list e f g h] HUDDLE {L {{s…
user1073494
2
votes
1 answer

TCL: What package forget command actually does?

Can anyone Help me in understanding "package forget" command in TCL . The TCL manual says that package forget ?package package ...? Removes all information about each specified package from this interpreter, including information provided by…
2
votes
1 answer

How to convert 64 bit binary string in to a decimal number in tcl?

I'm trying to convert a 64 bit binary string value () in to an integer but I'm apparently hitting the tcl limit and getting: integer value too large to represent Binary String: 000000000000101000000000000010100000000000000100 The proc I'm using to…
egorulz
  • 1,455
  • 2
  • 17
  • 28
2
votes
2 answers

How to gracefully kill an unresponsive tcl script?

Lets say I have a tcl script which should normally execute in less than a minute - How could I make sure that the script NEVER takes more than 'x' minutes/seconds to execute, and if it does then the script should just be stopped. For example, if the…
egorulz
  • 1,455
  • 2
  • 17
  • 28
2
votes
2 answers

Trying to use tcl threads on windows 7 results in access violation

I'm trying to get this simple program to work on windows, but it crashes: unsigned (__stdcall testfoo)(ClientData x) { return 0; } int main() { Tcl_ThreadId testid = 0; Tcl_CreateThread(&testid, testfoo, (ClientData) NULL,…
Juan
  • 3,667
  • 3
  • 28
  • 32
2
votes
3 answers

How to get whole string after first slash(/) using regexp in tcl

I have been trying to get all the characters after the first slash using regexp in Tcl. What is want is this: abc/def/ghi from the above string i want def/ghi. I tried using the below command, but its only giving ghi set abc [regexp {([^/]*)$}…
user2966788
  • 21
  • 1
  • 2
2
votes
1 answer

tcl/tk complex script support on different platforms

I have been working with Tcl/Tk for a week now and I understood from the documentation that it is supposed to prvoide platform independence, in that, a Tcl/Tk widget will behave the same on Linux and on Windows. Strangely, I had a different…
Duck Dodgers
  • 3,409
  • 8
  • 29
  • 43
2
votes
1 answer

What tcl command returns last evaluated command?

What tcl command returns last evaluated command? I think it should have something like bash history. I have tried this, but it prints empty string. set aaa bbb puts [history info] I have c++ program which create Tcl Interpreter and evaluates…
Ashot
  • 10,807
  • 14
  • 66
  • 117
2
votes
1 answer

Change tag name in XML using Tcl script

I have a XML document like this john Ram Now I want change the tag name "abc" to "name" i.e. john Ram Can anyone tell me how to do this using Tcl…
user2940110
  • 69
  • 2
  • 7