Monday, July 5, 2010

Thinking in Postscript














Table of Contents
Preface......................................................................... xi
Chapter 1
PostScript as a Programming Language ..................1
DESIGN FEATURES............................................................................2
STRUCTURED PROGRAMMING TECHNIQUES ...............................3
PROGRAMMING TASKS.....................................................................4
WINDOW SYSTEMS, COMMUNICATIONS, AND DISPLAYS............4
DATA STRUCTURES AND ALGORITHMS.........................................6
CONCLUDING THOUGHTS ................................................................6
EXERCISES.............................................................................. 7
Chapter 2
PostScript is Not Like C..............................................9
COMPARISON OF LANGUAGE MECHANISMS...............................11
EXPRESSING AN ALGORITHM AS A PROGRAM...........................12
THE UNIX SHELL AND OPERATING SYSTEM................................13
INPUT, OUTPUT, AND THROUGHPUT............................................14CONCLUDING THOUGHTS ..............................................................15
EXERCISES.............................................................................16
Chapter 3
Foundations............................................................... 17
POSTSCRIPT LANGUAGE SYNTAX ................................................19
SIMPLE PROGRAM STRUCTURE....................................................20
SETTING UP TEMPLATES................................................................24
DECLARING AND USING VARIABLES.............................................26
ALLOCATING MEMORY....................................................................29
GETTING MEMORY BACK................................................................31
OPENING AND CLOSING FILES ......................................................31
COMPARISONS AND EQUALITY OF OBJECTS..............................32
CONCLUDING THOUGHTS ..............................................................34
EXERCISES.............................................................................34
Chapter 4
Some Typical Programs ........................................... 37
A TYPICAL PAGE DESCRIPTION PROGRAM.................................38
FONT PROGRAMS............................................................................40
PROGRAMS THAT READ DATA.......................................................42
QUERY PROGRAMS.........................................................................43
ENCAPSULATED POSTSCRIPT PROGRAMS.................................43
PERSISTENTLY RESIDENT PROGRAMS .......................................46
CONCLUDING THOUGHTS ..............................................................49
EXERCISES.............................................................................49
Chapter 5
Understanding the Stack.......................................... 51
A QUICK OVERVIEW OF DATA TYPES...........................................51
NAME LOOKUP .................................................................................53
HOW OPERATORS USE THE STACK..............................................53
GROUPING AND VISUAL CHUNKING .............................................56
THINKING BACKWARD AND SIDEWAYS........................................58
COMPOSITE OBJECTS ....................................................................61
THE OTHER STACKS .......................................................................62
CONCLUDING THOUGHTS ..............................................................63
EXERCISES............................................................................ 64
Chapter 6
Trusting the Stack .....................................................67
SAFETY OF DATA ON THE STACK .................................................68
WHERE ARE THE DATA GOING?....................................................69
REARRANGING THE STACK............................................................71
CONDITIONALS AND LOOPS...........................................................73
RECURSION AND LOCAL VARIABLES............................................76
CONCLUDING THOUGHTS ..............................................................77
EXERCISES............................................................................ 78
Chapter 7
Building Conditional Statements .............................79
SIMPLE CONDITIONALS ..................................................................80
SETTING UP THE CONDITION.........................................................81
CONDITIONALS ARE NOT MAGIC...................................................86
NESTED CONDITIONALS AND ELSE CLAUSES ............................87
COMPOUND CONDITIONALS ..........................................................88
CONCLUDING THOUGHTS ..............................................................90
EXERCISES............................................................................ 91
Chapter 8
Using Looping Constructs ....................................... 93
LOOP BASICS ...................................................................................94
USING THE LOOP INDEX.................................................................95
LOOPS ARE PROCEDURE BODIES ................................................99
LOOPS OF INSTRUCTIONS ...........................................................101
EXITING LOOPS PREMATURELY..................................................102
CONCLUDING THOUGHTS ............................................................103
EXERCISES...........................................................................103
Chapter 9
Procedures .............................................................. 105
WHAT EXACTLY IS A PROCEDURE?............................................106
PARAMETER PASSING ..................................................................108
CONSTRUCTING GOOD PROCEDURES ......................................111
SELF-MODIFYING PROCEDURES.................................................114
CONCLUDING THOUGHTS ............................................................116
EXERCISES...........................................................................117
Chapter 10
Using Dictionaries................................................... 119
DICTIONARIES FOR NAME SCOPING ..........................................120
LOCAL DICTIONARIES ...................................................................121
GLOBAL DICTIONARIES OF PROCEDURES ................................123
MAINTAINING THE DICTIONARY STACK......................................124
INTO AND OUT OF DICTIONARIES ...............................................126
LOOKING INTO DICTIONARIES.....................................................127
REDEFINING OPERATORS............................................................130
CONCLUDING THOUGHTS ............................................................132
EXERCISES...........................................................................133
Chapter 11
Creating and Manipulating Data.............................135
CONSTRUCTING AN ARRAY .........................................................135
CONSTRUCTING A STRING...........................................................137
MANIPULATING DATA WITH PUT AND GET.................................137
CONCATENATING ARRAYS AND STRINGS.................................139
INPUT AND OUTPUT OF STRING DATA .......................................140
ARRAYS VERSUS DICTIONARIES ................................................141
ADVANCED TECHNIQUES.............................................................142
CONCLUDING THOUGHTS ............................................................143
EXERCISES.......................................................................... 144
Chapter 12
Storing and Using Data...........................................145
CLASSICAL DATA STRUCTURES..................................................151
CONCLUDING THOUGHTS ............................................................156
EXERCISES.......................................................................... 156
Chapter 13
Program Data and Instructions ..............................157
TURNING DATA INTO INSTRUCTIONS.........................................159
TURNING INSTRUCTIONS INTO DATA.........................................161
DATA CONVERSIONS ....................................................................163
CONCLUDING THOUGHTS ............................................................165
EXERCISES.......................................................................... 165
Chapter 14
Using Files and Input/Output Techniques ............167
OPENING AND CLOSING FILES ....................................................170
READING AND WRITING FILES.....................................................172
WRITING FORMATTED DATA TO FILES.......................................175
FILE STATUS INFORMATION.........................................................178
RANDOM VERSUS SEQUENTIAL ACCESS ..................................179
CONCLUDING THOUGHTS ............................................................180
EXERCISES...........................................................................180
Appendix
Answers to Exercises ............................................. 185
Index of Example Programs ................................... 209
Subject Index ........................................................... 217

Download this book click here

Another Programming Language books click here

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!