# Programming Primer for the Macintosh 1995 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/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-primer-for-the-macintosh-1995-775192/1#scan-1decd83f459dffb8c8355f048d1228c903353064cd249d823916c7ca08519fc5)

Transcribed text:

Programming Primer for the Macintosh®
VOLUME 1
JOHN MAY
JUDY WHITTLE
Enclosed code compiles with both Symantec® C++ and Metrowerks® Code Warrior™
AP PROFESSIONAL
2248 05552328 08/13/2015

Image description: A book cover with an abstract, geometric painted cityscape of orange, red, and yellow buildings, a navy-to-blue title panel with yellow and red lettering, and a blue floppy disk graphic in the lower right, with a barcode and AP Professional logo at the lower left.

Reading notes: The date 08/13/2015 appears in the barcode area and is partly obscured, so its reading may be uncertain. The barcode numerals 22248 and 05552328 are small and may be imperfectly read. The trademark symbols after Macintosh, Symantec, and Metrowerks and the ™ after Code Warrior are rendered small and may not be exact.

Printed product names: Symantec C++

Printed dates: 08/13/2015

Languages: English

[Original Image 1](https://www.vintageapple.net/files/1198edba45bf03403e163af55680d08349b322f87c4f0b60148c0aa51531d183/1c25b41b14d99876e5e83f95.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-f5e5b3fedb17dd2a8d5e4ef6960b90c95b8182ca0fa82ce586eef454d3fd9230)

Transcribed text:

Programming Primer for the Macintosh®
VOLUME 1
JOHN MAY
JUDY WHITTLE
Enclosed code compiles with both Symantec® C++ and Metrowerks® Code Warrior™
AP PROFESSIONAL
2248 05552328 08/13/2015

Image description: A book cover with an abstract painted cityscape of orange, red, and yellow buildings, a navy-to-blue title panel with a red stripe, and a blue floppy disk graphic in the lower right, with an AP Professional logo at lower left and a barcode along the left edge.

Reading notes: The barcode numbers along the left edge are partly obscured and the digits '2248' and '05552328' with date '08/13/2015' are read from a small, rotated sticker, so exact digits may be uncertain. The 'PROFESSIONAL' word in the AP logo is partially cut off at the bottom edge and was read from context. The date 08/13/2015 is from a rotated barcode sticker and may be a sticker-applied date rather than publication copy.

Printed product names: Symantec C++

Printed dates: 08/13/2015

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-d08c04ab630c12fc1e1d8bf889a3f7fc1d758d0d23f8f8640944f18f7642ef73)

Transcribed text:

Programming Primer for the Macintosh®

VOLUME 1

Image description: A plain white title page with bold sans-serif black text at upper left reading the book title, with 'for the' in italics and 'VOLUME 1' in capitals below.

Reading notes: Registered trademark symbol after Macintosh is small and may be approximate in transcription. Minor specks and scanning marks on the white background are not text.

Printed product names: Macintosh

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-02e7a16534838a375d758db1115cbc3bb418175cdd84819764a95d667308584f)

Transcribed text:

