# Programming With Macintosh Turbo Pascal 1987 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/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-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-ae926c3f0c6f3e296b70bd4a56e1a7a857cf5bb9356cbaf8f57f0906ece9ca66)

Transcribed text:

PROGRAMMING WITH
MACINTOSH™ T.M.
TURBO PASCAL®
TOM SWAN

Image description: A book cover with a blue background, a black diagonal band behind the title, and a square illustration of a cloud over geometric solids (cylinder, cube, tower, sphere, and cone) on a dark blue field, with the author name at the bottom.

Reading notes: Trademark symbols (T.M. and ®) are small and read as approximations of their placement. Title is split across three lines with the 'MACINTOSH' line the largest; reading order follows visual hierarchy.

Printed product names: Turbo Pascal

Languages: English

[Original Image 1](https://www.vintageapple.net/files/7c41a723240f6d6a5a2536aaef2137f24cb78adb91a3caf4b31f1382ec8d5cc5/e23fec4e9be11eb01d75c0eb.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-2cf39849daa82344855bebfbd1bf932bf18517710b2bf6a6ff1cf0ac68d8c5ea)

Transcribed text:

PROGRAMMING WITH
MACINTOSH™ T.M.
TURBO PASCAL®
TOM SWAN

Image description: A book cover with a blue background, a black diagonal band behind the title, and a central square illustration of a cloud above geometric solids (a cylinder, a box, a sphere, and a cone) on a dark blue ground, with the author's name at the bottom.

Reading notes: Trademark marks (™ and ®) and the small 'T.M.' are rendered as superscripts and were transcribed as printed; the ® after TURBO PASCAL is small and may be ambiguous.

Printed product names: Turbo Pascal

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-d9a5c266767985143f0edda8e0ab6fc57b1e1d6c0fef5fae3ca728b99d00228b)

PROGRAMMING WITH MACINTOSH TM TURBO PASCAL

Transcribed text:

PROGRAMMING   WITH
MACINTOSH   TM
TURBO   PASCAL
Tom   Swan
John Wiley &   Sons,   Inc.
New York   ·   Chichester   ·   Brisbane   ·   Toronto   ·   Singapore

Reading notes: Transcript is intentionally empty because the exact extracted text is preserved separately; fields were filled from the supplied copy only. The headline is the book title, so Macintosh and Turbo Pascal are listed as named subjects rather than priced advertised products. Layout and line breaks are inferred from the supplied copy's spacing and may not match the original page exactly. The 'TM' trademark marking is shown as printed in the supplied copy.

Printed product names: Macintosh · Turbo Pascal

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-fb7a1d614551156d6b58f4e016108b48dbe840e086660bf03697203ac5687990)

Transcribed text:

To Bill and Carmen
Never as near as friends should be
Turbo Pascal is a registered trademark of Borland International, Inc.
IBM is a registered trademark of International Business Machines, Inc.
CP/M is a trademark of Digital Research, Inc.
Apple, Macintosh, Mac, the Apple logo, the Macintosh logo, MacWrite, MacPaint,
and MacDraw are trademarks of Apple Computer, Inc.
Publisher: Stephen Kippur
Editor: Therese   A.   Zak
Managing Editor: Ruth Greif
Editing, Design & Production: G&H   SOHO,   Ltd.
This publication is designed to provide accurate and authoritative information
in regard to the subject matter covered.   It   is sold with the understanding that
the publisher is not engaged in rendering legal, accounting, or other profes-
sional service. If legal advice or other expert assistance is required, the services
of a competent professional person should be sought.   FROM   A DECLARA-
TION   OF   PRINCIPLES JOINTLY ADOPTED BY A COMMITTEE   OF
THE AMERICAN BAR   ASSOCIATION   AND A COMMITTEE   OF
PUBLISHERS.
Copyright © 1987 by Tom Swan
All rights reserved. Published simultaneously in Canada.
Reproduction or translation of any part of this work beyond that permitted
by section   107   or   108   of the 1976   United   States Copyright Act without the per-
mission of the copyright owner is unlawful. Requests for permission or fur-
ther information should be addressed to the Permission Department, John Wiley
& Sons, Inc.
Library of Congress Cataloging-in-Publication Data
Swan, Tom.
Programming with Macintosh Turbo Pascal.
1. Macintosh (Computer)-Programming. 2. PASCAL
(Computer program language) 3. Turbo Pascal (Computer
program)   I.   Title.
QA76.8.M3S95 1987   005.265   87-18980
ISBN 0-471-62417-9
Printed in the   United   States of America
87   88   IO   9 8 7 6 5 4 3 2 I

