# The First Book of Macintosh Pascal — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-2fccf382c44597f3d330796e9c0804a8d567c8f651acd5a496019299c40c0b6b)

Transcribed text:

Osborne McGraw-Hill

THE FIRST BOOK OF

Macintosh™

Pascal

PAUL A. SAND

Image description: A gray book cover with a red band at top holding the Osborne McGraw-Hill logo, bold white title type with a red dot over the i in Macintosh, and a scatter of overlapping colored rings with radial lines in red, yellow, green, lavender and dark purple in the lower right.

Reading notes: The trademark symbol after Macintosh is small and may be read as ™ rather than a separate mark; the logo text is set in a stylized wordmark where 'Graw-Hill' is rendered in a heavy face. Author name is printed in the lower left and is the only attribution visible.

Languages: English

[Original Image 1](https://www.vintageapple.net/files/c67944b6539b2da04dfddcc4983a56b695900f538be6c45ed8d75e7eca77a5aa/72de2fa1bef1d3850143b026.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-b6217a7c02fd8014cf1013c3cab11d1c63527424993ee24149a34d020a8108c6)

Transcribed text:

Osborne McGraw-Hill

THE FIRST BOOK OF
Macintosh™
Pascal

PAUL A. SAND

Image description: A gray book cover with a red band at the top bearing the Osborne McGraw-Hill logo, large white bold title text on the left, and a scatter of overlapping colored rings with line hands in yellow, green, red, purple, and dark purple on the right and lower portion, with author name in the bottom left.

Reading notes: The 'Macintosh' trademark symbol ™ is printed as a small superscript to the right of the word, transcribed here as ™. Faint wear marks and spots on the cover are not transcribed as text.

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-615502cccc14012689fefc248e79a6322324879c38e675a4af501c8c6a2474ab)

Image description: The image is a entirely blank white page with no visible artwork, layout elements, or text.

Reading notes: No visible text found in the image; transcript and printed fields left empty.

[Original PDF page 2](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-41e5a434cc566329116f6fd514b7ae14d59448e1086ee42c6b1fbea09f029603)

Image description: The image is a entirely blank white page with no visible artwork, layout elements, or text.

Reading notes: No visible text found; the page appears blank white.

[Original PDF page 3](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-7ecaf17a448d7b8e7a312b942a88bdd40c87f40a9802eb442017b06098aad839)

THE FIRST BOOK OF MACINTOSH™ PASCAL

Transcribed text:

Published   by
Osborne   McGraw-Hill
2600   Tenth   Street
Berkeley, California   94710
U.S.A.
For information on translations and book
distributors outside of the   U.S.A.,   please write to
Osborne   McGraw-Hill   at the above address.
Copy II Mac is a trademark of   Central   Point Software, Inc.
Macintosh is a trademark of Apple Computer, Inc.
THE   FIRST   BOOK   OF   MACINTOSH™   PASCAL
Copyright © 1985 by McGraw-Hill, Inc. All rights reserved. Printed in the
United   States of America. Except as permitted under the Copyright Act of
1976, no part of this publication may be reproduced or distributed in any
form or by any means, or stored in a data base or retrieval system, without
the prior written permission of the publisher, with the exception that the
program listings may be entered, stored, and executed in a computer system,
but they may not be reproduced for publication.
234567890   DODO   898765
ISBN   0-07-881165-1
Cindy   Hudson, Acquisitions Editor
Paul Hoffman, Technical Editor
Catherine Pearsall,   Copy   Editor
Cheryl Creager, Composition
Yashi   Okita,   Cover   Design

Reading notes: Publisher address and distributor line are partially ambiguous in reading order.

Printed product names: Copy II Mac · Macintosh

Printed dates: 1985 · 1976

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-3ccd516b0a57109c639978f45a89915924c1c28400245f7141a8504083557e78)

Transcribed text:

CONTENTS
Introduction   vii
Chapter   1   Getting Started With Macintosh Pascal   1
Chapter   2   Variables and Loops   29
Chapter   3   Macintosh Pascal: Editing and Disk   Use   83
Chapter   4   Decision Making   101
Chapter   5   Macintosh Pascal Debugging Aids   131
Chapter   6   More Data Types   151
Chapter   7   Introduction to Library Functions   175
Chapter   8   Introduction to Library Procedures   213
Chapter   9   Your   Own   Procedures and Functions   257
Chapter   10   Your   Own   Data Types   289
Chapter 11   Structured Data Types: Arrays,
Records, and   Sets   303
Chapter 12   Macintosh Pascal Structured Types   349
Index   403

