Tcl Manual

Tcl Manual

Alphabetical indices · Keywords
General · Tcl Built-In Commands · String Handling · List Handling · Dictionary Handling · Math · Control Constructs · Variables and Procedures · Input and Output · Packages and Source files · Interpreter Routines · Library Procedures · System Related · Platform-specific · Tcl C Procedures · Initialization · Utilities · Namespaces · Input and Output · The Event Loop · Objects · Invoking the Interpreter · Resource Limits · Commands · Variables · Operating System Interface

General

Tcl_DumpActiveMemory - Validated memory allocation interface
Tcl_StandardChannels - How the Tcl library deals with the standard channels
TCL_MEM_DEBUG - Compile-time flag to enable Tcl memory debugging
Tcl - Tool Command Language
filename - File name conventions supported by Tcl commands
library - standard library of Tcl procedures
Safe Base - A mechanism for creating and manipulating safe interpreters
tclsh - Simple shell containing Tcl interpreter
tcltest - Test harness support code and utilities
tclvars - Variables used by Tcl

Tcl Built-In Commands

String Handling

append - Append to variable
binary - Insert and extract fields from binary strings
encoding - Manipulate encodings
format - Format a string in the style of sprintf
re_syntax - Syntax of Tcl regular expressions
regexp - Match a regular expression against a string
regsub - Perform substitutions based on regular expression pattern matching
scan - Parse string using conversion specifiers in the style of sscanf
string - Manipulate strings
subst - Perform backslash, command, and variable substitutions

List Handling

concat - Join lists together
join - Create a string by joining together list elements
lappend - Append list elements onto a variable
lassign - Assign list elements to variables
lindex - Retrieve an element from a list
linsert - Insert elements into a list
list - Create a list
llength - Count the number of elements in a list
lrange - Return one or more adjacent elements from a list
lrepeat - Build a list by repeating elements
lreplace - Replace elements in a list with new elements
lreverse - Reverse the order of a list
lsearch - See if a list contains a particular element
lset - Change an element in a list
lsort - Sort the elements of a list
split - Split a string into a proper Tcl list

Dictionary Handling

dict - Manipulate dictionaries

Math

expr - Evaluate an expression
mathfunc - Mathematical functions for Tcl expressions
mathop - Mathematical operators as Tcl commands

Control Constructs

after - Execute a command after a time delay
break - Abort looping command
catch - Evaluate script and trap exceptional returns
continue - Skip to the next iteration of a loop
error - Generate an error
eval - Evaluate a Tcl script
for - 'For' loop
foreach - Iterate over all elements in one or more lists
if - Execute scripts conditionally
return - Return from a procedure, or set return code of a script
switch - Evaluate one of several scripts, depending on a given value
update - Process pending events and idle callbacks
uplevel - Execute a script in a different stack frame
vwait - Process events until a variable is written
while - Execute script repeatedly as long as a condition is met

Variables and Procedures

apply - Apply an anonymous function
array - Manipulate array variables
global - Access global variables
incr - Increment the value of a variable
namespace - create and manipulate contexts for commands and variables
proc - Create a Tcl procedure
rename - Rename or delete a command
set - Read and write variables
trace - Monitor variable accesses, command usages and command executions
unset - Delete variables
upvar - Create link to variable in a different stack frame
variable - create and initialize a namespace variable

Input and Output

chan - Read, write and manipulate channels
close - Close an open channel
eof - Check for end of file condition on channel
fblocked - Test whether the last input operation exhausted all available input
fconfigure - Set and get options on a channel
fcopy - Copy data from one channel to another
file - Manipulate file names and attributes
fileevent - Execute a script when a channel becomes readable or writable
flush - Flush buffered output for a channel
gets - Read a line from a channel
open - Open a file-based or command pipeline channel
puts - Write to a channel
read - Read from a channel
refchan - Command handler API of reflected channels, version 1
seek - Change the access position for an open channel
socket - Open a TCP network connection
tell - Return current access position for an open channel

Packages and Source files