Reading notes: Printed dates include a catalog number and a repeated '87' that may be a print run marker rather than a date

Printed product names: Turbo Pascal · Macintosh · MacWrite · MacPaint · MacDraw · CP/M · IBM

Printed dates: 1987 · 1976 · 87-18980 · 87 · 88

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-78e7f0cff0fdbf3297ac9cebfc182e070f3a2d4095995367b14541bfdbeef801)

Transcribed text:

Preface
Good tools simplify complex tasks. Good software tools help you write pro-
grams the way saber saws help carpenters build houses.   You   wouldn't expect
carpenters to build their own saws and hammers. And you shouldn't have to spend
months constructing your own software tools merely to add features that every well-
designed Macintosh program must have.
You   probably know that the Macintosh comes with a programmer's toolbox,
which controls just about everything the computer does. The Turbo Pascal soft-
ware tools in this book enhance the toolbox by adding new commands to Pascal
in the form of library   units,   which you compile ahead of time and store on disk
until you need them.
Chapters list the complete source code for several units. They also include de-
tailed technical descriptions, instructions, and many programming examples. In
here you'll find tools for building program shells, operating the mouse, using
QuickDraw graphics, creating windows, designing dialog boxes, reading and writing
disk files, transferring among applications, and clicking and dragging icons. By
using these and other tools and by following the examples, you'll master the dif-
ficult art of programming the Macintosh in Turbo Pascal.   You'll   also find clear
instructions and hints about managing memory, a controversial topic and a
recognized breeding ground for program bugs.
You're   ready to use these tools if you have any size Macintosh, your Turbo Pascal
disks, and a fundamental knowledge of Pascal programming.   You   don't have to
be an expert, full-time programmer to understand this material, but you should
have read one or more language tutorials-or have completed a Pascal introduc-
tory course-and be able to write, compile, and run at least a small program of
about   200   lines or so.
Who are you?   You   might be a student interested in a programming career.   You
might   be   a professional programmer with deadlines fast approaching and plenty
of IBM PC or other computing experience but only a smattering of knowledge
about the Mac.   You   might own or work for a business that needs special software
but you're reluctant to gamble time and money on a custom program.   You've   heard
iii

Reading notes: Preface heading is not a distinct primary headline; headline set to null Some hyphenated line breaks in the source text (e.g., 'pro-grams', 'de-sign') may affect reading order

Printed product names: Macintosh · Turbo Pascal · IBM PC

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-4c12781eb2e4f74f5f72496a91db2f53a7b0a255d1ee47f1126c0058c5a377cd)

Transcribed text:

iv   ==   Programming   with Macintosh Turbo Pascal
all the horror stories and you know that to do the job right, you have to do   it
yourself.   Or   you might be a serious hobbyist with more than a casual interest in
programming.   If   you're any of these, you'll find many uses for my software tools.
I wrote the tools in this book out of necessity. When I needed a hammer, I
made one. And then I used hammer to build saw, and saw to build plane, and so
on, until I had a kit full of Turbo Pascal tools for building Macintosh software.
It   is my sincere wish that you get as much out of them as I have.
I am grateful for the contributions of many people including Teri Zak, Heather
Goguen, Ruth Greif, and Claire McKean. Joe Schrader carefully critiqued the en-
tire manuscript and made many fine suggestions. My wife and assistant, Anne Swan,
helped in ways too numerous to list. I am also thankful for the professional care
and expertise from everyone at John Wiley   &   Sons, Inc. and associates.
Tom Swan