LIMITED WARRANTY AND DISCLAIMER   OF   LIABILITY
ACADEMIC PRESS,   INC.   ("AP")   AND   ANYONE   ELSE   WHO   HAS BEEN   INVOLVED   IN THE CRE-
ATION   OR   PRODUCTION   OF   THE   ACCOMPANYING   CODE   ("THE   PRODUCT")   CANNOT   AND   DO
NOT   WARRANT THE PERFORMANCE   OR   RESULTS THAT   MAY   BE OBTAINED   BY   USING THE
PRODUCT.   THE   PRODUCT   IS   SOLD   "AS   IS"   WITHOUT   WARRANTY   OF   ANY   KIND (EXCEPT AS
HEREAFTER DESCRIBED), EITHER EXPRESSED   OR   IMPLIED, INCLUDING,   BUT.NOT   LIMITED
TO,   ANY   WARRANTY   OF   PERFORMANCE   OR   ANY   IMPLIED WARRANTY   OF   MERCHANTABILI-
TY   OR   FITNESS   FOR   ANY   PARTICULAR   PURPOSE.   AP WARRANTS   ONLY   THAT THE MAGNET-
IC DISKETTE(S)   ON   WHICH THE   CODE   IS RECORDED IS FREE   FROM   DEFECTS IN MATERIAL
AND   FAULTY   WORKMANSHIP UNDER THE   NORMAL   USE   AND   SERVICE   FOR   A PERIOD   OF
NINETY   (90)   DAYS   FROM   THE DATE THE   PRODUCT   IS DELIVERED. THE PURCHASER'S   SOLE
AND   EXCLUSIVE   REMEDY IN THE   EVENT   OF   A DEFECT IS EXPRESSLY LIMITED   TO   EITHER
REPLACEMENT   OF   THE DISKETTE(S)   OR   REFUND   OF   THE PURCHASE PRICE, AT AP'S   SOLE
DISCRETION.
IN   NO   EVENT,   WHETHER AS A RESULT   OF   BREACH   OF   CONTRACT, WARRANTY   OR   TORT
(INCLUDING NEGLIGENCE), WILL AP   OR   ANYONE   WHO   HAS BEEN   INVOLVED   IN THE CRE-
ATION   OR   PRODUCTION   OF   THE   PRODUCT   BE LIABLE   TO   PURCHASER   FOR   ANY   DAMAGES,
INCLUDING   ANY   LOST   PROFITS,   LOST   SA   VIN   GS   OR   OTHER   INCIDENT   AL   OR   CONSEQUEN-
TIAL DAMAGES ARISING   OUT   OF   THE   USE   OR   INABILITY   TO   USE   THE   PRODUCT   OR   ANY
MODIFICATIONS   THEREOF,   OR   DUE   TO   THE CONTENTS   OF   THE   CODE,   EVEN   IF AP HAS BEEN
ADVISED   OF   THE   POSSIBILITY   OF   SUCH   DAMAGES,   OR   FOR   ANY   CLAIM   BY   ANY   OTHER
PARTY.
Any request for replacement of a defective diskette must be postage prepaid and must be accompanied by the
original defective diskette, your mailing address and telephone number, and proof of date of purchase and
purchase price.   Send such requests, stating the nature of the problem, to Academic Press Customer Service,
6277 Sea Harbor Drive, Orlando, FL 32887,   1-800-321 -5068.   APP shall have no obligation to refund the
purchase price or to replace a diskette based on claims of defects in the nature or operation of the Product.
Some states do not allow limitation on how long an implied warranty lasts, nor exclusions or limitations of
incidental or consequential damage, so the above limitations and exclusions may not apply to you.   This
Warranty gives you specific legal rights, and you may also have other rights which vary from jurisdiction to
jurisdiction.
THE RE-EXPORT   OF   UNITED ST   ATES   ORIGIN   SOFTWARE IS SUBJECT   TO   THE UNITED ST   ATES
LAWS UNDER THE   EXPORT   ADMINISTRATION ACT   OF   1969 AS AMENDED.   ANY   FURTHER
SALE   OF   THE   PRODUCT   SHALL BE IN COMPLIANCE WITH THE   UNITED   STATES DEPART-
MENT   OF   COMMERCE ADMINISTRATION   REGULATIONS.   COMPLIANCE WITH   SUCH   REGULA-
TIONS IS   YOUR   RESPONSIBILITY AND   NOT   THE RESPONSIBILITY   OF   AP.

Reading notes: Phone number spacing in '1-800-321 -5068' may be a formatting artifact. 'APP shall have no obligation' likely a typo for 'AP' in source text.

Printed dates: 1969 · 1-800-321 -5068

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-10c5ff8766d3c6dca93d2c435c270fd74bb058d008e1ed668a87497eeeaeb667)

Programming Primer for the Macintosh