Reading notes: Headline inferred from the table of contents label; no separate primary heading is printed. Some chapter titles are split across lines, so reading order of wrapped entries may be ambiguous.

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-ba00eaa13751e1fa4d5664733ea83773f25d89a6a4b66dab25eef04f3e8dbc3a)

Transcribed text:

INTRODUCTION
This book is an introduction to the Pascal programming lan-
guage and to the version of that language on the Apple
Macintosh computer. You can use this book regardless of your
level of expertise in computer programming.   If   you are an
absolute beginner, don't worry; it is our assumption that you
know nothing about either programming in general or Pascal
in particular. We will explain everything you need to know in
order to write, enter,   and   run programs in Pascal on the
Macintosh.
Even if you already have some familiarity with the Pascal
programming   language,   you   will   find   this   book   useful.
Macintosh Pascal is like no other version of Pascal you have
ever used-just as the Macintosh itself is like no other com-
puter you have used. We will attempt to explain and demon-
strate many of the major features of Macintosh Pascal, espe-
cially   thos·e   that aren't found in   "Standard"   Pascal.
Book   Philosophy
Computer programming is a skill that is learned by doing. No
book yet written can take the place of the actual experience
you will gain in designing and writing your own programs.
Realizing this, we will not. promise that simply reading this
book will make you a seasoned expert in Macintosh Pascal;
our goals are more modest. This book will
•   Provide you with a description of Macintosh Pascal's fea-
tures and how these features are used in programs.
vii

Reading notes: Hyphenated line breaks and a stray 'thos·e' spelling in the source copy Line-broken word 'lan-guage' and 'de-monstrate' spacing may affect reading

Printed product names: Macintosh Pascal · Pascal · Apple Macintosh

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-7e3c0f6559528662c3a230e68d5ab0f4f3a2ecd25c39403431b8fa709b60fb09)

Transcribed text:

•   Give you the   rules   of the language: what is legal, what
isn't legal.
•   Show you   many examples of Macintosh Pascal pro-
grams that demonstrate how the language can be used
to access many of the hardware and software features of
the Macintosh itself.
•   Provide you with some suggestions for changing the
programs presented here as well as ideas for your own
programs. Ideally, this should get you started in learn-
ing how to program on your own.
In general, the emphasis in this book will be on the final
two points: to show you how Macintosh Pascal works and to
spark your own curiosity enough to discover more on your
own. We will lean heavily on example programs throughout
the text to accomplish this.
Somewhat less emphasis will be placed on the more   "for-
mal"   aspects of Pascal: the precise rules that make one Pas-
cal statement legal and another one unacceptable. Many of
the formal rules of Pascal are designed to make sense of very
unusual program constructions, ones unlikely to occur in
everyday programming. We will forego explaining such rules
in all their mind-numbing detail. Instead, we will concentrate
on developing your intuitive   sense   for what's right and what's
wrong in Pascal.
As a user of Macintosh Pascal, you own or have access to
the documentation provided with the Macintosh Pascal soft-
ware. You should look upon this book as a   supplement   to the
Macintosh Pascal documentation, not as a replacement. The
Macintosh Pascal reference manuals are complete, concise,
and rigorous. This approach has the advantage that you may
look there for the exact rules on what you may or may not do
in your Pascal programs. The disadvantage is that it is diffi-
cult for programming novices and other programmers not
familiar with Macintosh Pascal to sort through the descrip-
tions of every last nit-picking rule and restriction to extract
the truly useful information present in the reference
manuals: the knowledge you will need   every   time you write a
Pascal program.
In this text, we provide a more leisurely and less formal
introduction to Macintosh   Pascal.   We concentrate on the
"good   parts" of Macintosh Pascal: those that can be used eas-
ily by both programmers unfamiliar with either Pascal and
viii   The First Book of Macintosh Pascal

Reading notes: Reading order may be affected by two-column layout and a bullet list at the start of the excerpt.

