- 授权协议: BSD
- 开发语言:
- 操作系统: 跨平台
- 软件首页: http://www.tcl.tk/
- 软件文档: http://www.tcl.tk/doc/
软件介绍
Tcl(最早称为“工具命令语言”"Tool Command Language",但是目前已经不是这个含义,不过我们仍然称呼它为TCL)是一种 脚本语言。由John Ousterhout创建。 TCL很好学,功能很强大。TCL经常被用于快速原型开发,脚本编程,GUI和测试等方面。TCL念作“踢叩”(tickle)。Tcl的特性包括:
- 任何东西都是一条命令,包括语法结构(for,if等)。
- 任何事物都可以重新定义和重载。
- 所有的数据类型都可以看作字符串。
- 语法规则相当简单。
- 提供事件驱动给Socket和文件。基于时间或者用户定义的事件也可以。
- 动态的域定义。
- 很容易用C, C++,或者Java扩展。
- 解释语言,代码能够动态的改变。
- 完全的Unicode支持。
- 平台无关。Win32,UNIX,Mac 上都可以跑。
- 和Windows的GUI紧密集成。Tk
- 代码紧凑,易于维护。
TCL本身在 8.6 以后提供面向对象的支持。因为语言本身很容易扩展到支持面向对象,所以在8.6之前存在许多C语言扩展提供面向对象能力,包括XOTcl, Incr Tcl 等。另外SNIT扩展本身就是用TCL写的。
使用最广泛的TCL扩展是TK。 TK提供了各种OS平台下的图形用户界面GUI。连强大的Python语言都不单独提供自己的GUI,而是提供接口适配到TK上。 另一个流行的扩展包是Expect. Expect提供了通过终端自动执行命令的能力,例如(passwd, ftp, telnet等命令驱动的外壳).
Tcl 支援扩充套件,这些扩充套件提供了额外的功能(像是 GUI,自动化,数据库存取等)。
下面是一些 Tcl 扩充套件的列表:
- tclodbc
- mk4tcl
- sqlite
- Pgtcl, pgintcl
- mysqltcl, msqltcl
- AdabasTcl
- FBSQL
- ibtcl
- Oratcl
- Sybtcl
- db2tcl
示例代码:
#!/bin/sh
# next line restarts using tclsh in path \
exec tclsh $0 ${1+"$@"}
# echo server that can handle multiple
# simultaneous connections.
proc newConnection { sock addr port } {
# client connections will be handled in
# line-buffered, non-blocking mode
fconfigure $sock -blocking no -buffering line
# call handleData when socket is readable
fileevent $sock readable [ list handleData $sock ]
}
proc handleData { sock } {
puts $sock [ gets $sock ]
if { [ eof $sock ] } {
close $sock
}
}
# handle all connections to port given
# as argument when server was invoked
# by calling newConnection
set port [ lindex $argv 0 ]
socket -server newConnection $port
# enter the event loop by waiting
# on a dummy variable that is otherwise
# unused.
vwait forever
Agile Web Development with Rails, Third Edition
Sam Ruby、Dave Thomas、David Heinemeier Hansson / Pragmatic Bookshelf / 2009-03-17 / USD 43.95
Rails just keeps on changing. Rails 2, released in 2008, brings hundreds of improvements, including new support for RESTful applications, new generator options, and so on. And, as importantly, we’ve a......一起来看看 《Agile Web Development with Rails, Third Edition》 这本书的介绍吧!
