Programming Macintosh Pascal
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
PROGRAMMING MACINTOSH PASCAL
PROGRAMMING MACINTOSH PASCAL INCLUDES Version 2.1 John J. DiElsi Elaine S. Grossman
A book cover with a peach background showing a line drawing of a Macintosh computer with a red apple on its screen, a keyboard and mouse at the bottom, and a large blue brushstroke swirling across the image.
Reading notes: The 'Version 2.1' text is a version number rather than a date, so it is listed under printedDates only as printed; no other dates are visible.
- Printed product names
- Macintosh Pascal
- Printed dates
- 2.1
- Languages
- English
PDF page 1
PROGRAMMING MACINTOSH PASCAL
PROGRAMMING MACINTOSH PASCAL INCLUDES Version 2.1 John J. DiElsi Elaine S. Grossman
Cover illustration of a classic Macintosh computer with a red apple on its screen, a keyboard and mouse below, all wrapped by a large blue ribbon-like brush stroke on a peach background.
Reading notes: "2.1" in "Version 2.1" is a version number rather than a date; listed under printedDates only because it is a visible numeric printed value. Author names and title are clearly printed; no fine print visible.
- Printed product names
- Macintosh
- Printed dates
- 2.1
- Languages
- English
PDF page 2
The image is a entirely blank white page with no visible artwork, layout elements, or text.
Reading notes: No visible text or imagery was found in the scan; the page appears blank.
PDF page 3
A plain blue sheet of paper with a faint vertical fold or crease line running down the center and no visible text or artwork.
Reading notes: No visible text appears on the page, so transcript and printed fields are empty. A faint vertical crease runs down the middle; no copy is visible along it.
PDF page 4
PROGRAMMING MACINTOSH PASCAL John]. DiElsi · Elaine S. Grossman Macmillan Publishing Company New York Collier Macmillan Publishers London
Reading notes: Author name 'John J. DiElsi' may be OCR-affected; spacing and punctuation uncertain
- Languages
- English
PDF page 5
To our parents LEAH and ERNEST PARIS TINA and JOHN DIELSI for their love, encouragement, and self-sacrifice Copyright © 1987, Macmillan Publishing Company, a division of Macmillan, Inc. Printed in the United States of America All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher. Macmillan Publishing Company 866 Third Avenue, New York, New York 10022 Collier Macmillan Canada, Inc. library of Congress Cataloging-in-Publication Data DiElsi,JohnJ. Programming Macintosh Pascal. Includes index. 1. Macintosh (Computer)--Programming. 2. PASCAL (Computer program language) I. Grossman, Elaine S. II. Title. QA76.8.M3D543 1987 005.265 86-28495 ISBN 0-02-329521-X Printing: 1 2 3 4 5 6 7 8 Year: 7 8 9 0 1 2 3 4 ISBN D-02-329521-X
Reading notes: Printing sequence line 'Year: 7 8 9 0 1 2 3 4' and ISBN check digit 'D-02-329521-X' may be OCR variants of '0' and of the printing number line. Catalog classification '005.265' and control number '86-28495' are library codes rather than dates.
- Printed dates
- 1987 · 86-28495 · 005.265 · Year: 7 8 9 0 1 2 3 4
- Languages
- English
PDF page 6
Preface When you pick up a book, it's always nice to have some notion of what it is about before you open the cover. The title of this book clearly states the purposes of this text: (1) to present a structured approach to the programming language Pascal, and (2) to show how to implement Pascal on the Macintosh microcomputer. The Macintosh Pascal language environment is ideal for learning program- ming. The pull-down menus allow beginning programmers to concentrate on Pascal without being encumbered by sometimes difficult and confusing editing and operating instructions found in many systems. Also included in this unique system is the ability to see a program listing, text output and graphic output on the monitor screen simultaneously. Debugging of programs is simplified by displaying the contents of selected memory locations at specific points in a program. A new update of Macintosh Pascal called Version 2.1 is now available. This text can be used by those employing either the new Version 2.1 or its prede- cessor. The differences between these two versions, as they apply to the text, are identified in Appendix H. Improvements offered in the newer version include the ability to use Macin- tosh Pascal with a hard disk, the removal of copy protection, the ability to write larger programs, the use of tabs to organize program documentation, the ability to pass procedures and functions as parameters, and the addition of new func- tions and procedures. Some of these embellishments are not discussed in this text since we felt it best to concentrate on the fundamentals. We have used our teaching experience to create a text that offers a logical, organized presentation of the rudiments of structured programming. v
- Printed product names
- Macintosh · Pascal · Macintosh Pascal · Version 2.1
- Languages
- English
PDF page 7
Vi PREFACE PART ZERO:. THE MACINTOSH ENVIRONMENT The display capabilities available on the Macintosh distinguish it from most other microcomputers by emphasizing a menu-driven, visual approach to the use of an operating system. Part Zero presents a summary of the instructions needed to create and execute Pascal programs on the Macintosh. Those who are already familiar with this operating system may choose to skim over or entirely skip Chapter 1. If you have not worked with this system, this chapter provides the commands essential to the use of the operating system. The second chapter in this part of the book introduces the Macintosh Pascal system. Although the -menus provide many options, only those necessary to create, edit qnd execute a Pascal program are covered. The chapter also contains several Hands-On Exercises that can lead you through processes helpful in using Macintosh Pascal. Two appendices to Part Zero supplement the material presented in these two chapters. Appendix A gives a listing of the key equivalents that can be used to select menu choices from the keyboard instead of with the mouse. Appendix B contains a step-by-step process that enables you to initialize a disk if you need additional space in which to store programs. Although the Pascal disk can store programs, the available space on it is very limited, and therefore the creation and use of a disk solely for the storage of programs is desirable. The instructions in Appendix B do not produce a "startup disk"- one that can be used to start the system. We feel it is very important that you become familiar with the system before going on to Pascal, as you can then focus your attention fully on the fundamentals of creating a program. PART ONE: FIRST STEPS IN PASCAL PROGRAMMING This part is designed to introduce both a methodology for problem-solving as well as a selection of fundamental Pascal tools with which to work. The Pascal statements presented in this part of the book provide the means for the simple input, output, and processing of data. In addition to learning the vocabulary, syntax, and grammar of Pascal, the art of constructing well-structured programs must also be developed. Most pro- grammers find this art difficult to learn. For this reason, the text provides a number of features to guide you. Chapter 3 is entirely devoted to describing a six-step methodology that you can use for problem solving. The steps are further enhanced by the use of the input-processing-output (IPO) charts and Nassi- Shneiderman (N-S) charts. Since the process is essentially independent of a programming language, no knowledge of Pascal is required at this stage. Although this methodology may seem tedious, it will help you to design and create the solutions to complex problems. Uppercase letters are used to represent input, processing, and output quantities.
Reading notes: Some words show OCR-style errors such as 'qnd' and 'PART ZERO:.' in the source copy.
- Printed product names
- Macintosh · Pascal · Macintosh Pascal
- Languages
- English
PDF page 8
PART Two: PROGRAMMING STRUCTURES vii In addition to introducing the basic components of any Pascal program, Chapter 4 discusses generic data types. If you only know BASIC, the concept of a data type and its declaration is relatively new and must be clearly understood at an early stage. Although many data types are presented, the problems in the text primarily use real, integer, string, and Boolean. Chapter 12 ("Modular Pro- gramming") could be inserted here, however, we feel that you will get a better understanding of the concepts presented in Chapter 12 after you've had some experience in the creation of complex programs. Chapter 5 discusses how data can be sent from main memory to the outside world, and how data can be entered from the outside world into main memory. Once data resides in main memory, they can be output to the Text window of the Pascal screen, the Drawing window of the screen, a data file stored on a disk, or a printer. These are four different ways to display the same results. This chapter also shows how data can be entered into main memory from the key- board or an existing data file. You can choose some of these methods, or all of them. A more extensive discussion of files is given in Chapter 13 ("Advanced Data File Techniques"). The last chapter of Part One shows how calculations on data are performed in order to achieve desired results. To emphasize the concept of a labeled mem- ory location, a Hands-On Exercise on the use of the Observe window is included. The techniques demonstrated by this exercise should prove useful for finding errors in larger programs. PART TWO: PROGRAMMING STRUCTURES Part Two provides the next steps in developing your programming skills by employing the theory of structured programming and introducing sequential, selection, and repetition programming constructs. It presents material that allows you to solve problems that involve the computer making decisions and repeating processes. This part discusses built-in precoded routines and shows how large quantities of data can be handled with an economy of program code. Many useful built-in functions and procedures are presented in Chapter 7. You may be selective in your reading by choosing those which are of interest or benefit to you. You may find the graphic capabilities of the Macintosh partic- ularly appealing. Chapter 8 shows you how to create and develop your own functions and procedures. The ability to break up a large program into smaller components, functions and procedures, is the basis of modular design. The functions and procedures permit the passing of values between parts of a program and may cause some difficulty, but the understanding of this process and the ability to do it is important. Chapter 9 presents the second of the three basic programming structures: the decision structure. Until this point, all program statements were executed in sequential order. The if. .. then .. .else and case statements in this chapter permit programs to select one of many alternative paths of execution.
- Languages
- English
PDF page 9
Viii PREFACE The last of the three basic structures (looping) is presented in Chapter 10. The for, while, and repeat statements in the chapter allow a computer to repeat- edly perform the same operations on different sets of data. The techniques of summing and counting using loop structures are also demonstrated. Chapter 11 introduces arrays and records, which allow your program to handle and store large amounts of data with a minimum of coding. An under- standing of these fundamental data structures provides a good basis for imple- menting files (Chapter 13) and more sophisticated data structures. Elementary algorithms for common operations performed on these structures (searching, sorting, and merging) are covered in this chapter. PART THREE: ADVANCED PROGRAMMING CONCEPTS The programming skills and techniques presented in the previous parts of this book are now applied to the solution of substantial problems. This part presents the theory behind the construction of solutions, their implementation using files, and the introduction of additional data types and structures. Chapter 12 ("Modular Programming") presents the theory behind princi- ples of structured programming. Although these principles were followed throughout the text, their formal development at this point can be appreciated since you now have a greater familiarity with programming. The contruction of user-friendly programs that display programming menus offers practical real- world applications of these theoretical ideas. Chapter 13 ("Advanced Data File Techniques") carries the organization of array and record data structures into files. One application from Chapter 12 that was solved with an array of records is also solved in this chapter with a file of records. The creation, searching, and updating of files are detailed. The more sophisticated Pascal structures of enumerated data types, pointer data types, and recursive subprograms are introduced in Chapter 14 ("Advanced Pascal Structures"). Simple examples are presented and discussed. These topics provide a good introduction to an elementary course in data structures. It is beyond the scope of this book to present exhaustive coverage of each feature of Macintosh Pascal. We selected those topics which we deemed of great- est importance and direct you, for further information, to the manual that accom- panies your version of Pascal. GENERAL FEATURES Where applicable, each chapter concludes with a section on typical program- ming errors, including a description of the errors and examples. These sections highlight the errors commonly made by novice programmers. Each chapter ends with Nonprogramming and/or Programming Exercises. The former are designed to test a mastery of programming concepts; and the latter, a mastery of programming techniques. Answers to selected Nonprogram-
Reading notes: Possible typo 'contruction' in Chapter 12 description Source text is cut off mid-sentence at the end
- Printed product names
- Pascal · Macintosh Pascal
- Languages
- English
PDF page 10
COURSE OF STUDY
COURSE OF STUDY ix ming and Programming Exercises are in Appendix G. Answers to the remaining Nonprogramming Exercises and additional Programming Exercises can be found in the Instructor's Resource Manu,al. Each programming exercise is preceded by the code (B) or (G) to indicate that the problem is of a business or general nature. In addition to the appendix of selected answers, six other appendices pro- vide useful summaries for quick reference of important facts. Both Examples and Problems are contained in the text. Examples consist of program segments that appear in a two-column format. The Pascal code is in the left column and its corresponding explanation in the right column, making it easier to "see" the code and its explanation. Problems differ from Examples in that they consist of problem statements followed by the complete process required to produce the Pascal solution. For further clarity, keywords or phrases appear in darker print. This helps you to distinguish between Pascal code and the text used to interpret this code. To avoid duplicating portions of programs to show output on the printer as well as the screen, program solutions throughout the text are coded to pro- duce output to the screen only. It is not difficult to make minor changes in these programs to send output to the printer. COURSE OF STUDY This text was written for use in an introductory college computer course that uses a structured high-level language. It is also appropriate for a high school course, especially as part of an advanced placement program in computer sci- ence, or it can serve as a self-instruction guide for a computer enthusiast who wishes to learn Pascal in a Macintosh environment. In any case, Part Zero may be omitted if you are already familiar with the programming environment. Chapters 3 through 6 should be covered in the order presented. The theory presented in Chapter 12 may be introduced in Chapter 4 if so desired. The procedures and functions presented in Chapter 7 can be selectively covered. However, you should be aware that the examples in the remainder of the text may use some of the functions and procedures of Chap- ter 7. To emphasize the structure of Pascal, programmer-defined functions and procedures (Chapter 8) are introduced before selection (Chapter 9) and itera- tion (Chapter 10). This order also allows programmer-defined subprograms to be included in examples and problems in the chapters that follow. Files (Chapter 13) should be included in an introductory course, while selected topics in Chapter 14 may be covered if time permits.
Reading notes: Source contains OCR-style hyphenation and spacing artifacts, e.g. 'Manu,al' and 'pro-duce'. Reading order of the fragment at the start is uncertain as it begins mid-document.
- Printed product names
- Pascal · Macintosh
- Languages
- English
PDF page 11
x Acknowledgments We wish to express our thanks to the students we have taught over the years because teaching is a two-way learning experience, and much that is contained in the pages of this text is the product of what we have learned from those students. We would also like to thank Paul Hoffman, Corey Schou, and David Marotta for their time and helpful suggestions. Special thanks are due to our colleagues at Mercy College, Westchester County, New York, for their encour- agement, and to Philip Cecchettini, Barbara Pickard, Larry Lazopoulos, Linda Purrington, and Bernie Scheier for their guidance and support. A great measure of our success is due to the support and patience of those closest to us: our family and friends. It is they who have had to put up with the late hours and our uneven temperaments. They deserve our sincere gratitude and thanks. John]. DiElsi Elaine S. Grossman December 1986
Reading notes: Name 'John J. DiElsi' appears as 'John]. DiElsi', possibly an OCR or typesetting artifact
- Printed dates
- December 1986
- Languages
- English