Printed product names: Macintosh Pascal

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-cafe0a3be899fca206580c13a1fa5a5e4ea208502edff9d0ab9e1a49a90aebb7)

Transcribed text:

programmers who know Pascal but may not be acquainted
with the Macintosh's version of the language.
Why Learn to Program?
As you probably know, everything the Macintosh (or any
other computer) does is controlled by its software: programs
that tell the computer what to do in various situations and
how to accomplish useful tasks.   Learning to program   is,
simply stated, discovering how to tell the computer to   "do
things."
For many people, computer use is restricted to using pro-
grams someone else has written. Given the increasing sophis-
tication and usefulness of commercially available computer
software, this is a perfectly workable strategy for many, if not
most, computer users. You have an inalienable right   not   to
learn to program your computer, if you so choose.
Having said that, however, here are some reasons why you
might, after all, want to undertake the task of writing your
own programs:
•   Learning to program will give you a better idea of how
the computer works and what it can and cannot do.
•   Programming is, like mathematics, an intellectual dis-
cipline that is inherently worth knowing.
•   Knowing how to program can stand you in good stead
when a computer problem arises at work or at home for
which no available prewritten software applies. Depend-
ing on your expertise, you may be able to write a pro-
gram to solve the problem, often with less time and
expense than if you had sought commercially available
software for the same purpose.
•   Programming can be profitable. People who don't know
how (or don't have time) to program will pay you money
to make their computer jump through designated hoops.
•   Last, but not least, programming is fun-a truly end-
less source of amusement.   If   you enjoy intellectual chal-
lenge, thinking a problem through to its solution, and
the sense of accomplishment that occurs when some-
thing works as it should, you will find programming to
be immensely enjoyable. In a sense, programming is the
ultimate computer game.
Introduction   ix

Printed product names: Macintosh · Pascal

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-f65f3c43db4e2f21a2f9f2aef0d87c4decb0a6c0ca23d6a9554e8cd8f3516d59)

Why Learn Pascal?

Transcribed text:

Why Learn   Pascal?
If   you decide to learn to program, you need to learn at least
one programming language.   In   this book, obviously, we are
suggesting you learn the programming language called   Pas-
cal.   Pascal was developed in the late   1960s   by Niklaus Wirth.
His aims were to produce a language suitable for teaching
programming   concepts   clearly   and   systematically and   to
make the language usable on a large number of computers.
His   success   is   obvious: Pascal's   popularity   has   increased
rapidly since its introduction, and versions of the language
are available on many computers, ranging from small, inex-
pensive personal computers to large mainframe systems.
Why is Pascal so popular? The primary reason is that Pas-
cal makes the job of writing, reading, and modifying comput-
er   programs   easier   than   do   many   other   programming
languages.
Here are some ways in which Pascal is a convenient lan-
guage for programmers. (You need not worry if you don't
understand all or any items on this list, by the way. We'll be
seeing how all these things work later.)
•   Pascal has   "structured"   control statements (while,
repeat, for, case, and if-then-else) that allow the pro-
grammer to write clear and concise code with the flow
of control proceeding from top to bottom. The control
flow in programs written in languages lacking these
structured control statements often contains complex
webs of if tests and goto statements.   Such   programs are
often called   "spaghetti   code"   because they are so diffi-
cult for even experienced programmers to untangle.
•   Pascal permits the programmer to break up a large
program into smaller, relatively independent procedures
and functions, each one of which performs a single, eas-
ily understood task.   Each procedure or function can
have its own set of   "private"   variables that are only used
when that   procedure   or   function   is   executed.   Each
procedure or function has well-defined input and output
parameters used for   communicating with its calling
routine. This decomposition of a large program into
modules greatly aids the programmer in both the initial
design of the program and also in any subsequent modi-
fications to the program; the modules can also be reused
x   The First Book of Macintosh Pascal

Reading notes: Running page header 'The First Book of Macintosh Pascal' and page number 'x' are at the end of the copy; reading order is otherwise continuous.

Printed product names: Pascal · Macintosh Pascal

Printed dates: 1960s

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-22ce6adf8b117a24934fd75691b3aaeeaf05f02c6a23b8a58617fd6ab4c99e9b)

Transcribed text:

