Addison Wesley - Tcl and the Tk Toolkit[1993].pdf
(
1394 KB
)
Pobierz
Tcl and the Tk Toolkit
John K. Ousterhout
Computer Science Division
Department of Electrical Engineering and Computer Sciences
University of California
Berkeley, CA 94720
Copyright © 1993 Addison-Wesley Publishing Company, Inc.
All rights reserved. Duplication of this draft is permitted by individuals for personal
use 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 page
of any reproduced copies. The publisher does not offer warranties in regard to this
draft.
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 make
drafts 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 observe
the restrictions set forth in the copyright notice above: you’re welcome to make a
copy for yourself or a friend but any sort of large-scale reproduction or reproduction
for profit requires advance permission from Addison-Wesley.
I would be happy to receive any comments you might have on this draft; send them to
me via electronic mail at
ouster@cs.berkeley.edu.
I’m particularly interested
in hearing about things that you found difficult to learn or that weren’t adequately
explained in this document, but I’m also interested in hearing about inaccuracies,
typos, or any other constructive criticism you might have.
2
DRAFT (8/12/93): Distribution Restricted
1
Chapter 1
Introduction 1
1.1 Introduction 1
1.2 Organization of the book 3
1.3 Notation 4
Chapter 2
An Overview of Tcl and Tk 5
2.1 Getting started 5
2.2 Hello world with Tk 7
2.3 Script files 9
2.4 Variables and substitutions 10
2.5 Control structures 11
2.6 Event bindings 13
2.7 Subprocesses 15
2.8 Additional features of Tcl and Tk 18
2.9 Extensions and applications 18
2.9.1
2.9.2
2.9.3
2.9.4
2.9.5
Expect 19
Extended Tcl 19
XF 20
Distributed programming 20
Ak 22
Chapter 3
Tcl Language Syntax 25
3.1 Scripts, commands, and words 25
3.2 Evaluating a command 26
3.3 Variable substitution 28
3.4 Command substitution 29
3.5 Backslash substitution 30
3.6 Quoting with double-quotes 30
3.7 Quoting with braces 32
3.8 Comments 33
3.9 Normal and exceptional returns 33
3.10 More on substitutions 34
DRAFT (8/12/93): Distribution Restricted
2
Chapter 4
Variables 37
4.1 Simple variables and the set command 37
4.2 Arrays 38
4.3 Variable substitution 39
4.4 Removing variables: unset 40
4.5 Multi-dimensional arrays 41
4.6 The incr and append commands 41
4.7 Preview of other variable facilities 42
Chapter 5
Expressions 43
5.1 Numeric operands 43
5.2 Operators and precedence 44
5.2.1
5.2.2
5.2.3
5.2.4
5.2.5
Arithmetic operators 44
Relational operators 46
Logical operators 46
Bitwise operators 46
Choice operator 46
5.3 Math functions 47
5.4 Substitutions 47
5.5 String manipulation 49
5.6 Types and conversions 49
5.7 Precision 50
Chapter 6
Lists 51
6.1 Basic list structure and the lindex command 51
6.2 Creating lists: concat, list, and llength 53
6.3 Modifying lists: linsert, lreplace, lrange, and lappend 54
6.4 Searching lists: lsearch 56
6.5 Sorting lists: lsort 56
6.6 Converting between strings and lists: split and join 57
6.7 Lists and commands 58
DRAFT (8/12/93): Distribution Restricted
3
Chapter 7
Control Flow 61
7.1 The if command 61
7.2 Looping commands: while, for, and foreach 63
7.3 Loop control: break and continue 65
7.4 The switch command 65
7.5 Eval 67
7.6 Executing from files: source 68
Chapter 8
Procedures 69
8.1 Procedure basics: proc and return 69
8.2 Local and global variables 71
8.3 Defaults and variable numbers of arguments 72
8.4 Call by reference: upvar 73
8.5 Creating new control structures: uplevel 74
Chapter 9
Errors and Exceptions 77
9.1 What happens after an error? 77
9.2 Generating errors from Tcl scripts 79
9.3 Trapping errors with catch 80
9.4 Exceptions in general 81
Chapter 10
String Manipulation 85
10.1 Glob-style pattern matching 85
10.2 Pattern matching with regular expressions 88
10.3 Using regular expressions for substitutions 90
10.4 Generating strings with format 91
10.5 Parsing strings with scan 93
10.6 Extracting characters: string index and string range 94
10.7 Searching and comparison 94
10.8 Length, case conversion, and trimming 95
DRAFT (8/12/93): Distribution Restricted
Plik z chomika:
musli_com
Inne pliki z tego folderu:
Addison Wesley - Leffingwell & Widrig - Managing Software Requirements, 1St Edition.pdf
(7541 KB)
Addison Wesley - C++ by Dissection.pdf
(5291 KB)
Addison.Wesley.Advanced.CORBA.Programming.with.C++(1).pdf
(4883 KB)
Accelerated C++ 2000.pdf
(2639 KB)
Addison Wesley - Essential C++ Ebook-fly(1).pdf
(1482 KB)
Inne foldery tego chomika:
3D Design - Programming
ActionScript
Actionscript - Flash - Flex - Air
Ada
ADO
Zgłoś jeśli
naruszono regulamin