Pascal on the Macintosh: A Graphical Approach
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
on the Macintosh™ A Graphical Approach
[illegible] on the Macintosh™ A Graphical Approach David A. Niguidula • Andries van Dam
A cream-colored book cover with a large red handwritten-style script word at top, a thin red horizontal rule below the black serif title lines, and author names at the bottom.
Reading notes: The large red script word at top is stylized and could not be reliably read, so it is transcribed as [illegible]. The headline is the black serif title block; the red script may form part of the title and was not included. The 'on the' line is set smaller above 'Macintosh™', with the TM mark shown as a superscript.
- Languages
- English
PDF page 1
Pascal on the Macintosh™ A Graphical Approach David A. Niguidula • Andries van Dam
A book cover with a large red stylized script word above black serif title text, a red horizontal rule, and author names at the bottom on a cream background.
Reading notes: The large red script word above 'on the' is stylized and was read as 'Pascal'; its letterforms are not fully clear, so this reading is uncertain. The trademark symbol ™ follows 'Macintosh' and is set small and raised.
- Languages
- English
PDF page 2
283 (handwritten in blue ink, top left)
A mostly blank off-white page with a handwritten blue ink number in the upper left corner and only faint, indistinct ghosted marks in the center that do not form readable text.
Reading notes: The handwritten blue marking reads as '283' or possibly '283' with a trailing stroke; the third character is ambiguous and may be '7' or another figure. Faint ghosted marks in the center of the page could not be read and may be show-through from the reverse side; no printed copy was identified. The handwritten marking is not printed advertising copy, so it is transcribed only as a visible annotation.
PDF page 3
on the Macintosh AGraphical Approach David A. Niguidula • Andries van Darn Brown University .. ........ Addison-Wesley Publishing Company Reading, Massachusetts • Menlo Park, California Don Mills, Ontario• Wokingham, England• Amsterdam Sydney • Singapore • Tokyo • Madrid • Bogota • Santiago ~ San Juan
Reading notes: Headline line breaks in source may affect exact primary heading spacing
- Printed product names
- Macintosh
- Languages
- English
PDF page 4
Sponsoring Editor Production Supervisor Editorial and Production Services Manufacturing Supervisor Cover Design Keith Wollman Mary Coffey Nancy Wirtes Hugh Crawford Marshall Henrichs The programs and applications presented in this book have been included for their instructional value. They have been tested with care but are not guaranteed for any particular purpose. The publisher does not offer any warranties or representations, nor does it accept any liabilities with respect to the programs or applications Library of Congress Cataloging-in-Publication Data Niguidula, David A. Pascal on the Macintosh. On t.p. the registered trademark symbol "TM'' is superscript following "Macintosh" in the title. Includes index. 1. Macintosh (Computer) - Programming. 2. PASCAL (Computer program language) I. van Dam, Andries, 1938- . II. Title. QA76.8.M3N54 1987 005.265 86-20668 ISBN 0-201-16588-0 Macintosh is a trademark licensed to Apple Computer, Inc. Many of the designations used by manufacturers and sellers to designate thier products are claimed as trademarks. Where those designations appear in this book and Addison-Wesley was aware of a trademark claim, the designations have been printed in caps or initial caps. Reprinted with corrections July, 1987. Copyright ©1987 by Addison-Wesley Publishing Company, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Published simultaneously in Canada BCDEFGHIJ-HA-8987
Reading notes: Copyright and cataloging line includes OCR-like spacing; some words may be imperfectly reproduced. Heading and title block not clearly separated from front-matter credits.
- Printed product names
- Macintosh
- Printed dates
- 1987 · 1938-
- Languages
- English
PDF page 5
Preface If you look around, you'll find dozens of other books with "Pascal" in the title. A smaller, but still sizable, number of titles also include the word "Macintosh." So what's so special about the book you're holding? We believe it's a unique combination of features - some tried and true, some brand new - that sets us apart. Pascal on the Macintosh: A Graphical Approach is an introductory textbook on programming, problem solving, and applications in Pascal for Macintosh users. The book covers the topics listed in the ACM's recommended curriculum for the introductory course for computer science majors (CSl) and in the Educational Testing Service's guidelines for the Advanced Placement Course in Computer Science. To provide the option of covering some advanced topics, this book covers more material than would normally be completed in one semester. The book is based on Macintosh Pascal and Lightspeed Pascal software, but readers who complete it will be able to use Pascal on any machine. We take full advantage of these software packages' debugging and formatting facilities and designate which features are standard and which are specific to Macs. (Throughout the book, the term "MacPascal" refers to both Macintosh Pascal and Lightspeed Pascal unless noted otherwise.) iii
Reading notes: Recognition of 'CSl' may be an OCR error for 'CS1'
- Printed product names
- Macintosh Pascal · Lightspeed Pascal · MacPascal
- Languages
- English
PDF page 6
iv Preface Readers are not expected to have any background with computers. They also need no more of a mathematical background than high school algebra and geometry. Readers are, however, expected to be comfortable using Cartesian coordinates and working with simple equations. The subtitle, A Graphical Approach, implies two things that make our book special. First, the book has an interactive graphics orientation. The emphasis in the book is on using graphics to introduce students to programming in Pascal, rather than on the technical aspects of graphics programming. In our experience, we have found that using graphics in programming assignments is a more effective teaching tool than the traditional technique of assigning number- and character-crunching programs. Graphics programs are easier to debug, provide more satisfying results, and are simply more fun, but can be as technically sophisticated as more traditional assignments. By the end of the book, students should have enough of a background in graphics to write graphical programs such as simple educational and recreational video games. Second, computer science instructors have noted that students learn by seeing concepts illustrated graphically and by hand simulating code in addition to reading text. We have taken this advice to heart. Among the 300-plus illustrations are sequences of snapshots illustrating concepts that are difficult to explain and understand, such as loops, linked lists, and binary trees. Over 50 pages of code examples give students an opportunity to see complete, well-documented programs. In addition, the book contains close to 500 exercises. We believe our book has broad appeal. Humanities students who want only one semester of computer science should find the book as relevant and as easy to use as hardcore computer addicts who plan on spending the rest of their college careers in CS courses. In either case, students who finish the book will be able to solve problems through decomposition, read Pascal code and understand what it is doing, and, of course, write applications with approved programming style and user-interface techniques. Concept Format We have attempted to use a consistent approach when presenting concepts, and throughout, we have used problem solving as a central theme. First, we open each chapter with a transition/motivation section. Typically, we state a problem and show how the material covered thus far either does not solve or inefficiently solves the problem. We then introduce the concept that satisfactorily solves the problem (e.g., we could declare hundreds of separate real variables, but it would be better to use an array). Second, we introduce the syntax and semantics of new statements or data structures and show examples that solve the problem stated in the transition/ motivation section. The book contains nearly 100 syntax boxes, which are stylized guides to each of the Pascal and graphics statements. These standardized boxes are incorporated directly into the text.
- Languages
- English
PDF page 7
Our Background Third, we present a complete discussion of the concept, including: •Use of the concept in the design/pseudocode process; preventive maintenance • Problems in using the statement or data structure; how to debug such problems using MacPascal and Lightspeed facilities •Use of the concept to make programs more user friendly (e.g., what sort of graphics make a good interface) v • Documentation and clean methods of coding the concept to make the program easily readable by other programmers Fourth, almost every chapter contains an example program where theory is put into practice. We take the reader through problems, step by step, as we proceed from stated question to programmed solution. A problem is stated and broken down; levels of pseudocode are shown along with the entire program as it appears on the Mac. Each progratl} reinforces concepts that have been seen earlier, and shows an example of how the new concept is used. We also thoroughly document these example programs. Finally, each chapter concludes with a summary, exercises, and programming problems. There are three types of exercises: Understanding Concepts, which test comprehension of material with short-answer questions; Coding Exercises, which test specific programming concepts with "write a procedure" or "modify this code" questions; and Programming Problems, which test overall programming ability with open-ended "write a program" questions. Our Background Every few years, the introductory computer science course taught by Andy van Dam at Brown undergoes major surgery. In 1983, Brown's new "electronic classroom" containing 55 Apollo DN/300 workstations was opened. Three undergraduate teaching assistants started developing a new version of the course, using the machines and the Brown Algorithm Simulator and Animator (BALSA), an innovative software system for the Apollos developed by Professor Bob Sedgewick and Marc Brown. The group developed a number of graphical simulations that allow students to learn from animated examples in conjunction with the standard lecture. In addition, students learned how to incorporate the rudiments of interactive computer graphics into their own assignments. To accompany the lectures and the simulations, an early draft of this book was created by a student group, coordinated by David Niguidula, during the summer of 1983. The first group of students to have both the book and the BALSA simulations as resources responded positively to the entire course in general and to the book in particular, encouraging us to continue revising and refining. While our experience in developing the book for the Apollos was helpful, the book was started fresh for the Macintosh. The primary writing took place during the fall and winter of 1985, and the book was extensively revised throughout 1986 to
Reading notes: Hyphenation and line-break artifacts (e.g., 'progratl}') may reflect OCR error Reading order across columns and page breaks is uncertain Headline cannot be confidently identified; 'Our Background' appears twice as section headings
- Printed product names
- Apollo DN/300 · BALSA · Macintosh · MacPascal · Lightspeed
- Printed dates
- 1983 · 1985 · 1986
- Languages
- English
PDF page 8
vi Preface respond to feedback from class testing of the manuscript and to suggestions provided by academic reviewers. Acknowledgments Brown's Computer Science Department enjoys a reputation for being experimental and innovative, and for allowing undergraduates to take an active role in the design and implementation of introductory courses. This book, as well as the course for which it is used, exists because of the dedicated involvement of many people, almost all of whom were undergraduates at the time of their participation in the project. We wish to show our gratitude for their efforts by acknowledging their work. The original idea for the book came from Dave Nanian and Susie Galvin, and an early version was first used in a summer course taught by Perry Busalacchi, Karen Smith, and Liz Waymire (who also implemented the first BALSA demos). Felicia Gershberg, Bill Petty, Jenny Richlin, and Mason Woo contributed to outlining, developing, editing, and proofreading the book's early drafts. Two other individuals were of great assistance in the development of the book for the Apollos. Janine "J9" Roeth spent hundreds of hours creating and checking dozens of diagrams and code examples, many of which have been adapted for use here. The first drafts probably would not have been possible without Karen Seiler's writing and moral support; we are particularly indebted to her work on what is now Chapter 14. The Macintosh version of the book had its first test run in a section of the introductory course led by David Block and Leslie McCall; they turned into practice the theory of a graphical approach tuned for the Macintosh. We also greatly appreciate the reviews we received from the students in that section and from academic reviewers: Steven Eisenbarth (Baylor University), Morris W. Firebaugh (University of Wisconsin, Parkside), Douglas Harms (The Ohio State University), Michael S. Hennessy (University of Oregon), William J. Keane (Boston College), Jeffrey L. Popyack (Drexel University), and Robert E. Reynolds (Reed College). We have taken to heart all the points raised in these reviews, and think that the result is considerably improved because of the students' and professors' comments. Throughout the project, Keith Wollman of Addison-Wesley has been extremely supportive and has patiently kept us up to date and listened to our ideas. In the later drafts of the manuscript, Trina Avery graced this work with her typically superb editing and proofreading skills and provided the needed sanity checks. Members of the staff at THINK Technologies helped to point us in the proper directions when we had questions about the software. The Addison-Wesley production crew, including Mary Coffey, Nancy Wirtes, Prentice Hastings, and the folks at Graphic Typesetting Service have done a terrific job of creating a complete volume from its hundreds of parts. Many other individuals have contributed in signficant ways. A special thanks to Eric Wolf, Jeff Vroom, Debbie Scott, James Rinzler, Debbie Lewart, Beth
Reading notes: Source text ends mid-sentence and appears truncated at the end of the excerpt. OCR-style spelling 'signficant' appears in the source and is preserved as printed.
- Languages
- English
PDF page 9
Acknowledgments vii Grossman, and the hundreds of undergraduate teaching assistants and students who have worked with the book in its previous incarnations. Our families and friends have had to put up with our "writing moods"; we thank them for their patience and encouragement. Finally, we want to acknowledge one other, special individual. Amy Elizabeth Tozer has been an integral part of the project since its inception. For four years, she has done whatever needed doing from filling in missing paragraphs to showing how the book can best be used in teaching; in the Macintosh version, she has checked exercises, made backup copies, provided artwork, written and tested programs, and performed uncountable other tasks. For her willingness to take on jobs above and beyond the call, and for her persistent belief that some good was coming of all this, we are extraordinarily grateful.
Reading notes: Source appears to be a book acknowledgments page; no advertised products, prices, or dates are printed in the supplied copy. Page header 'Acknowledgments vii' appears at top; primary heading treated as not applicable.
- Languages
- English
PDF page 10
How to Use This Book
viii Preface How to Use This Book We have examined what we think separates our book from the competition, taking the instructor's point of view. What also sets us apart is the combination of assumptions and expectations we have about you, the reader. We assume that you 0wn, or have access to, an Apple Macintosh computer and Pascal software that you want to learn to use effectively. We do not, however, assume you have any programming experience. For that matter, we don't assume you have touched a Macintosh or any other computer before. (The Primer provides an introduction to the macl:iine: you can skip it if you are already familiar with Macintosh software.) We do not assume you are mathematically inclined. If you remember the basics of high school algebra and geometry - e.g., using variables in equations and dealing with Cartesian (x - y) coordinates -you have all the math you n~d to know. In our analogies and examples, we show how programming concepts are similar to ideas that span the curricular spectrum. We expect you are using this book in conjunction with a college or secondary- school course. However, it could also be used as a tutorial or for independent study. Above all, we expect you don't want to memorize a set of program-creation "formulas" by rote; we assume you want to learn to use the computer as a flexible tool for solving problems. It is not enough to create a working program; to use our approach effectively, you must think about the requirements of the problem, the way in which it can be broken down and structured, the purpose of a program's pieces, and then determine how to write the Pascal instructions that implement those pieces. We provide an intellectual framework for problem solving, and we hope our analogies, examples, figures, and reference materials will assist you ln visualizing the process. It is still ultimately your responsibility to think about problem solving, to design a strategy for your own use, and to fully compreJ:iend the concepts we ·present. In short, this book - like the computer, the software and even your instructor - is merely an educational tool. lt is up to you to do the learning. Formatting and Notation A number of notations are used throughout this text. Bold italics indicate segments of Pascal code and options on the various Macintosh menus. Boldface designates various items on the Mac display, such as menu options, and "reserved words~· or "word symbols" (listed in Appendix A), which are the words MacPascal's "pretty printing" (the feature that displays your program) automatically puts in boldface. Italics introduce new terms and phrases, emphasize certain points, and denote certain algebraic expressions. The Courier font indicates data files and other particular inputs and outputs. Many of the figures in this book are pictures of windows that come from runs of various programs using Macintosh Pascal, version 2.0, or LightsPeecl Pascal, version 1.0. .
Reading notes: Several words are damaged by OCR (e.g., '0wn', 'n~d', 'compreJ:iend', 'ln'), and some reading-order breaks occur at line ends.
- Printed product names
- Apple Macintosh · Pascal · MacPascal · Macintosh Pascal
- Languages
- English
PDF page 11
Formatting and Notation Syntax Box Example case A unique characteristic of this book is the use of syntax boxes. Syntax boxes summarize Pascal statements, declarations, and definitions. The following is an example of a syntax box: Purpose Syntax where Usage To execute one of any number of mutually exclusive statements, depending on the value of an expression. case < selector > of <Value 1 >: <statement 1 >; <Value 2 >: < statement 2 >; <Value n>: < statement n >[;] otherwise < statement n+ 1 >] end; {case} < selector > is an expression of type integer or char, or an enumerated type.*< value 1 >,<value 2 >,... ,<value n >are single integers or characters, or groups of integers or characters separated by commas. < statement 1 >, < statement 2 >, ... ,< statement n >, < statement n+ 1 > are legal Pascal statements. If more than one statement is used, then the statement block must be surrounded by begin/end brackets. The < selector > is evaluated to a single value. If one of the values < value 1 >, < value 2 >, ... , < value n > matches < selector>, then the corresponding< statement> is executed. If < selector > does not match any of the listed values,< statement n+l >(following the otherwise) is executed. Only one of the statements in the case construct will be performed. Note that the end; of the case construct does not have a corresponding begin. The otherwise clause is optional. * Characters are examined in Chapter 8, enumerated types in Chapter 13. ix
- Languages
- English