in   subsequent programs,   decreasing the overall pro-
gramming effort.
•   Pascal allows programmers to define their own data
types and data structures in addition to those already
built into the language. Judicious use of this feature can
make a program more compact and easy to understand.
•   Pascal allows the use of long identifiers for variables,
procedures, and functions. This allows the programmer
to use names with mnemonic significance, another aid
in understanding a program.
Although Pascal is a good computer language, it is not a
perfect one. And it isn't suitable for all applications. Rather
than go into Pascal's deficiencies here, however, we'll merely
note that a good deal of serious software development is car-
ried out in Pascal. And even if Pascal isn't your programming
language of choice, you will find that learning Pascal will
make   learning   and   using other   programming   languages
much easier.
Why Learn Macintosh   Pascal?
As we will see in the first chapter, the   "programming   envi-
ronment"   provided by the Macintosh Pascal software is extra-
ordinarily easy to use.   In   order to write Pascal programs on a
typical computer system, you   have to learn how to use a
number of different programs, each with its own set of hard-
to-remember commands and rules. This, fortunately, isn't the
case with Macintosh Pascal: there are no complex command
sequences   to   memorize,   nor   are   there   separate   "editor,"
"compiler,"   or   "debugger"   programs to master. You need only
learn to use the Macintosh Pascal software in order to be able
to enter, run, and modify your own Pascal programs.
Macintosh Pascal uses most of the conventional elements
of the Macintosh user interface: pull-down menus, multiple
overlapping windows on the screen, mouse selection, and so
on.   In   fact, if you know how to use a word processing program
like Mac   Write or Microsoft Word, you already know nearly
everything you need in order to enter your Pascal programs
into the computer.
Macintosh Pascal is therefore an excellent way to learn
Introduction   xi

Reading notes: Headline not clearly identifiable in supplied text

Printed product names: Macintosh Pascal · Mac Write · Microsoft Word

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/1#scan-f5db4af4460cca86269e0cd6c3c6e6e71b067fa49aed22e6e80f9ba2cca79bb0)

Transcribed text:

the Pascal language. But that's not all: built into Macintosh
Pascal is the capability for you to control nearly all aspects of
your computer's operations. These capabilities include some
not offered with languages costing many times more than
Macintosh Pascal. (As before, you shouldn't worry if you don't
understand everything-or anything-on this list as yet.)
•   Macintosh Pascal provides a variety of numeric data
types that make it possible to write precise and reliable
computational programs.
•   Macintosh Pascal supplies a number of extensions to the
Standard Pascal language that make writing common
application programs easier: there is a built-in string
data type, an otherwise clause .on the case statement,
sophisticated memory management,   and direct-access
file I/0 routines, to name a few. (These final two topics
are relatively advanced, however, and won't be consid-
ered in this text.)
•   Macintosh Pascal allows programs to access most of the
capabilities of the Macintosh; for example, built-in rou-
tines callable from Pascal programs allow your pro-
grams to manipulate windows, use the mouse, the clock,
and the sound generator.
•   Probably the most interesting feature is Macintosh Pas-
cal's ability to call the QuickDraw routines and other
software contained in the Macintosh's read-only memory.
QuickDraw is an extensive   "library"   of routines that
allows   your   programs   to   perform   awesome   feats   of
graphics magic.
Macintosh Pascal, while an excellent learning environ-
ment, is not suited to writing large application programs. In
computer jargon, Macintosh Pascal is an interpreted lan-
guage, rather than a compiled one. Compared to programs
written in other languages, you may observe that your Macin-
tosh Pascal programs are rather slow. (They may very well be
fast enough for your purposes, however.) Also, your Pascal
programs can't run   "by   themselves";   the Macintosh Pascal
system must be present in the computer's memory at the
same time. This imposes a relatively restrictive upper limit
on the size of your Pascal programs.
On   balance, however,   Macintosh Pascal is an excellent
learning and programming tool for all but the most demand-
ing applications.
xii   The First Book of Macintosh Pascal

Reading notes: Possible OCR artifact in 'I/0' (likely 'I/O') within the direct-access file I/O reference.

Printed product names: Macintosh Pascal · QuickDraw

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/84fe61aaf601911e90c22574c4bc056f25141220245538b9b8a660f80236c992/The_First_Book_Of_Macintosh_Pascal_1985.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-the-first-book-of-macintosh-pascal-1985-a29e89/2.md)