Reading notes: Running header 'iv == Programming with Macintosh Turbo Pascal' is a page header rather than a primary heading

Printed product names: Macintosh Turbo Pascal

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-98afe0773456c10faa0b88cee5079b7c87c8d61443d64436a47f5ad10c9c8669)

Transcribed text:

Note to the Reader
Just before this book was printed, Apple Computer announced new system
software with features to take advantage of its   SE   and Macintosh II computers.
Although most changes have no effect on the programs in this book, a few icon
symbols are different and no longer match those in Chapter 6 and elsewhere. For
example, the caution, note, and stop alert symbols (see Figure 6.7 on page 260)
have the new designs shown in the table here. The toolbox functions in the center
of the table produce the symbols on the right for   System   versions 4.1 and later;
they produce the symbols on the left for earlier releases.
Original   Toolbox   New
icon   function   icon
[IiJ   CautionAlert   ~
rs   NoteAlert   [E .
[ID   Stop   Alert
v

Reading notes: Icon symbol glyphs in the table are garbled and uncertain Table reading order for icon columns is ambiguous

Printed product names: Apple Computer · SE · Macintosh II · System

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-f5a4aae05a0dd6f847b6f75a49c657305e457ec2739658bb8aafff1b735f87b8)

Transcribed text:

Contents
one   Introducing Turbo   Pascal   1
How to Get the Most from This Book   1
Programming by Example   2
Someone's in the Kitchen with Turbo   3
About Debuggers   4
Using Turbo with   Single-Sided   Drives   6
Setting   Up a Program Disk   6
Starting Turbo Pascal   7
Compiling to Disk   9
Turbo's Menus   11
The Apple Menu   11
The File Menu   12
The Edit Menu   13
The   Search   Menu   15
The Format Menu   16
The Font Menu   17
The Compile Menu   18
The Transfer Menu   20
two   Textbook Programs and Dumb Terminals   21
Line Numbers   21
zyping   and Compiling Number   22
Number Play-by-Play   26
vii

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-0eb92917dd985ae03f583a29c88fa7ae65bf98bb72bb5393c20426ff4bb08c1d)

Programming with Macintosh Turbo Pascal

Transcribed text:

viii   ==   Programming   with   Macintosh Turbo Pascal
Tabbing in Text   31
TABS.INC   Play-by-Play   34
Removing Tabs from Text   35
DeTab   Play-by-Play   38
Adding Tabs to Text   38
ReTab   Play-by-Play   41
Converting IBM PC Programs to Macintosh   41
IBM   PC   Identifiers Changed or Deleted   42
New Macintosh Identifiers Not in IBM   PC
Turbo   Pascal   51
three   Turtle Graphics vs. QuickDraw   55
Turtle Graphics   57
A   Star   Is Born   57
Star Play-by-Play   59
The   Twirling   Turtle   60
Twirl   Play-by-Play   62
QuickDraw Graphics   64
Above the Coordinate   Plane   64
Points and Rectangles   67
A   Graphics   Shell   70
GraphShell   Play-by-Play   72
Saving Graphics in MacPaint Files   77
Pens   and Lines   77
Drawing Text   82
Chars   Play-by-Play   86
Using   Rectangles   88
Drawing Curved   Shapes   90
Drawing Modes   92
Bit Maps   95
Regions   97
Regions   Play-by-Play   99

Reading notes: Table of contents entries show the heading as 'viii == Programming with Macintosh Turbo Pascal', so the primary heading may be a running header rather than a title. Some entries contain irregular spacing and capitalization, such as 'three Turtle Graphics vs. QuickDraw', which may be an OCR artifact.

Printed product names: Macintosh Turbo Pascal · IBM PC · MacPaint · QuickDraw

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-e78ab21a41f8b3e5f21cca115a5b23a6d3589603358276d4b81b1bd18e57cea2)