load - Load machine code and initialize new commands
loadTk - Load Tk into a safe interpreter.
package - Facilities for package loading and version control
pkg::create - Construct an appropriate 'package ifneeded' command for a given package specification
pkg_mkIndex - Build an index for automatic loading of packages
source - Evaluate a file or resource as a Tcl script
tm - Facilities for locating and loading of Tcl Modules
unload - Unload machine code

Interpreter Routines

bgerror - Command invoked to process background errors
history - Manipulate the history list
info - Return information about the state of the Tcl interpreter
interp - Create and manipulate Tcl interpreters
memory - Control Tcl memory debugging capabilities
unknown - Handle attempts to use non-existent commands

Library Procedures

http - Client-side implementation of the HTTP/1.1 protocol
msgcat - Tcl message catalog
platform - System identification support code and utilities
platform::shell - System identification support code and utilities

System Related

cd - Change working directory
clock - Obtain and manipulate dates and times
exec - Invoke subprocesses
exit - End the application
glob - Return names of files that match patterns
pid - Retrieve process identifiers
pwd - Return the absolute path of the current working directory
time - Time the execution of a script

Platform-specific

dde - Execute a Dynamic Data Exchange command
registry - Manipulate the Windows registry

Tcl C Procedures

Initialization

Tcl_AppInit - perform application-specific initialization
Tcl_CallWhenDeleted - Arrange for callback when interpreter is deleted
Tcl_CreateInterp - create and delete Tcl command interpreters
Tcl_CreateSlave - manage multiple Tcl interpreters, aliases and hidden commands
Tcl_Exit - end the application or thread (and invoke exit handlers)
Tcl_FindExecutable - identify or return the name of the binary file containing the application
Tcl_GetVersion - get the version of the library at runtime
Tcl_Init - find and source initialization script
Tcl_InitStubs - initialize the Tcl stubs mechanism
Tcl_Interp - client-visible fields of interpreter structures
Tcl_PkgRequire - package version control
Tcl_SourceRCFile - source the Tcl rc file
Tcl_StaticPackage - make a statically linked package available via the 'load' command
Tcl_Main - main program and event loop definition for Tcl-based applications

Utilities

Tcl_Alloc - allocate or free heap memory
Tcl_SetAssocData - manage associations of string keys and user specified data with Tcl interpreters
Tcl_Concat - concatenate a collection of strings
Tcl_DString - manipulate dynamic strings
Tcl_GetEncoding - procedures for creating and using encodings
Tcl_GetIndexFromObj - lookup string in table of keywords
Tcl_GetInt - convert from string to integer, double, or boolean
Tcl_InitHashTable - procedures to manage hash tables
Tcl_Preserve - avoid freeing storage while it is being used
Tcl_PrintDouble - Convert floating value to string
Tcl_RegisterConfig - procedures to register embedded configuration information
Tcl_RegExpMatch - Pattern matching with regular expressions
Tcl_SetChannelError - functions to create/intercept Tcl errors by channel drivers.
Tcl_SplitList - manipulate Tcl lists
Tcl_SplitPath - manipulate platform-dependent file paths
Tcl_StringMatch - test whether a string matches a pattern
Tcl_UtfToUpper - routines for manipulating the case of Unicode characters and UTF-8 strings
Tcl_UniCharIsAlpha - routines for classification of Tcl_UniChar characters
Utf - routines for manipulating UTF-8 strings
Tcl_WrongNumArgs - generate standard error message for wrong number of arguments

Namespaces

Tcl_AppendExportList - manipulate namespaces

Input and Output

Tcl_StackChannel - manipulate stacked I/O channels
Tcl_CreateChannel - procedures for creating and manipulating channels
Tcl_CreateChannelHandler - call a procedure when a channel becomes readable or writable
Tcl_CreateCloseHandler - arrange for callbacks when channels are closed
Tcl_CreateFileHandler - associate procedure callbacks with files or devices (Unix only)
Tcl_FSRegister - procedures to interact with any filesystem
Tcl_GetOpenFile - Return a FILE* for a channel registered in the given interpreter (Unix only)
Tcl_GetStdChannel - procedures for retrieving and replacing the standard channels
Tcl_OpenFileChannel - buffered I/O facilities using channels
Tcl_OpenTcpClient - procedures to open channels using TCP sockets

