Showing posts with label Tcl/Expect. Show all posts
Showing posts with label Tcl/Expect. Show all posts

2010-04-10

[iBook G4 / Mac OS X 10.4] Compile expect 5.44.1.15 againt Tcl 8.5.8 without Tk

  • Compile tcl-8.5.8:
  • $ ./configure ...
    $ make
    $ sudo make install
    $ sudo make install-private-headers
  • Compile expect-5.44.1.15:
    • Follow instructions of this post.
    • OSX has no ldconfig and /etc/ld.so.conf. To run the compiled expect, first export DYLD_LIBRARY_PATH=/usr/local/expect-5.44.1.15/lib/expect5.44.1.15. Man dyld for more details.

2009-04-27

Tclreadline

The tclreadline package makes the GNU Readline library available for interactive tcl shells. This includes history expansion and file/command completion. Command completion for all tcl/tk commands is provided and commmand completers for user defined commands can be easily added. tclreadline can also be used for tcl scripts which want to use a shell like input interface. In this case the ::tclreadline::readline read command has to be called explicitly.

SEE ALSO: Pure-Tcl Readline, Pure-Tcl Readline (2)

2009-04-16

Use rlwrap to add readline support to tclsh

rlwrap [1] is a GNU readline wrapper. it adds readline editing and command history to any command line app.To use it with tclsh, start tclsh with:

$ rlwrap tclsh
Useful options are -c (file name completion) and -f (add words from a file to the completion list).To use rlwrap with tclsh with file name completion type:
$ rlwrap -c tclsh
It would be nice to have a file of all words used in Tcl: commands and subcommands to set rlwrap up using the -f option.info commands and info procs could help with that. Maybe there are some *.syn files out there to provide such a database.

2009-04-13

Compile Expect 5.44.1.11 on Fedora 3

  • Checkout expect from Sourceforge.net
  • Open configure.in, comment out following lines:
    TEA_PATH_TKCONFIG
    TEA_LOAD_TKCONFIG
    TEA_PUBLIC_TK_HEADERS
  • Open Makefile.in:
  1. Remove expectk from var in_BINARIES
  2. Remove @TK_INCLUDES@ from var INCLUDES
  3. Remove @TK_LIB_SPEC@ and @TK_LIBS@
  • $ autoreconf -fiv
  • $ ./configure --prefix=/usr/local/expect-5.44 --exec-prefix=/usr/local/expect-5.44 --with-tcl=/usr/lib --with-tclinclude=/usr/include/tcl-private
  • $ make && make install
  • Open /etc/ld.so.conf, add one line: /usr/local/expect-5.44/lib/expect5.44.1.11
  • $ ldconfig
  • $ /usr/local/expect-5.44/bin/expect -v

Expectk

This is a stand alone interpreter which is the basic equivalent of

 #! /usr/bin/tclsh
package require Expect
package require Tk
Note that this interpreter is not intended to interact with Tk applications - instead, it is intended to allow one to write Tk applications that invoke expect in the background. This allows one to have a GUI interface to gather inputs, etc.

2009-04-11

About expect 5.44

http://expect.nist.gov/ was the original home Web site for Expect. It supplies sources and considerable history, background, and instruction. It does fail to mention, though, recognition [1] of Expect as one of the 100 most important publications of NIST's [2] first century. Note that the warning regarding expect 5.44 on that page is seriously out of date. The CVS 5.44 version linked to below is fine (and needed to build against Tcl 8.5).

The current maintenance of the package can be found at http://expect.sf.net/ , with access to the CVS available via sf.net's cvs repository. Note that the link (on the sf.net primary page) for the CVS repository is out of date; visit http://sf.net/projects/expect/ and use the link there to look at the cvs repository from your web browser.

This package is part of the ActiveTcl Batteries Included distribution on unix and as of 2005, the Windows version is available via ActiveTcl as well [3].

2008-08-29

Expect 5.43 takes quite long when exiting

Expect 5.43 的 script 结束时总是很慢, 用 expect -d 发现最后有条 message:

write() failed to write anything - will sleep(1) and retry...
查了下 code, 在 exp_chan.c : ExpOutputProc() 中有个 sleep(1), 把它换成 usleep(10 * 1000) 就好了.

2008-07-08

Interactive Tclsh: auto_noexec

If set to any value, then unknown will not attempt to auto-exec any commands.

SEE ALSO: auto_execok(n)

2008-06-28

`expect -D 1' works for 5.41

Expect 5.42.1 和 5.43 的 -D 1 参数一直不能正常工作, 郁闷很久, 找了一个 5.41 编译了一下, 却是好的, 看来是 5.41 之后的修改有问题吧.

2008-02-19

Compiling Expect 5.43 on Ubuntu 6.06

  • $ apt-get install tcl8.4-dev
  • $ wget http://expect.nist.gov/expect.tar.gz
  • $ tar -xzf ...
  • $ ./configure --prefix=... --with-tcl=/usr/lib/tcl8.4 --with-tclinclude=/usr/include/tcl8.4/tcl-private
  • $ make
  • $ make install

2008-02-06

MacPorts upgraded

今天升级 MacPorts 到 1.6 了, 同时发现 Tcl 8.5 release 了, Subversion 也有 1.4.6 了.

Changes in Tcl 8.5

2007-10-08

How to call Expect's commands in Tcl?

#!/usr/bin/tclsh

package require Expect

...
expect's commands
...

2007-08-21

SWIG: Simplified Wrapper and Interface Generator

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, PHP, Python, Tcl, Ruby and PHP. The list of supported languages also includes non-scripting languages such as C#, Common Lisp (CLISP, Allegro CL, CFFI, UFFI), Java, Modula-3 and OCAML. Also several interpreted and compiled Scheme implementations (Guile, MzScheme, Chicken) are supported. SWIG is most commonly used to create high-level interpreted or compiled programming environments, user interfaces, and as a tool for testing and prototyping C/C++ software. SWIG can also export its parse tree in the form of XML and Lisp s-expressions. SWIG may be freely used, distributed, and modified for commercial and non-commercial use.

2007-07-04

MacPorts: Installed ports

autoconf
automake
bash
cmake
colordiff
expect
findutils
gawk
gnutar
gsed
lftp
libtool
subversion
tcl
vim
watch
wget
wireshark

2007-04-30

Compiling Expect: Can't find Tcl private headers

Expect is looking for tclInt.h which is one of Tcl's private headers. Tcl doesn't install this by default, so Expect tries to find it in Tcl's source or build directory. To explain where that directory is, use the --with-tclinclude flag when running Expect's configure.

If someone (your vendor, for example) has supplied you with Tcl but without providing tclInt.h, get a source distribution and install it yourself (or get a binary distribution that includes the private headers).

-- Expect FAQ

Expect-5.42.1's bug?

ubuntu 6.06 上用 expect-5.42.1 写了一个 ssh 到远程 server 上的 script, ssh 上去之后, 执行 `find /' 时永远终止不了, 屏幕一直有输出, 并且输出的内容是循环的. 又测试了一下, 发现如果远程 server 上瞬间输出大量信息时总是会引起这种情况. 一开始还怀疑是我的 script 有问题, 后来发现 `find /' 进程其实早已退出, 看样子是 expect 内部出现了一个 infinite loop. 到 expect 网站上下载了一个最新的 5.43.0 版本编译安装后没有这个问题, 看来是 5.42.1 的一个 bug.