DOC PREVIEW
GT AE 6382 - Tcl and the Tk Toolkit

This preview shows page 1-2-3-4-5-6-7-8-9-67-68-69-70-71-72-73-74-75-76-134-135-136-137-138-139-140-141-142 out of 142 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 142 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Tcl and the Tk ToolkitJohn K. OusterhoutComputer Science DivisionDepartment of Electrical Engineering and Computer SciencesUniversity of CaliforniaBerkeley, CA 94720Copyright © 1993 Addison-Wesley Publishing Company, Inc.All rights reserved. Duplication of this draft is permitted by individuals for personaluse only. Any other form of duplication or reproduction requires prior written permis-sion of the author or publisher. This statement must be easily visible on the first pageof any reproduced copies. The publisher does not offer warranties in regard to thisdraft.Note to readers:This manuscript is a partial draft of a book to be published in early 1994 by Addison-Wesley (ISBN 0-201-63337-X). Addison-Wesley has given me permission to makedrafts of the book available to the Tcl community to help meet the need for introduc-tory documentation on Tcl and Tk until the book becomes available. Please observethe restrictions set forth in the copyright notice above: you’re welcome to make acopy for yourself or a friend but any sort of large-scale reproduction or reproductionfor profit requires advance permission from Addison-Wesley.I would be happy to receive any comments you might have on this draft; send them tome via electronic mail at [email protected]. I’m particularly interestedin hearing about things that you found difficult to learn or that weren’t adequatelyexplained in this document, but I’m also interested in hearing about inaccuracies,typos, or any other constructive criticism you might have.2DRAFT (8/12/93): Distribution Restricted1DRAFT (8/12/93): Distribution RestrictedChapter 1 Introduction 11.1 Introduction 11.2 Organization of the book 31.3 Notation 4Chapter 2 An Overview of Tcl and Tk 52.1 Getting started 52.2 Hello world with Tk 72.3 Script files 92.4 Variables and substitutions 102.5 Control structures 112.6 Event bindings 132.7 Subprocesses 152.8 Additional features of Tcl and Tk 182.9 Extensions and applications 182.9.1 Expect 192.9.2 Extended Tcl 192.9.3 XF 202.9.4 Distributed programming 202.9.5 Ak 22Chapter 3 Tcl Language Syntax 253.1 Scripts, commands, and words 253.2 Evaluating a command 263.3 Variable substitution 283.4 Command substitution 293.5 Backslash substitution 303.6 Quoting with double-quotes 303.7 Quoting with braces 323.8 Comments 333.9 Normal and exceptional returns 333.10 More on substitutions 342DRAFT (8/12/93): Distribution RestrictedChapter 4 Variables 374.1 Simple variables and the set command 374.2 Arrays 384.3 Variable substitution 394.4 Removing variables: unset 404.5 Multi-dimensional arrays 414.6 The incr and append commands 414.7 Preview of other variable facilities 42Chapter 5 Expressions 435.1 Numeric operands 435.2 Operators and precedence 445.2.1 Arithmetic operators 445.2.2 Relational operators 465.2.3 Logical operators 465.2.4 Bitwise operators 465.2.5 Choice operator 465.3 Math functions 475.4 Substitutions 475.5 String manipulation 495.6 Types and conversions 495.7 Precision 50Chapter 6 Lists 516.1 Basic list structure and the lindex command 516.2 Creating lists: concat, list, and llength 536.3 Modifying lists: linsert, lreplace, lrange, and lappend 546.4 Searching lists: lsearch 566.5 Sorting lists: lsort 566.6 Converting between strings and lists: split and join 576.7 Lists and commands 583DRAFT (8/12/93): Distribution RestrictedChapter 7 Control Flow 617.1 The if command 617.2 Looping commands: while, for, and foreach 637.3 Loop control: break and continue 657.4 The switch command 657.5 Eval 677.6 Executing from files: source 68Chapter 8 Procedures 698.1 Procedure basics: proc and return 698.2 Local and global variables 718.3 Defaults and variable numbers of arguments 728.4 Call by reference: upvar 738.5 Creating new control structures: uplevel 74Chapter 9 Errors and Exceptions 779.1 What happens after an error? 779.2 Generating errors from Tcl scripts 799.3 Trapping errors with catch 809.4 Exceptions in general 81Chapter 10 String Manipulation 8510.1 Glob-style pattern matching 8510.2 Pattern matching with regular expressions 8810.3 Using regular expressions for substitutions 9010.4 Generating strings with format 9110.5 Parsing strings with scan 9310.6 Extracting characters: string index and string range 9410.7 Searching and comparison 9410.8 Length, case conversion, and trimming 954DRAFT (8/12/93): Distribution RestrictedChapter 11 Accessing Files 9711.1 File names 9711.2 Basic file I/O 9911.3 Output buffering 10111.4 Random access to files 10111.5 The current working directory 10211.6 Manipulating file names: glob and file 10211.7 File information commands 10511.8 Errors in system calls 107Chapter 12 Processes 10912.1 Invoking subprocesses with exec 10912.2 I/O to and from a command pipeline 11212.3 Process ids 11312.4 Environment variables 11312.5 Terminating the Tcl process with exit 113Chapter 13 Managing Tcl Internals 11513.1 Querying the elements of an array 11513.2 The info command 11713.2.1 Information about variables 11713.2.2 Information about procedures 12013.2.3 Information about commands 12113.2.4 Tclversion and library 12213.3 Timing command execution 12213.4 Tracing operations on variables 12313.5 Renaming and deleting commands 12513.6 Unknown commands 12613.7 Auto-loading 128Chapter 14 History 13114.1 The history list 1315DRAFT (8/12/93): Distribution Restricted14.2 Specifying events 13314.3 Re-executing commands from the history list 13314.4 Shortcuts implemented by unknown 13414.5 Current event number: history nextid 1346DRAFT (8/12/93): Distribution Restricted1Copyright © 1993 Addison-Wesley Publishing Company, Inc.All rights reserved. Duplication of this draft is permitted by individuals for personal use only. Anyother form of duplication or reproduction requires prior written permission of the author or pub-lisher. This statement must be easily visible on the first page of any reproduced copies. The publisherdoes not offer warranties in regard to this draft.Chapter 1Introduction1.1 IntroductionThis book is about two packages called Tcl and Tk. Together they provide a programmingsystem for developing and using graphical user interface (GUI) applications. Tcl standsfor “tool command language” and is pronounced “tickle”; is a simple scripting languagefor controlling and extending applications. It provides generic programming facilities thatare useful for a variety of applications, such as variables and loops and procedures. Fur-thermore, Tcl is embeddable: its interpreter is


View Full Document

GT AE 6382 - Tcl and the Tk Toolkit

Download Tcl and the Tk Toolkit
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Tcl and the Tk Toolkit and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Tcl and the Tk Toolkit 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?