The Event Loop

Tcl_AsyncCreate - handle asynchronous events
Tcl_CreateTimerHandler - call a procedure at a given time
Tcl_DoOneEvent - wait for events and invoke event handlers
Tcl_DoWhenIdle - invoke a procedure when there are no pending events
Notifier - the event queue and notifier interfaces
Tcl_Sleep - delay execution for a given number of milliseconds
Thread - Tcl thread support

Objects

Tcl_BooleanObj - store/retrieve boolean value in a Tcl_Obj
Tcl_ByteArrayObj - manipulate Tcl objects as a arrays of bytes
Tcl_DictObj - manipulate Tcl objects as dictionaries
Tcl_DoubleObj - manipulate Tcl objects as floating-point values
Tcl_IntObj - manipulate Tcl objects as integer values
Tcl_ListObj - manipulate Tcl objects as lists
Tcl_NewObj - manipulate Tcl objects
Tcl_RegisterObjType - manipulate Tcl object types
Tcl_StringObj - manipulate Tcl objects as strings

Invoking the Interpreter

Tcl_AllowExceptions - allow all exceptions in next script evaluation
Tcl_Backslash - parse a backslash sequence
Tcl_CommandComplete - Check for unmatched braces in a Tcl command
Tcl_CreateEnsemble - manipulate ensemble commands
Tcl_Eval - execute Tcl scripts
Tcl_ExprLong - evaluate an expression
Tcl_ExprLongObj - evaluate an expression
Tcl_ParseCommand - parse Tcl scripts and expressions
Tcl_RecordAndEvalObj - save command on history list before evaluating
Tcl_RecordAndEval - save command on history list before evaluating
Tcl_SetRecursionLimit - set maximum allowable nesting depth in interpreter
Tcl_SubstObj - perform substitutions on Tcl objects

Resource Limits

Tcl_LimitAddHandler - manage and check resource limits on interpreters

Commands

Tcl_AddErrorInfo - retrieve or record information about errors and other return options
Tcl_BackgroundError - report Tcl error that occurred in background processing
Tcl_CreateCommand - implement new commands in C
Tcl_CreateMathFunc - Define, query and enumerate math functions for expressions
Tcl_CreateObjCommand - implement new commands in C
Tcl_Panic - report fatal error and abort
Tcl_SaveResult - save and restore an interpreter's state
Tcl_SetErrno - manipulate errno to store and retrieve error codes
Tcl_SetResult - manipulate Tcl result

Variables

Tcl_CreateTrace - arrange for command execution to be traced
Tcl_LinkVar - link Tcl variable to C variable
Tcl_SetVar - manipulate Tcl variables
Tcl_TraceCommand - monitor renames and deletes of a command
Tcl_TraceVar - monitor accesses to a variable
Tcl_UpVar - link one variable to another

Operating System Interface

Tcl_Access - check file permissions and other attributes
Tcl_DetachPids - manage child processes in background
Tcl_PutEnv - procedures to manipulate the environment
Tcl_GetCwd - manipulate the current working directory
Tcl_GetHostName - get the name of the local host
Tcl_GetTime - get date and time
Tcl_SignalId - Convert signal codes
Tcl_TranslateFileName - convert file name to native form and replace tilde with home directory

Copyright © 1989-1994 The Regents of the University of California.
Copyright © 1990-1994 The Regents of the University of California
Copyright © 1992-1999 Karl Lehenbauer and Mark Diekhans
Copyright © 1992-1999 Karl Lehenbauer and Mark Diekhans.
Copyright © 1993-1997 Bell Labs Innovations for Lucent Technologies
Copyright © 1994 The Australian National University
Copyright © 1994-2000 Sun Microsystems, Inc.
Copyright © 1997-2000 Ajuba Solutions.
Copyright © 1997-2000 Scriptics Corporation.
Copyright © 1998 Mark Harrison.
Copyright © 1998-1999 Scriptics Corporation
Copyright © 1998-1999 Scriptics Corportation
Copyright © 1995-1997 Roger E. Critchlow Jr.