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
[illegible] on the Macintosh™ A Graphical Approach David A. Niguidula • Andries van Dam
A cream-colored book cover with a large, stylized red script word at the top, followed by black serif title text, a red horizontal rule, and author names at the bottom, with faint stains at the top and bottom edges.
Reading notes: The large red script word at the top is stylized and could not be reliably read, so it is marked [illegible] and not transcribed. Headline is set to null because the largest element is the unreadable script rather than printed text. The trademark symbol ™ follows 'Macintosh' and is included as printed. Stains at the top and bottom edges obscure small areas but no printed text there is legible.
- Languages
- English
PDF page 1
on the Macintosh™ A Graphical Approach
[illegible] on the Macintosh™ A Graphical Approach David A. Niguidula • Andries van Dam
A book cover with a large red hand-lettered script word above a black serif title, a red horizontal rule, and author names at the bottom, on a cream background with faint stains at the top and bottom edges.
Reading notes: The large red script word above the title is not confidently readable and is transcribed as [illegible]. The headline is taken from the printed title lines below the script, which may not be the intended headline. The red script word may be a larger title word, so the transcript may be incomplete. The stains at the top and bottom edges are not text and were not transcribed.
- Languages
- English
PDF page 2
QA , 76.8 eM3 N54 1987 Niguidula, David A. Pascal on the Ma- ~ clntosh / DATE DUE BLDG. 600 LIBRARY CIRCULATION RECORD 1 BLDG. 600/8223 Ext. 23506 Call No. of Book Date Due Q A 7G. R Print Title of Book ? ovs v .,,,; d -'; f-'~~ ,,4/ o-v//J ".fo J {
Reading notes: Book title split across lines as 'Pascal on the Ma- clntosh' with hyphenation; reconstructed as 'Pascal on the Macintosh'. Due-date stamps and handwritten marks are damaged and unreadable. Call number 'QA 76.8 M3 N54 1987' partly garbled in source; reading order uncertain.
- Printed dates
- 1987
- Languages
- English
PDF page 3
on the Macintosh .. A AGraphical Approach David A. Niguidula • Andries van Dam 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 reconstructed from title lines 'on the Macintosh .. A' and 'AGraphical Approach'; spacing and possible OCR joins uncertain
- 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. I. Macintosh (Computer) - Programming. 2. PASCAL (Computer program language) I. van Dam, Andries, 1938- . IL 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 their 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. 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. ABCDEFGHIJ-HA-8987
Reading notes: OCR-style spacing and punctuation in the Library of Congress cataloging block may be imperfect, e.g. 'IL Title' likely 'III. Title' The catalog number '005.265' and ISBN/printing codes are ambiguous in grouping and may not be dates
- Printed product names
- Macintosh · Macintosh (Computer)
- Printed dates
- 1987 · 1938 · 86-20668 · 0-201-16588-0
- 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: Some words are split across line breaks and quotation marks around terms in the source are irregular.
- Printed product names
- Pascal · Macintosh · 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.
Reading notes: Headline not clearly identifiable; source begins with a preface heading 'iv Preface' and subsections.
- Printed product names
- Pascal
- 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 program 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: Section heading 'Our Background' appears twice in the supplied copy; reading order between sections may be uncertain. Source text ends mid-sentence ('revised throughout 1986 to'), indicating truncation.
- Printed product names
- Apollo DN/300 · Brown Algorithm Simulator and Animator · BALSA · MacPascal · Lightspeed · Macintosh
- Printed dates
- 1983 · 1985 · 1986 · summer of 1983
- Languages
- English
PDF page 8
vi Preface I 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: Typo 'signficant' appears in source text Some names split by hyphenation or spacing such as 'Steven Eisenbarth' and 'Morris W. Firebaugh' rendered as printed
- Printed product names
- BALSA · THINK Technologies · Macintosh · Apollos
- 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.
- Languages
- English
PDF page 10
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 assuine that you own, 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 machine: you can skip it if you are already familliar 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 need 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, ar.d 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 in 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 comprehend the concepts we present. In short, this book - like the computer, the software and even your instructor - is merely an educational tool. It 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 Lightspeed Pascal, version 1.0.
Reading notes: Typographical errors such as 'assuine' and 'familliar' appear in the source copy and are preserved as printed Some ligature and hyphenation artifacts ('ar.d', 'Cartesian (x - y)') may reflect OCR noise
- Printed product names
- Apple Macintosh · Pascal · MacPascal · Lightspeed 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 blocks of statements, depending on the value of an expression. case < selector > of <value 1 >: < statement 1 >; <value2 >: < statement 2 >: <Valuen>: <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 integer or character. 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+ 1 > (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