Programming in Macintosh and Think Pascal 1995
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
Image 1
DISK INCLUDED Programming in MACINTOSH® and Think PASCAL™ SECOND EDITION Richard A. Rink • Vance B. Wisenbaker • Richard G. Vance
A book cover with a pale yellow panel framed by white and a gray-tan border, showing a large multicolor gradient title in green-to-yellow and yellow-to-red letters with blue script words, a red-to-green horizontal stripe, and author names along the bottom.
Reading notes: Printed dates are not explicit; 'Second Edition' is a edition label rather than a year, so it is listed under printedDates as the only edition marker. Script words 'Programming in' and 'and Think' are stylized and read as printed; minor letterform ambiguity possible.
- Printed product names
- Macintosh
- Printed dates
- Second Edition
- Languages
- English
PDF page 1
DISK INCLUDED • I - .. - f : -1-.._J ® TM ) SECOND EDITION o;;;.._ ___ _____,._ - - -- Richard A. Rink • Vance B. Wisenba~er • Richard G. Vance
Reading notes: No image was attached, so the transcription is based only on the supplied extracted text fragments. The supplied fragments are fragmentary and garbled (e.g., '• I -', '.. - f', ': -1-.._J', 'o;;;.._ ___ _____,._'), so no reliable headline or reading order can be established. 'SECOND EDITION' appears as a printed phrase but is not clearly a headline, so headline is set to null. 'DISK INCLUDED' and the author names are not advertised products or prices and are not listed as productNames. The author names 'Richard A. Rink', 'Vance B. Wisenba~er', and 'Richard G. Vance' appear in the fragments; the tilde in 'Wisenba~er' may be an OCR artifact and is flagged for verification.
- Languages
- English
PDF page 2
Programming • Ill Macintosh® and THINK™ Pascal Second Edition Richard A. Rink Professor of Computer Science Eastern Kentucky University Vance B. Wisenbaker Dean of the College of Social and Behaviorial Sciences Eastern Kentucky University Richard G. Vance Professor of Political Science and Chair, Department of Govenrment Eastern Kentucky University Prentice Hall, Englewood Cliffs, New Jersey 07632
Reading notes: No image was supplied, so layout and reading order are inferred only from the extracted copy. The line 'Ill' is unclear and may be a fragment of a larger word or a title element. The headline is inferred from the title lines 'Programming', 'Macintosh® and THINK™', and 'Pascal', whose exact layout is uncertain. Source copy contains apparent misspellings ('Behaviorial', 'Govenrment') that are preserved as printed in the extraction. Product names 'Macintosh' and 'THINK Pascal' appear only in the title and are not treated as advertised products. The '07632' string is a postal code and was not treated as a printed date.
- Languages
- English
PDF page 3
Ubnry orCoogres,, Cataloging-ln-PubUcation Data Rink, Richard A. Programming in Macintosh and Think Pascal I Richard A. Rink, Vance B. Wisenbaker, Richard G. Vance. - 2nd ed. p. cm. Includes bibliographical references and index. ISBN 0-13-093873-4 1. Macintosh (Computer)-Programming. 2. Pascal (Computer program language) I. Wisenbaker, Vance B. Il. Vance, Richard G. m. Title. QA76.8.M3R54 1995 005.265--dc20 94-33685 Publisher: Marcia Horton Production Editor: Mona Pompili Cover Designer: Violet Lake Studios Copy Editor: Nick Murray Production Coordinator: Bill Scazzero Editorial Assistant: Delores Mars © 1995 by Prentice-Hall, Inc. A Paramount Communications Company Englewood Cliffs, New Jersey 07632 CIP The author and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The author and publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs. All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher. Printed in the United States of America 10987654321 ISBN 0-13-093873-4 PRENTICE-HALL lNTERNATIONAL (UK) L!MITED, London PRENTICE-HALL OF AUSTRALIA PTY. L!MITED, Sydney PRENTICE-HALL CANADA, INc., Toronto PRENTICE-HALL HISPANOAMERICANA, S.A., Mexico PRENTICE-HALL OF INDIA PRIVATE L!Mm!D, New Delhi PRENTICE-HALL OF JAPAN, INc., Tokyo SIMON & ScHIJSTER ASIA PTE. Lm., Singapore EDITORA PRENTICE-HALL DO BRASil., LIDA., Rio de Janeiro
Reading notes: OCR-style damaged characters in catalog data (e.g., 'Ubnry', 'lNTERNATIONAL', 'L!MITED') Printed date '94-33685' is a Library of Congress control number rather than a publication date
- Printed product names
- Macintosh · Think Pascal
- Printed dates
- 1995 · 94-33685
- Languages
- English
PDF page 4
The image is a entirely blank white portrait-format page with no visible artwork, layout, or text.
Reading notes: No visible text found in the image; transcript and printed fields left empty.
PDF page 5
Contents PREFACE ............................................................................................................. xv Chapter One. Introduction to Macintosh Pascal OBJECTIVES .............................................................................................................. 1 1.1 COMPUTERS AND COMPUTER PROGRAMMING ............................................... I 1.2 BASIC COMPUTER ORGANIZATION AND THE MACINTOSH .............................. 2 1.3 USING THE MENUS ON YOUR MACINTOSH PASCAL DISK ............................... 5 1.4 THE PASCAL MENUS ........................................................................................ 9 1.4.1 The Run Menu .......................................................................................... 9 1.4.2 The P a U s e Menu .................................................................................... 12 1.4.3 The File Menu ........................................................................................ 13 1.4.4 The Search and Edit Menus ................................................................... 14 1.4.5 The Windows Menu .............................................................................. 16 1.5 USING THE PRINTER ....................................................................................... 17 SUMMARY .............................................................................................................. 19 REVIEW QUESTIONS ................................................................................................ 20 PROGRAMMING EXERCISES ................................................................................... 21 vii
Reading notes: Source is a table of contents with OCR spacing artifacts (e.g., 'P a U s e Menu', 'The P a s c a l') Chapter and section numbering may be affected by OCR character substitutions
- Languages
- English
PDF page 6
viii Chapter Two. Introduction to THINK Pascal OBJECTIVES ............................................................................................................ 30 2.1 INTRODUCTION TO THINK PASCAL AND THINK PASCAL WINDOWS .............. 30 2.2 THE THINK PASCAL MENUS ........................................................................... 37 2.2.1 The Fi I e Menus ....................................................................................... 37 2.2.2 The Edit Menu ....................................................................................... 39 2.2.3 The Se a re h Menu .................................................................................. 39 2.2.4 The Project Menu ................................................................................. 42 2.2.5 The Run Menus ....................................................................................... 43 2.2.6 The Debug Menu ................................................................................... 45 2.2.7 The Windows Menu .............................................................................. 46 2.3 CREATING A SOURCE PROGRAM: MORE DETAIL ............................................. 47 2.3.1 Editing a THINK Pascal Program ................................................................. 47 2.3.2 Using the Printer ....................................................................................... 48 2.3.3 Creating a Generic Project: A Helpful Shortcut.. ............................................ 49 2.3.4 Creating an Instant Project .......................................................................... 50 SUMMARY .............................................................................................................. 51 REVIEW QUESTIONS ................................................................................................ 52 PROGRAMMING EXERCISES ................................................................................... 52 Chapter Three. Constants, Variables, and Simple Input and Output OBJECTIVES ............................................................................................................ 60 3.1 PROBLEM SOLVING ........................................................................................ 60 3.1.1 Developing an Algorithm: An Example ......................... , .............................. 62 3.2 THE FORMAT OF A PASCAL PROGRAM: ADDITIONAL DETAIL ...................... 64 3.3 THE CONCEPT OF A DATA OBJECT ................................................................ 67 3.3.1 Constants ................................................................................................ 67 3.3.2 Variables ................................................................................................. 70 3.4 INPUT AND OUTPUT ....................................................................................... 74 3.4.1 Output in a Pascal Program ......................................................................... 74 3.4.2 Input in a Pascal Program ........................................................................... 78 3.5 SIMPLE DATA TYPES IN MACINTOSH AND THINK PASCAL .............................. 83 3.5.1 Real Data Types ...................................................................................... 83 3.5.2 Ordinal Data Types: Standard ................................................................... 86 3.5.3 Ordinal Data Types: Nonstandard .............................................................. 91 3.5.4 String Types ......................................................................................... 95 3.6 TYPE DECLARATIONS .................................................................................... 96 3.7 STANDARD PASCAL VERSUS THINK PASCAL.. .............................................. 98 SUMMARY .............................................................................................................. 99 REVIEW QUESTIONS ................................................................................................ 99 PROGRAMMING EXERCISES .................................................................................. 102
Reading notes: Table of contents with OCR spacing artifacts such as 'Fi I e' and 'Se a re h' No primary heading identified in the supplied copy
- Languages
- English
PDF page 7
Chapter Four. Basic Arithmetic Operations, Expressions, and Assignment Statements
Chapter Four. Basic Arithmetic Operations, Expressions, and Assignment Statements ix OBJECTIVES ........................................................................................................... 106 4.1 THE OPERAND AND THE OPERATOR. ............................................................ 106 4.2 OPERA TOR PRECEDENCE ............................................................................. 113 4.3 EXPRESSIONS AND THE ASSIGNMENT STATEMENT ..................................... 115 4.4 USING THE OBSERVE WINDOW TO TRACE A PROGRAM ............................... 119 4.5 ARITHMETIC FUNCTIONS .............................................................................. 120 4.6 ST AND ARD PASCAL VERSUS THINK PASCAL. .............................................. 127 SUMMARY ............................................................................................................. 128 REVIEW QUESTIONS ............................................................................................... 128 PROGRAMMING EXERCISES .................................................................................. 132 Chapter Five. Basic Control Instructions for Looping and Branching OBJECTIVES ........................................................................................................... 138 5.1 PROBLEM ANALYSIS AND TRACING ............................................................. 138 5.2 CONTROL STRUCTURES FOR LOOPS ............................................................ 139 5.2.1 Pretest Iteration Loops .............................................................................. 140 5.2.2 Post-test Iteration Loops ............................................................................ 144 5.3 CONDITIONAL EXPRESSIONS ........................................................................ 145 5.4 CONTROL STRUCTURES FOR BRANCHING ................................................... 147 5.4.1 The One-Way Selector ............................................................................... 147 5.4.2 The Two-Way Selector .............................................................................. 148 5.4.3 Multiway Selection .................................................................................. 154 5.5 NESTED LOOPS ............................................................................................. 159 5.6 BOOLEAN OPERATORS AND COMPOUND CONDITIONS ................................. 160 5.7 ITERATIONS REQUIRING SIMPLE COUNTERS ................................................ 163 5.8 PROBLEM ANALYSIS: DEVELOPING AN ALGORITHM REQUIRING BRANCHING AND LOOPING CONSTRUCTS .................................................... 165 5.9 STANDARD PASCAL VERSUS THINK PASCAL. ............................................. .171 SUMMARY ............................................................................................................. 174 REVIEW QUESTIONS ............................................................................................... 175 PROGRAMMING EXERCISES .. .. . . .......................................................................... 177 Chapter Six. Basic Graphic and Mouse Commands OBJECTIVES ........................................................................................................... 188 6.1 QUICKDRAW LIBRARY .................................................................................. 188 6.2 DRAWING SIMPLE LINES ............................................................................... 192 6.3 DRAWING SIMPLE GEOMETRIC PATTERNS ................................................... 196 6.4 MOUSE CURSOR COMMANDS ....................................................................... 206 6.5 SETTING THE SIZE AND DISPLAY OF TEXT AND ORAWING WINDOWS ......... 209 6.6 SOME APPLICATIONS OF THE QUICKDRAWI LIBRARY ................................. 211 6.7 USING COLOR GRAPHICS .............................................................................. 234 SUMMARY ............................................................................................................. 237
Reading notes: Source is a table of contents with OCR-style spacing artifacts; some entries may be split across lines. Chapter Five and Chapter Six headings appear with irregular line breaks.
- Languages
- English
PDF page 8
x REVIEW QUESTIONS ............................................................................................... 239 PROGRAMMING EXERCISES .................................................................................. 241 Chapter Seven. Procedures and Functions OBJECTIVES ........................................................................................................... 250 7 .1 THE CONCEPT OF A PASCAL PROCEDURE ................................................... 250 7 .1.1 Definition of a Pascal Procedure .................................................................. 251 7.1.2 Passing Information to Formal Parameters: Value Parameters ...........................259 7.1.3 Passing Information with Formal Parameters: Variable Parameters .................... 264 7.2 PASCAL FUNCTIONS ..................................................................................... 277 7.3 GLOBAL VERSUS LOCAL IDENTIFIERS .......................................................... 282 7.4 FORWARD DECLARATIONS ........................................................................... 285 7.5 PROCEDURAL AATI FUNCTIONAL PARAMETERS .......................................... 288 7.6 RECURSIVE FUNCTIONS AND PROCEDURES ................................................294 7.7 DEVELOPING MODULAR PROGRAMS THROUGH STEP-WISE REFINEMENT... 306 7.7.1 Abstraction 1........................................................................................... 307 7.7.2 Abstraction 2 .......................................................................................... .308 7.7.3 Abstraction 3 ........................................................................................... 309 7.7.4 Abstraction 4 .......................................................................................... .316 7.8 WHITE-BOX VERSUS BLACK-BOX TESTING ................................................... 323 7.9 STANDARD PASCAL VERSUS THINK PASCAL.. ............................................. 324 SUMMARY ............................................................................................................ .326 REVIEW QUESTIONS ............................................................................................... 327 PROGRAMMING EXERCISES ................................................................................. .332 Chapter Eight. Modularity: Building Programmer-Defined Libraries OBJECTIVES ........................................................................................................... 338 8.1 UNITS AND LIBRARIES IN THINK PASCAL: THE USES CLAUSE ..................... 338 8.2 BUILDING A THINK PASCAL PROJECT CONTAINING A PROGRAMMER- DEFINED UNIT ............................................................................................... 341 8.3 BUILDING THINK PASCAL LIBRARIES .......................................................... 349 8.4 USING THE USES CLAUSE WITHIN THE IMPLEMENTATION SECTION OF A UNIT .............................................................................................................. 357 8.5 PREDEFINED LIBRARIES ............................................................................... 360 8.6 APPLYING ADDED MODULARIZATION TO THE TUTOR SYSTEM ................... 362 8.7 ALLOCATING A PROJECT AS AN APPLICATION ............................................ 368 8.8 USING THE PROFILER OPTION TO COLLECT PROGRAM STATISTICS ............ 370 8.9 USING LIGHTSBUG FOR VIEWING THE EXECUTION OF A PROGRAM ............ 374 8.10 STANDARD PASCAL VERSUS THINK PASCAL.. ............................................. 379 SUMMARY .............................................................................................................. 379 REVIEW QUESTIONS ............................................................................................... 380 PROGRAMMING EXERCISES .... , ............................................................................. 383
Reading notes: Table of contents style source; no advertised products, prices, or dates present in the copy. Some OCR-like spacing artifacts in section titles (e.g., 'AATI' and 'PASCAL VERSUS') may affect exact spelling.
- Languages
- English
PDF page 9
xi Chapter Nine. Structured Data Types OBJECTIVES ........................................................................................................... 391 9.1 AN ARRAY AS A HOMOGENEOUS STRUCTURE ............................................. 391 9.2 FORMAL PARAMETERS DECLARED AS ARRAY TYPES ............................... .404 9.3 MULTIDIMENSIONAL ARRAYS ...................................................................... 408 9.4 CONCEPT OF AN ARRAY OF ARRAYS .......................................................... .416 9.5 APPLICATION OF ARRAYS: SORTING AND SEARCH ALGORITHMS ............. .421 9.5.1 Sorting Algorithms ................................................................................. .421 9.5.2 Search Algorithms .................................................................................... 425 9.6 AN INHOMOGENEOUS STRUCTURE: THE PASCAL RECORD ..........................427 9.7 A STRUCTURE FOR CONTAINING A RANDOM SET OF ELEMENTS: THE PASCAL SET .................................................................................................. 437 9.8 PACKED ARRAY OF CHARACTERS .............................................................. .446 9.9 STANDARD PASCAL VERSUS THINK PASCAL. ............................................. .448 SUMMARY ............................................................................................................. 450 REVIEW QUESTIONS ...............................................................................................451 PROGRAMMING EXERCISES .................................................................................. 455 Chapter Ten. Files OBJECTIVES ........................................................................................................... 464 10.1 ADVANTAGES OF USING FILES ................................................................. .464 10.2 BASIC CONCEPT OF A PASCAL FILE ......................................................... .465 10.3 ACCESSING SEQUENTIAL FILES ................................................................ .467 10.4 MERGING A RECORD INTO A SEQUENTIAL FILE OF RECORDS ................. .475 10.5 ACCESSING RANDOM FILES ...................................................................... 481 10.6 APPLYING THE BINARY SEARCH ALGORITHM TO FILES .......................... .483 10.7 USING THE SPECIAL FUNCTION EOF ....................................... - .................. .489 10.8 MERGING TWO FILES INTO A SEQUENTIAL FILE OF RECORDS ................. .490 10.9 TEXT FILES ................................................................................................ 495 10.10 REFERENCING DEVICES ON THE MACINTOSH AS FILE DEVICES .............. .499 10.11 AN APPLICATION: A SIMPLE DATABASE SYSTEM .................................... 501 10.12 STANDARD PASCAL VERSUS THINK PASCAL. ........................................... 522 SUMMARY ............................................................................................................ .524 REVIEW QUESTIONS ............................................................................................... 525 PROGRAMMING EXERCISES .................................................................................. 527 Chapter Eleven. Manipulation of Strings OBJECTIVES ........................................................................................................... 532 11.1 STRING TYPES IN MACINTOSH PASCAL ................................................... .532 11.2 BASIC STRING PROCEDURES AND FUNCTIONS ......................................... 535 11.3 PATTERN MATCHING AND OBJECT STRING REPLACEMENT ..................... .544 11.4 SOME MISCELLANEOUS STRING ROUTINES FOR MACINTOSH AND THINK PASCAL ........................................................................................... 550 11.5 EXAMPLE: EMULATING A PRINT USING STATEMENT.............................. 552 SUMMARY ............................................................................................................ .566
Reading notes: Source appears to be a table of contents with page numbers rather than advertising copy; no headline or products identified.
- Languages
- English
PDF page 10
xii REVIEW QUESTIONS .............................................................................................. .566 PROGRAMMIN"G EXERCISES .................................................................................. 567 Chapter Twelve. Pointers OBJECTIVES .......................................................................................................... .573 12.1 THE CONCEPT OF AN ABSTRACT DATA TYPE .......................................... .573 12.2 POINTERS AND DYNAMIC VARIABLES ...................................................... .575 12.3 SPECIAL DATA STRUCTURES: LINKED LISTS, STACKS, QUEUES .............. 585 12.4 APPLICATION OF POINTERS: BINARY TREES ............................................. 602 12.5 HEURISTICS FOR WRITING RECURSIVE ROUTINES .................................... 612 12.6 ADDITIONAL COMMENTS ON NEW AND DISPOSE ....................................... 614 12.7 MACINTOSH MEMORY MANAGER AND THE CONCEPT OF HANDLES ........ 616 12.8 THINK PASCAL VERSUS STANDARD PASCAL ............................................ 619 SUMMARY ............................................................................................................. 619 REVIEW QUESTIONS ............................................................................................... 619 PROGRAMMING EXERCISES .................................................................................. 622 Chapter Thirteen. Object-Oriented Programming in THINK Pascal OBJECTIVES ........................................................................................................... 628 13.1 INTRODUCTION TO THE TERM OOP ........................................................... 628 13.2 THE CONCEPT AND IMPLEMENTATION OF A CLASS ................................. 629 13.3 DECLARING AND USING OBJECTS .............................................................. 637 13.4 APPLYING THE RESERVED WORD INHERITED AND USING THE SELF PREFIX ....................................................................................................... 642 13.5 USING TOBJECT AS THE ROOT CLASS ....................................................... 644 13.6 BUILDING A SIMPLE WINDOW SYSTEM ...................................................... 646 13.7 USING THE CLASS BROWSER AND LIGHTSBUG FOR VIEWING OBJECTS AND CLASSES ............................................................................................ 656 13.8 USING OBJECT PASCAL TO IMPLEMENT AN OBJECT LIST ......................... 658 13.9 SOFTWARE ISSUES IN USING OBJECT PASCAL .......................................... 666 SUMMARY ............................................................................................................. 668 REVIEW QUESTIONS ............................................................................................... 669 PROGRAMMING EXERCISES .................................................................................. 670 Chapter Fourteen. QuickDraw library OBJECTIVES ........................................................................................................... 674 14.1 BASIS OF THE QUICKDRAW LIBRARY ........................................................ 674 14.2 MATHEMATICAL FOUNDATION OF THE QUICKDRAW LIBRARY ................ 675 14.3 DEFINING A PORT USING GRAFPORT ROUTINES ......................................... 682 14.4 DRAWING WITH POINTS, LINES, AND RECTANGLES .................................. 688 14.5 DRAWING WITH ARCS AND WEDGES ......................................................... 693 14.6 TEXT DRAWING ROUTINES ........................................................................ 704 14.7 DRAWING WITH REGIONS AND POLYGONS ................................................ 707 14.8 DRAWING PICTURES .................................................................................. 713
Reading notes: Source appears to be a table of contents, not an advertisement; no headline or advertised products or prices present.
- Languages
- English
PDF page 11
xiii 14.9 TRANSFER MODES AND BIT TRANSFER OPERATIONS ............................... 716 14.10 SPECIAL GRAPHICAL ENTITIES: CURSORS AND PATTERNS ...................... 721 14.11 MAPPING AND SCALING POINTS, RECTANGLES, REGIONS, AND POLYGONS ................................................................................................. 729 SUMMARY ............................................................................................................. 733 REVIEW QUESTIONS ............................................................................................... 734 PROGRAMMING EXERCISES .................................................................................. 736 Appendices APPENDIX A THINK AND MACINTOSH PASCAL RESERVED WORDS ................... 744 APPENDIX B THE MACINTOSH CHARACTER SET ............................................... 746 APPENDIX C INTRODUCTION TO THE SANE LIBRARY ........................................748 APPENDIX D CREATING A MACINTOSH PASCAL APPLICATION ......................... 763 APPENDIX E USING LABELS AND THE PASCAL GOTO STATEMENT ................... 767 APPENDIX F REFERENCES ................................................................................. 770 Index ....................................................................................... 773
Reading notes: Source appears to be a table of contents fragment; no headline or advertised content present. Page numbers and dotted leaders may be OCR artifacts.
- Languages
- English