tcl

On tcl tests - how to interpret tcltest::test

不打扰是莪最后的温柔 提交于 2019-12-25 08:36:42
问题 I am looking at the tests in TCL source tree and I see this one in compExpr-old.test: test compExpr-old-14.17 {CompilePrimaryExpr: string primary that looks like var ref} { expr $ } $ It looks wrong to me: the test runs the script expr $ and expects the return value is "$". Is my interpretation right? It cannot be right because expr $ is wrong syntactically. I checked out tcltest.tcl, the definition of tcltest::test is so long, wish someone can help me over here. 回答1: I don't know what

The enums does not get passed to TCL when we have SWIG TCL Static Linking

白昼怎懂夜的黑 提交于 2019-12-25 08:01:33
问题 In continuation to question how to pass enum values from TCL script to C++ class using Swig I have following code 1) File : example.i %module example %{ /* Put header files here or function declarations like below */ #include "example.h" %} %include "example.h" 2 File example.h class myClass { public: enum Type {one,two}; myClass() {} static bool printVal(int val); static bool printEnum(Type val); }; 3) File example.cpp #include "example.h" #include <iostream> using namespace std; bool

Trying to match a text using regexp and foreach

别等时光非礼了梦想. 提交于 2019-12-25 07:31:33
问题 I am using the following code to match a text like cell ("acf12bcjd6") . The values inside the quotes keep changing and I have to capture all of them. The code I used is: foreach searched_data $final { [regexp {cell\(.*\)+} $searched_data match] puts "$match" } But I am getting an error saying "can't reach match, no such variable". I do not understand my mistake. Am I doing it correct? 回答1: Your program is failing because the regexp pattern isn't matching the string, so match isn't being set.

How to store array elements in an Excel Sheet cells with TCL/tcom

北慕城南 提交于 2019-12-25 06:47:49
问题 I want to store array elements in an Excel Sheet. How can I do that? Here is the sample code for an array: for {set i 0} { $i < 3} {incr i} { set color($i) $i } Now how can I store color(0), color(1), color(2) in different cells? Edit: Based on this tcom example I have been trying to store array elements in an Excel Sheet. 回答1: Have a look at the commands array set and array get. for {set i 0} { $i < 3} {incr i} { set color($i) $i } set nvList [array get color] Variable nvList has now the

How to set the maximum size of BWidget's ScrolledWindow?

依然范特西╮ 提交于 2019-12-25 06:47:47
问题 I am using BWidget 's ScrolledWindow in a code like this: toplevel .top set w [ScrolledWindow .top.scrolledWindow] set f [ScrollableFrame $w.scrollableFrame -constrainedwidth true] $w setwidget $f set a [$f getframe] # here goes some stuff in $a So I get a window with vertical scrollbar. When increasing the height of .top , after some moment all the content in $a becomes visible and the scrollbar disappears as it is not needed anymore. How can I forbid further increasing the height of .top ?

Convert expect output from DOS to UNIX style in realtime

本秂侑毒 提交于 2019-12-25 05:32:18
问题 I write some expect scripts by connecting to a remote host through serial connection. My problem is that the output of the spawned process (enabled with log_user 1 ) contains DOS-style endings (each line being terminated with ^M when reading logs in VIM). I normally run dos2unix on all logs at the end of the expect session, to get rid of them. Can the conversion be done in real time? 回答1: It turned out the problem is really simple. What I am doing with my scripts is calling them like below:

display image in tcltk window with R… How?

穿精又带淫゛_ 提交于 2019-12-25 05:24:39
问题 Can anyone tell me how to dislpay an image in a tcltk window ? I found Img package here : sourceforge (1.3 version) but I can't install it manually because of missing 'DESCRIPTION' file. How can I install it ? -> How can I display image on a tcltk window (using Img package or not) ? thank you Config : Windows 7 64 bits, R 3.0.1 回答1: You can use a label for this: w <- tktoplevel() tcl("image","create","photo", "imageID", file="your_image.gif") l <- ttklabel(w, image="imageID", compound="image"

Floating point exception in TCL script

丶灬走出姿态 提交于 2019-12-25 05:09:08
问题 i am using ns2 simulator and tcl script.on executing the following code it has raised floating point exception error. before i have changed the rate values in the following section of the code $ns duplex-link $n0 $n2 2.0Mb 10ms RED $ns duplex-link $n1 $n2 2.0Mb 10ms DropTail $ns duplex-link $n2 $n3 1.1Mb 20ms DropTail $ns duplex-link $n3 $n2 1.2Mb 10ms DropTail it was working correctly but after it has been changed to the following i.e after i have used variables rate02,rate12,rate23,rate32

Floating point exception in TCL script

给你一囗甜甜゛ 提交于 2019-12-25 05:09:03
问题 i am using ns2 simulator and tcl script.on executing the following code it has raised floating point exception error. before i have changed the rate values in the following section of the code $ns duplex-link $n0 $n2 2.0Mb 10ms RED $ns duplex-link $n1 $n2 2.0Mb 10ms DropTail $ns duplex-link $n2 $n3 1.1Mb 20ms DropTail $ns duplex-link $n3 $n2 1.2Mb 10ms DropTail it was working correctly but after it has been changed to the following i.e after i have used variables rate02,rate12,rate23,rate32

SED in TCL/TK and any other equivalent command in TCL

人走茶凉 提交于 2019-12-25 03:48:42
问题 I am trying pass value from TK to cshell script using "procedure call" now.... as follow. proc Run {} { global passedvalue ## to see what value it has for passedvalue puts $passedvalue exec sed -i {s/ABC/$passedvalue/g} runme.sh exec /bin/csh -c ./runme.sh >@stdout 2>@stderr } I am changing a line which has value ABC by new passedvalue. "puts" works and prints the value of passedvalue properly. But it does not work for sed and it gives Error : Program undefined variable Please let me know how