Transcribed text:

Contents   ==   ix
Using   screenBits   100
Animate   Play-by-Play   104
Fractals   110
Fractal   Play-by-Play   116
four   In   Any   Event   121
The   Parts   of an Application   122
Global Declarations   122
Program   Actions   123
Display Handlers   123
Event Handlers   124
Initializations   126
Program   Engine   126
Developing an Application-ApShell   128
ApShell   Play-by-Play   136
ApShell Global Declarations (26-50)   138
ApShell   Program   Actions (54-175)   140
ApShell Display Handlers (179-216)   144
ApShell Event Handlers (220-339)   145
ApShell Initializations (343-393)   153
ApShell   Program   Engine (397-456)   154
ApShell Resources   156
Creating a Resource Text File   156
ApShell Resource   Play-by-Play   159
MacExtras   Unit   163
MacExtras   Play-by-Play   170
five   Windows, Text, and   Scroll   Bars   181
Heaps Are for Keeps   181
All About Handles   183
Molding Your   Own   Handles   190
Disposing Handles   194
Multiple Windows   194
MultiWind   Play-by-Play   200

Reading notes: Source is a table of contents with no advertised products, prices, or dates; headline is null because no primary heading is printed.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-e87708acc03c49f9b4e194ec7bc64e4619715f8569b97441c5fe5697e48475f6)

X = Programming with Macintosh Turbo Pascal

Transcribed text:

X   =   Programming   with   Macintosh Turbo Pascal
six
Text in Windows
MacStat Play-by-Play
Picture Windows
Picture Play-by-Play
Text and   Scroll   Bars
Reader Play-by-Play
TextUnit   Play-by-Play
Computer Conversations
Standard File Dialogs
SF   Play-by-Play
Dialog Item Lists
Buttons Play-by-Play
Dialogs in Memory
Alerts
Quit Play-by-Play
Radio Buttons
Radio Play-by-Play
Simple   Data Entry
Entry Play-by-Play
Check Boxes
Options Play-by-Play
Using   Options in Programs
Error Messages
ErrorUnit   Play-by-Play
Testing Error Messages
Erffest   Play-by-Play
Data Entry Forms
DataEntry Play-by-Play
Dialog Tools
DialogUnit   Play-by-Play
203
209
211
216
217
234
236
245
246
250
252
256
259
259
264
265
271
272
277
279
283
284
285
288
290
294
295
316
324
328

Reading notes: Primary heading read from the first line of the extracted source; reading order of the table of contents entries is otherwise clear. Several entries contain irregular spacing, possibly from extraction; spelling preserved as supplied.

Printed product names: Macintosh Turbo Pascal

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/1#scan-aada0dffee4228198d665950825038e65b1667d786819ffa9fbba2a93cc4d51e)

Transcribed text:

seven   Units   as Software Tools
Developing a Software Library
Installing   Units   in the   Compiler
The UnitMover Information Window
Transfer Tools
Transfer   Play-by-Play
Let's Do Launch
Launcher   Play-by-Play
Icon Tools
IconUnit   Play-by-Play
Clicking and Dragging Icons
IconTest   Play-by-Play
Printing Tools
ImageUnit   Play-by-Play
Using   ImageUnit Tools
Putting Your Tools to Work
MacLister   Play-by-Play
Bibliography
Software
Books
Index
Contents   ==:   xi
333
333
334
335
336
338
340
343
344
349
353
360
361
369
374
375
392
395
395
395
397

Reading notes: Some page numbers and heading indentation in the table of contents may be ambiguous in reading order

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/6e52273c2e798ae63bcf99c3463d107d22c867dc25479abf91818dc0fb74b745/Programming_With_Macintosh_Turbo_Pascal_1987.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-programming-with-macintosh-turbo-pascal-1987-e2439b/2.md)