Transcribed text:

Programming
Primer   for the
Macintosh®
JOHN   MAY   AND   JUDY   WHITTLE
.AP .   .
•   •
AP   PROFESSIONAL
Boston   San   Diego   New York
London   Sydney   Tokyo   Toronto

Reading notes: Authors' names and publisher imprint may be partly garbled in the extracted text

Printed product names: Macintosh

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-4a5745aad634fe8d60f80af93fbac420ae2b28aee947b5363328574d88cb408a)

Transcribed text:

This book is printed on acid-free paper   e
Copyright © 1995 by Academic   Press,   Inc.
All rights reserved.
No part of this publication may   be   reproduced or
transmitted in any form or by any   mean>,   electronic
or mechanical, including photocopy, recording, or
any information storage and retrieval system, wi thout
permission in writing from the publisher.
All brand names and product names mentioned in this book are
trademarks or registered trademarks of their respective companies.
AP   PROFESSIONAL
955 Massachusetts Avenue, Cambridge, MA   02139
An imprint of ACADEMIC   PRESS,   INC.
A Division of   HARCOURT   BRACE   &   COMPANY
United   Kingdom Edition published by
ACADEMIC   PRESS   LIMITED
24-28   Oval   Road, London NW   1   ?DX
Library   of Congress   Cataloging-in-Publication Data
May, John C.
Programming   primer for the Macintosh   I   John   C.   May and
Judith B. Whittle.
p.   cm.
Includes index.
ISBN   0-12-480621-X   (v. I : acid-free paper).   --   ISBN   0-12-480623-6
(disk: v. 1)
I.   Macintosh (Computers)--Programming.   2. C++ (Computer program
language)   I.   Whittle, Judy B.   IL Title.
QA76.8.M3M3767   1994
005.265--dc20   94-28289
CIP
Printed   in the   United   States of America
94   95   96   97   IP   9   8   7   6   5   4   3   2

Reading notes: Unclear OCR spans in copyright notice ('mean>,' and 'wi thout'), and in the CIP data (QA76.8.M3M3767).

Printed dates: 1995 · 1994 · 94-28289

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-c7ef5089ea75bfdd69e99db7291e673224101b98f514df92979a1aa9dd77ed45)

Transcribed text:

Contents
Acknowledgments   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   xiii
Chapter 1   Introduction   ...................... .   1
History of the Macintosh   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   1
Macintosh Innovations   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   2
Apple Macintosh Naming Creations   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   3
Elements Comprising a Macintosh   System   . . . . . . . . . . . . . . . . . . . . . . . . .   3
Common Peripheral Options   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   5
Connecting Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   5
Display Options   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   5
Video   Circuitry   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   6
Input Options   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   6
Apple Desktop Bus (ADB) Connections . . . . . . . . . . . . . . . . . . . . . . . . .   6
Small   Computer Standard Interface   (SCSI)   Devices   . . . . . . . . . . . . . .   7
SCSI   Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   7
Audio Input/Output Options   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   7
Audio Connections   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   8
Serial   Device Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   9
Serial   Port   Connections   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   9
Network/Connectivity Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   10
Telephone Jack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   10
v

Printed product names: Macintosh · Apple Macintosh

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-2f881664d88e19ef80092c2cb849efc72d8d0c62329230c140ff371f8c0342d6)

Transcribed text:

