~ Office Supplies ~~ Buy Posters ~~ A-Z Products ~~ Website Advertising


Tcl - Wikipedia

<<Up     Contents

Tcl

Tcl (originally from "Tool Command Language", but nonetheless usually lowercased) is a scripting language created by John Ousterhout that is generally thought to be easy to learn, but powerful in the right hands. It is most commonly used for rapid prototyping, scripted applications, GUIs and testing. The name is commonly pronounced as "tickle". It has some rather unique features:

While Tcl itself does not provide an object oriented framework the language itself can be extended to provide new features as required. Indeed, many C extensions exist that provide OO functionality, including the powerful XOTcl[?] and more traditional incr Tcl. Some Tcl-based OO extensions also exist.

The most famous extension is the Tk toolkit which allows one to write portable graphical user interfaces for a variety of operating systems.

A simple example, demonstrating event-based computing, follows.


# Simple echo-server that can handle multiple connections.

# This procedure is called when a client connects to the server
proc newConnection {sock addr port} {
    fconfigure $sock -blocking no -buffering line

    # handleData should be called with $sock as the parameter when data can
    # be read from the socket
    fileevent $sock readable "handleData $sock"

    return
}


proc handleData {sock} {
    set line [gets $sock]
    if {($line == "") && [eof $sock]} {
	close $sock
    } else {
	puts $sock $line
    }

    return
}


socket -server newConnection 20000
vwait forever

Another example using Tk (from A simple A/D clock (http://mini.net/tcl/2563.html)) and timer events, a digital clock in six lines of code:
 proc every {ms body} {
     eval $body
     after $ms [list every $ms $body]
 }
 pack [label .clock -textvar time]
 every 1000 {set ::time [clock format [clock sec] -format %H:%M:%S]} ;# RS

External links:

wikipedia.org dumped 2003-03-17 with terodump




 
 
Dendritic Pink Peru OPAL jewel tumble polished jewelry gemstone single gorgeous PRETTY NICE peruvian
 Dendritic Pink Peru OPAL jewel tumble polished jewelry single gorgeous PRETTY NICE peruvian 
 
14 gram unique patterned golden brown ARAGONITE Cab cabbing jewelry wirewrap rough tumble polished
 14 gram unique patterned golden brown ARAGONITE Cab cabbing jewelry wirewrap tumble polished 
 
6 carat Golden canary yellow SCAPOLITE gem stone Facet rough gemstone Faceting gems jewel crystal 3
 6 carat Golden canary yellow SCAPOLITE ing jewel crystal 3 
 
8 gram orange Calcite or Aventurine Quartz gem stone Tumble polished cab cabbing rough 43 carat ct
 8 gram orange Calcite or Aventurine Quartz Tumble polished cab cabbing 43 carat ct 
 
8 carat Picasso Jasper gem stones Polished rectangle blocks Cabbing cab cabochon rough gemstones
 8 carat Picasso Jasper Polished rectangle blocks Cabbing cab cabochon