tcl

Regular Expression to find string in Expect buffer

I'm trying to find a regex that works to match a string of escape characters (an Expect response, see this question) and a six digit number (with alpha-numeric first character). Here's the whole string I need to identify: \r\n\u001b[1;14HX76196 Ultimately I need to extract the string: X76196 Here's what I have already: interact...

Receiving a 'BREAK' in tcl 8.5.1 causes COM port to quit working (win xp)

I'm working on a program which makes heavy use of a serial port. It is currently a windows-only program (unfortunately :-), running on Windows XP. The TCL version is 8.5.1.0 - it may or may not be an 'official' TCL, not sure. Everything works perfectly until the device on the other end sends a BREAK (or, just disconnect the serial por...

How do I print out a tcl proc?

Given a simple tcl proc like proc foo {a b} {puts "$a $b"} What tcl command can I use to print out the procedure foo ... that is I want the TEXT of the proc back ... For instance: % proc foo {a b} {puts "$a $b"} % foo a b a b % puts $foo can't read "foo": no such variable ... um how do I get "foo {a b} {puts "$a $b"}" back? T...

Problem with tk_messageBox during Tcl/Tk initialization script.

With the following Tcl script, the entry widget will not accept input. It appears but is unresponsive. pack [entry .a] -padx 15 -pady 15 tk_messageBox -message {test} If I comment out the tk_messageBox line, then the entry widgets works fine. What causes this behavior and how do I fix it? I'm using Tcl/Tk 8.5.2 on Windows. To clarif...

How do you save and parse a command output in Expect?

Hi, I am half-way through writing an Expect script on a Linux server which is supposed to telnet to a router in order to collect some system information. So far my script can successfully make the connection, run a router command, disconnect and terminate. The command displays a few lines which I need to parse, something I am not sure...

Alternate implementation of TCL's keyed list which does not have to be compiled ?

Hi, I need to use keyed lists with TCL, but have the option of only copying tcl code to the device. The default method is to use TclX, but this requires compilation. Is there any implementation of keyed list functions (keylset, keylget) which is available as a "standalone" library (i.e. pure tcl)? ...

Handling numbers with leading zeros in Tcl

I am having trouble in Tcl using numbers with leading zeros. I am parsing some numbers that can have leading zeros, such as "0012", which should be interpreted as the integer "twelve". $ tclsh % set a 8 8 % set b 08 08 % expr $a - 1 7 % expr $b - 1 expected integer but got "08" (looks like invalid octal number) What is the best way ...

Why does not the Python MSI installers come with Tcl/Tk header files?

The MSI installers downloadable from python.org does not include Tcl/Tk header (not source) files (that are required to compile some packages like matplotlib). Does anyone know of the rationale behind not including them? ...

What is the state of C10K-like event-based server development in TCL?

TCL is a nice simple programming language, but does not seem to get the credit and/or respect it deserves [1]. I learned it back in 1995 in college and promptly forgot about it only to stumble upon it again recently. I am mostly interested TCL for developing TCP-based network services as well as for web development. It has been ment...

Understanding Tcl Polymorphism

In Tcl a variable and a procs can have the same name ... for instance I can have set container(alist) {} proc container a {puts " do something"} Um ... what other forms of polymorphism exist in tcl? ... I am looking at some code and I see stuff like this. ...

getting dependent modules (shared objects) for a binary

I have a binary file on linux .. tclsh8.4. It depends on certain tcl*.so files. Is there a way to get this information from the binary file itself? The tcl*.so files on which the binary tclsh8.4 depends is in some other directory having limited permission. What should I do to the binary file in order to use the same .so files from so...

tcl curly braces

hi I'm learning Tcl/Tk and am confused on the usage of curly braces in tcl. To me it seems to be used to both indicate scope and declare strings! Is this a bug(or feature)? Is my interpretation correct? ...

stack trace info in errorInfo in Tcl

If using Tcl in interactive mode , in which I input the following: set list {1 2 3 4 5} set sum 0 foreach el $list { set sum [expr $sum + $element] } it will show a piece of very terse info: can't read "element": no such variable but when I use puts $errorInfo it wil show: can't read "element": no such variable while...

Tcl: Setting a private variable of an owned instance within a class

Suppose the following code declarations: itcl::class ObjectA { private variable m_ownedObject private variable m_someVariable constructor {} \ { set m_ownedObject [ObjectA #auto] } protected method SetSomeVariable {newVal} { set m_someVariable $newVal } public method SomeMethod{} { $m_o...

tclsoap and ssl

Can anyone provide a working example of using tclSOAP with SSL? The links referred to in the official docs aren't working http://tclsoap.sourceforge.net I'm unsure how to configure the transport protocol. ...

Force upper case input in Tcl/Tk entry field

I've got a Tcl/Tk window with an entry box in which I'd like to force upper case character entry. That is, if any letters are typed I'd like them to appear in upper case in the entry field, instead of simply rejecting any lowercase input. I've looked at the documentation for entry and the Entry Validation page on the Tcl/Tk wiki, but I ...

How I can get sorted list in way of nearer matching in Tcl/tk?

Hi, which sorting algorithm can be used to get nearer and aproximate matching list with given string input: 1. list of strings 2. tobesearch_str ...

tcl dual array correspondance

I just found myself in a position where I have two arrays in TCL/TK. I'm given $W_Array and $P_Array I need to traverse through one array not knowing what the size of each one is before hand, and execute a command only when there is a value for both arrays. Yes the array lengths could be different. What is the best way of doing this?...

What is the status of tcl_precision?

I don't use Tcl in my daily work. However, I have a colleague who occasionally interacts with a customer who wishes our tool's extension language worked more like Tcl (!). One topic he brought up was how Tcl let him set how much precision was stored in a double, via a global variable, tcl_precision. I did some web searches, and the docu...

How do I create a timeout for user input in TCL ?

I have a large TCL script that, at points asks the user questions like, "Please enter your choice : A, B or C ?" The user has to type in the character and press "Enter" to continue to script. Is there anyway I can automate this in TCL? Something like, if the user doesn't enter anything within 10 seconds, by default option A will be take...