vi   Contents
Ethernet Port   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   10
Optional Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   11
Electrical Power and Power   Switch   . . . . . . . . . . . . . . . . . . . . . . . . . . . .   11
Programmer's   Switch   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   12
Startup   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   12
Shutdown   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   14
Sleep   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   14
Restart   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   14
Summary ........ ........ . .. .... . .. . ....... . ... . ... .. .. ......   15
Chapter 2   The   Development   Environment   . . . . . . .   15
What the Developer Needs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   17
CPU... . . . ..... . . ... . . . ..... . .... .. ... . . . ....... . . ... .. ..   17
RAM Memory   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   18
Disk Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   18
Scr eens   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   18
Peripher als   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   19
Other   Things . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   20
A Wor d about Development Environments   . . . . . . . . . . . . . . . . . . . . . . . . .   21
MPW.... . . . .. . .. ..... . . .. . .... . ... .. . . .. .. .. .. .... .. . . ..   21
Symantec Development Environment   . . . . . . . . . . . . . . . . . . . . . . . . . .   22
Metrowerks®   Code   Warrior™   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   23
A Brief Look into the Future   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   24
Summary . . ... .. . . .. . ...... .... . ... . .. .. . .. .. . . .. . . .. .... . ...   24
Chapter 3   Creating a   Simple   Program
with Symantec C++   . . . . . . . . . . . . . . . . .   25
Starting Symantec   C++   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   25
Constructing a Project   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   27
Segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   29
Creating   a   Source   File   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   30
Adding the File to the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   31
Adding Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   31
Compiling the Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   33
Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
Building an Application   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
Summary..... . ... . . . ... .. .. ... . . . . .. . . . ... ... .. .. .. ... . .. . . .   36

Reading notes: Table of contents with dot leaders; no headline or body copy identified Some words split by spacing in OCR text (e.g., 'Scr eens', 'Peripher als')

Printed product names: Symantec C++ · Metrowerks® Code Warrior™ · MPW

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-bf671b7247fc5407ffa9aa5ae2a8dd1bd6fec538385c0a6aaa668a05eb65b6c3)

Transcribed text:

Contents   vii
Chapter 4   A Review of C++, Mac   Style   . . . . . . . . . .   37
Basic Variable Types   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   38
Advanced Variable Types   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   38
Points.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   39
Rects   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   41
Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   42
Val   vs.   Var.   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   45
Arrays   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   45
Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   45
Handles   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   47
Comments   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   4   7
Constants   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   48
if   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   49
switch   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   51
while   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   52
do-while   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   52
for   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   52
break   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   53
continue   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   54
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   54
Unary   Prefixed Operators   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   54
Unary   Postfix Operators   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   56
Binary Arithmetic and Logical Operators   . . . . . . . . . . . . . . . . . . . . . . .   58
Binary Assignment Operators   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   59
Binary Comparison Operators   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   59
The Ternary Operator   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   60
The C Preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   60
Structure of a C Program   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   62
C Features Not   Used   on the Mac   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   62
Right-Left Rule   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   63
Left-Right Walk Through . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   65
Another Example   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   65
Summary . ... ...... . ... . .. . ... . .. . .... .. ...... . ........... . ..   65
Chapter 5   The Macintosh   ROM   . . . . . . . . . . . . . . . .   67
It's All in the Name:   The Toolbox   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   67
Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   67
Relationship between an Application and the Toolbox   . . . . . . . . . . . . . . . .   68
Trap Mechanism   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   69

Reading notes: Table of contents uses dotted leaders with OCR-like spacing artifacts, such as 'Points.... . .' and 'Summary . ... ...... . ...'; page numbers may be misaligned. Some entries contain irregular spacing and possible hyphen or line-break artifacts (e.g., 'Val   vs.   Var.', 'Right-Left Rule').

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-7d09ca9fe608535ac59ac0720a74ae72025846f4a6b58ee40f8079689bb7a34c)

Transcribed text:

viii   Contents
A Final Word on Traps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   73
Interface and Library Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   74
Stack   Frame Incompatibility   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   7   4
Summary..... .. ........................................ . ....   75
Chapter 6   Mac Programs and   System   Software   75
Macintosh Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   78
Desk Accessory   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   78
Device Driver   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   81
Code Resource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   82
Macintosh   System   Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   82
Event-driven Programming   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   83
Pizza Delivery Program   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   83
Types of Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   84
Structure of an Event-driven Program   . . . . . . . . . . . . . . . . . . . . . . . . .   85
Event Manager   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   87
Priority of Events   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   88
Keyboard Events:   A Revisit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   89
Auto-Key Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   89
The Desktop Interface   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   89
Summary.................... . ................ . ..............   90
Chapter 7   Toolbox   Managers   . . . . . . . . . . . . . . . . . .   91
Menu Manager   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   91
Menu Bar   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   91
Menus   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   92
Resources Involved in Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   93
How Menus Work   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   94
Menu Scrolling   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   95
Keyboard Equivalents   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   96
Window Manager   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   97
Windows   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   97
How Windows Work   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   99
Window Regions   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   99
Update Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   101
How Windows Are Drawn   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   101
Control   Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   101
How   Controls   Are Drawn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   102

Reading notes: Source text is a table of contents with dotted leaders; page numbers and some spacing are irregular (e.g., 'Stack Frame Incompatibility' page reads '7 4', 'Summary' line contains stray punctuation).

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-18c829164f58ce9772c16b326df98736aa478ea4cb2f766c4075d80e58c3f6f3)

Transcribed text:

Contents   ix
Control   States   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   102
Dialog Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   104
Dialog Types   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   104
How Dialog Boxes Are Drawn   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   105
Alerts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   105
TextEdit Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   107
List Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   107
Scrap   Manager   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   109
Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   109
Advantages of Resources   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   114
Summary   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   115
Chapter 8   QuickDraw   ........................   115
Video   Principles   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   117
The Macintosh   Screen   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   117
Shapes   Drawn by QuickDraw   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   119
Handling Lines   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   120
QuickDraw Terminology-   GrafVerbs   . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   120
Simple   QuickDraw Toolbox Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   121
Handling Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   121
Handling Round Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   123
Handling   Ovals   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   124
Handling Arcs   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   125
Handling Polygons   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   125
Handling Regions   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   127
Handling Points   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   129
Handling Pictures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   129
Example of Putting a Picture Together . . . . . . . . . . . . . . . . . . . . . . . . .   130
More QuickDraw Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   131
BitMaps/PixMaps   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   131
CopyBits   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   132
BitMap/PixMap Bounds   Value   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   134
Port Frame   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   134
The Graphics Pen   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   135
Pen Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   135
Pen Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   136
Pen and Port Frames   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   136
Text Characteristics   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   137
QuickDraw Text Routines   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   138

Reading notes: Source appears to be a table of contents with dot leaders; page numbers are not separated from section titles consistently.

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/1#scan-8e254864f579440ebeea258de011058eef3c997d2c4d6ed554e165b1a14f7468)

Transcribed text:

x   Contents
Font Frame   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   139
QuickDraw Color   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   139
Color Frame   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   140
Basic Color   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   141
Cursors   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   143
Example... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   144
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   147
Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   148
Chapter 9   Alerts   and   Dialogs   ..................   155
Alerts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   155
ParamText   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   157
Alert Project   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   157
Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   161
Button Dialog Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   161
Dialog Check Box Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   167
Radio Button Project   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   171
Dialog   Static   Text Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   177
Dialog Edit Text Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   182
Dialog Icon Project   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   188
Dialog PICT Project   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   192
Dialog   User   Item Project   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   194
Dialog   Sound   Project   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   200
Editing   Sounds   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   206
Summary   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   206
Chapter 1 O   Memory Manager   ...................   209
Stack   and Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   210
The   Stack   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   210
The Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   212
Stack   Sniffer   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   212
Memory Blocks in the Heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   213
How Heap   Space   Is Allocated..... . . . . . . . . . . . . . . . . . . . . . . . . . . . .   214
Pointers and the Heap   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   214
Handles and the Heap   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   215
Dereferencing   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   216
A   Valid   Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   219
Memory Frame   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   219

Reading notes: Source is a table of contents with dotted leaders; no primary heading or advertised content is present.

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/178956df71b83177ce8e1d8ed6a1cdebb09d188dc233339974f069153d8c6ebe/Programming_Primer_for_the_Macintosh_1995.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-programming-primer-for-the-macintosh-1995-775192/2.md)
