Macintosh Revealed Volume One Unlocking the Toolbox 1985
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
HAYDEN Macintosh Library Apple Press Macintosh™ Revealed Volume One Unlocking the Toolbox Stephen Chernicoff
A green book cover with a cloudy blue sky framed image of a vintage beige Macintosh computer with a green apple superimposed on its screen, a keyboard and mouse in front, and a teal wavy line across the green background.
Reading notes: The 'Hayden Macintosh Library' top banner uses stylized script for 'Macintosh Library' that is partly decorative and may be read imperfectly. The 'Unlocking the Toolbox' subtitle uses decorative italic type; the 'T' in 'Toolbox' is stylized.
- Printed product names
- Macintosh
- Languages
- English
PDF page 1
HAYDEN Macintosh Library Apple Press Macintosh™ Revealed Volume One Unlocking the Toolbox Stephen Chernicoff
A book cover with a green gradient background, a framed photo of a green apple sitting on a beige Macintosh-style computer with keyboard and mouse against a blue cloudy sky, and a teal wavy line across the middle.
Reading notes: Top-left publisher mark reads 'Apple Press' and the series name 'HAYDEN Macintosh Library' is in stylized script across the top band; the script portion is partly stylized and read as 'Macintosh Library'.
- Printed product names
- Macintosh
- Languages
- English
PDF page 2
Macintosh™ Revealed
Macintosh™ Revealed Volume One: Unlocking the Toolbox Stephen Chernicoff HAYDEN BOOK COMPANY a division of Hayden Publishing Company, Inc. Hasbrouck Heights, New Jersey and Berkeley, California
- Printed product names
- Macintosh™
- Languages
- English
PDF page 3
Apple believes that good books are important to successful computing. The Apple Press imprint is your assurance that this book has been published with the support-and encouragement of Apple Computer Inc., and is the type of book we would be proud to publish ourselves. For Ann, who likes the one with the mouse. Acquisitions Editor: MICHAEL MCGRATH Consulting Editor: SCOT KAMINS Production Editors: MARY PICKLUM, ANDREW RONEY, RONNIE GROFF Editorial Production Service: GANIS &. HARRIS, INC.: ClAIRE MCKEAN Cover design: JIM BERNARD Cover photo: WU ODOR Composition: MCFARLAND GRAPHICS &. DESIGN, INC.: JULIE QUICKEL Printed and bound by: COMMAND WEB OFFSET, INC. Library of Congress Cataloging in Publication Data Chemicoff, Stephen. Macintosh revealed. Includes bibliographical references and index. Contents: v. 1. Unlocking the toolbox- 1. Macintosh !Computer) I. Title. QA76.8.M3C48 1985 001.64 85-8611 ISBN 0-8104-6551-5 Copyright © 1985 by Hayden Book Company. All rights reseived. No part of this book may be reprinted, or reproduced, or utilized in any form or by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying and recording, or in any information storage and retrieval system, without permission in writing from the Publisher. Macintosh is a trademark of Macintosh Laboratory, Inc., licensed to Apple Computer Inc., neither of which is affiliated with Hayden Book Company. QuickDraw, Finder, and Apple Press are trademarks of Apple Computer Inc. Printed in the United States of America 1 2 3 4 5 6 7 8 9 Printing 85 86 87 88 89 90 91 92 93 Year
Reading notes: Spacing and character irregularities in the OCR text, such as 'reseived' and 'ClAIRE', may indicate misreadings. Printing sequence numerals and year line are split across lines, so reading order of the date row is uncertain.
- Printed product names
- Macintosh · QuickDraw · Finder · Apple Press
- Printed dates
- 1985 · 85-8611 · 85 · 86 · 87 · 88 · 89 · 90 · 91 · 92 · 93
- Languages
- English
PDF page 4
Preface If you're reading this book, you probably don't need to be told that Apple Computer's Macintosh is an extraordiruuy personal computer. It does things you may never have seen a computer do before, in ways you may never have imagined. Ifyou'vewondered what goes on behind the scenes to make the magic happen, this book is for you. By the time you've finished reading it, you will be able to see the inner workings of the Macintosh revealed. You'll also be able to use the User Interface Toolbox, which is built into the Macintosh, to perform the same magic in your own programs. Bear in mind before you begin programming that the Toolbox is for experienced computer users, not for beginners. So to get the most out ofthis book and the Toolbox, you should have experience (the more the better) in at least one high-level programming language. The programming examples given here are written in Pascal, but their general principles are applicable in other languages as well. If Pascal isn't your native programming tongue, you should still be able to pick up enough of it to follow the logic of the programming examples so that you can apply them in the language you prefer. The book will offer a few hints to help you over the rough spots, but in general it's assumed that you're acquainted with the syntax and semantics of standard Pascal. (For hard-core bit bangers, we've also included information on how to use the Toolbox in assembly language.) The only other assumption we've made in writing this book is that you, the reader, want to know how the Macintosh user interface works from the inside. Whether you're a professional software developer, a college student, a midnight hacker, or simply a person who likes to take watches apart and see what makes them tick, read on and behold the Macintosh revealed. STEPHEN CHERNICOFF Belmont, California iii
Reading notes: Typographic OCR errors such as 'extraordiruuy' and 'bit bangers' spacing may affect reading accuracy. Several words are split or run together (e.g., 'Ifyou'vewondered'), causing uncertain word boundaries.
- Printed product names
- Macintosh · User Interface Toolbox
- Languages
- English
PDF page 5
Acknowledgments No book is ever the product of one person working alone-particularly when a book is of the size and complexity of this one. These are some of the people who have helped me bring the book to completion, and to whom I owe a special debt of gratitude and appreciation: First and forever, to my wife, Helen, whose love and understanding through the ordeal oflivingwith an author have brought new meaning to the word "patience"; and to my parents, Murray and Annette Chernicoff, for their unwavering encouragement and support. To Chris Espinosa, manager of Macintosh User Education, and Mike Murray, manager of Macintosh Marketing, who graciously gave me the freedom to pursue this project as an independent agent. To Mike McGrath, Mary Picldum, and Nancy Hagle of Hayden Book Company, professionals all in the noblest sense of the word, whose contributions were manifold and invaluable. To David Casseres of Apple Computer, for his indispensable assistance with the programming examples and his wise and thoughtful counsel throughout. To the redoubtable Scot Kamins ofTechnologyTranslated, Inc., whose candid judgment and incisive suggestions have helped make this a better book in countless ways. To Steve Smith of Technology Translated, who executed the illus- trations with brilliance and panache. And finally, to the men and women of Apple Computer's Macintosh Division, who are as talented and creative a group of people as I have ever been privileged to work with; and to Steven Jobs, Apple's chairman of the board and general manager of its Macintosh Division, who provided the vision and inspiration for these remarkable people to bring Macintosh to reality. iv
Reading notes: Source appears to be an acknowledgments page; the 'Macintosh' product reference is a company division name rather than an advertised product.
- Printed product names
- Macintosh
- Languages
- English
PDF page 6
Contents Chapter 1 All the Tools You Need 1 How This Book Is Organized .2 How to Use This Book 4 Whats in the Reference Seed.om 4 Some Terms and Conwnd.ons 7 Chapter 2 Putting the Tools to Work 9 The LangUage Problem 9 The Trap Mechanism 11 The Stack 13 The Pascal Interface 14 Stack-Based and Register-Based Routines IS The Assembly-LangUage Interface 18 Extended Features of Pascal 18 General-Purpose Udlid.es .21 Strings .21 Bit-Level Operations 2.1 Arithmetic Operations .25 Date and Time .28 v
Reading notes: Scattered OCR errors in several entries, e.g. 'Seed.om', 'Conwnd.ons', 'LangUage', 'Udlid.es' Possible misread of page numbers such as '2.1' and 'IS'
- Languages
- English
PDF page 7
Chapter 3 vi Contents Reference 2.1 Elementary Data Structures 2.1.1 Strings and Procedures 2.1.2 String Operations 2.2 Bit-1.ewl Operations 2.2.1 Single Bit Access 2.2.2 Logical Operations 2.2.3 Word Access 2.2.4 Direct Storage 2.3 Arithmetic Operations 2.3.1 Fixed-Point Numbers 2.3.2 Fixed-Point Arithmetic 2.3.3 Long Multiplication 2.3.4 Biruuy/Decimal Conversion 2.3.5 Random Numbers 2.4 Date and Time 2.4.1 Date and Time in Seconds 2.4.2 Date and Time Records 2.4.3 Date and Time Conversion 2.4.4 Date and Time Strings Thanks for the Memory Memory Organimtion The Application Global Space The Stack and the Heap Handles and Master Pointers Relocatable and Nonrelocatable Blocks Elementary Data Types Error Reporting locking Blocks Copying and Combining Blocks Purging Blocks Reference 3.1 Elementary Data Types 3.1.1 Pointers and Handles 3.1.2 Error Reporting 3.2 Heap ADocation 3.2.1 Allocating Blocks 3.2.2 Releasing Blocks 3.2.3 Size of Blocks 3.2.4 Properties of Blocks 3.2.5 Copying Blocks 3.2.6 Combining Blocks 28 28 29 31 31 32 34 3S 38 38 37 38 39 40 41 41 43 44 45 49 49 S2 S4 S'I S9 82 83 es '10 '14 .,., .,., .,., '18 '79 '79 81 83 8S 8'1 89
Reading notes: Table of contents page numbers are garbled (e.g., '3S', ''10', '.,.,') and unreliable. Heading 'Chapter 3' appears as a chapter label rather than a primary heading; reading order of the contents list is mixed with a second section listing.
- Languages
- English
PDF page 8
.. Vil Contents a.a Reclaiming Heap Space 90 3.3.1 Free Space 90 3.3.2 Heap Compaction 92 3.3.3 Purging Blocks 9a 3.3.4 Heap Expansion 94 Chapter4 Any Port in a Storm 97 Initializing QuickDraw 97 Bits, Pixels, and Images 99 Coordinates, Points, and Rectangles 103 Calculations with Points and Rectangles 107 Polygons and Regions 111 Bit Maps 115 Graphics Ports 120 Local and Global Coordinates 125 Reference 132 4.1 Mathematical Foundations 132 4.1.1 Points 132 4.1.2 Rectangles 134 4.1.3 Polygons la6 4.1.4 Defining Polygons 137 4.1.5 Regions 138 4.1.6 Defining Regions 140 4.1.7 Setting Regions 141 4.2 Graphical Foundations 143 4.2.1 Bit Maps 143 4.2.2 Graphics Ports 145 4.2.3 Pixel Access 148 4.3 Operations on Graphics Ports 149 4.3.1 Initializing QuickDraw 149 4.3.2 Creating and Destroying Ports 150 4.3.3 Current Port 152 4.3.4 Bit Map and Coordinate System 15a 4.3.5 Port Rectangle 155 4.3.6 Clipping Region 156
Reading notes: Table of contents with OCR-like errors (e.g., 'la6', '15a', '9a', 'a.a') in page numbers Chapter heading 'Chapter4' missing space
- Languages
- English
PDF page 9
... \lUl Contents 4.4 Calculations on Graphical Entities 157 4.4.1 Calculations on Points 157 4.4.2 Coordinate Conversion 158 4.4.3 Testing for Inclusion 180 4.4.4 Calculations on One Rectangle 161 4.4.5 Calculations on Two Rectangles 163 4.4.6 Calculations on Polygons 164 4.4.7 Calculations on One Region 165 4.4.8 Calculations on Two Regions 167 4.4.9 Scaling and Mapping 169 Chapter 5 Quick on the Draw 171 Line Drawing 172 Pen Size 177 Hiding the Pen 178 Patterns and Transfer Modes 179 Direct Bit Transfer 183 Icons 189 Drawing Shapes 189 Rectangles 191 Ovals 198 Rounded Rectangles 200 Arcs and Wedges 201 Polygons 204 Regions 208 Pictures .. • 214 Reference 215 5.1 Drawing Fundamentals 215 5.1.1 Patterns 215 5.1.2 Standard Patterns 217 5.1.3 Transfer Modes 220 5.1.4 Low-Level Bit Transfer 226 5.1.5 Scrolling in a Bit Map 226 5.2 Line Drawing 228 5.2.1 Pen Characteristics 228 5.2.2 Setting Pen Characteristics .231 5.2.3 Hiding and Showing the Pen .232 5.2.4 Drawing Llnes 233
Reading notes: Table of contents text is fragmentary with OCR-style spacing and character errors such as 'Llnes' and 'lUl'. Some heading entries show uncertain punctuation and page numbers, e.g. '180' versus '160' for 'Testing for Inclusion'.
- Languages
- English
PDF page 10
ix Contents 5.3 Drawing Shapes Z35 5.3.1 Basic Drawing Operations Z35 5.3.2 Drawing Rectangles Z37 5.3.3 Drawing Rounded Rectangles Z38 5 .3.4 Drawing Ovals .240 5 .3.5 Drawing Arcs and Wedges 242 5 .3.6 Drawing Polygons .245 5.3.7 Drawing Regions .246 5.4 Pictures and Icons .247 5.4.1 Picture Records .247 5.4.2 Defining Pictures .248 5.4.3 Drawing Pictures .249 5.4.4 Icons 250 5.5 QuickDraw-Related Resources 251 5.5.1 Resource TYPe 'PAT' 251 5.5.2 Resource TYPe 'PAT#' 25.2 5.5.3 Resource TYPe 'ICON' 253 5.5.4 Resource TYPe 'ICN#' 254 5.5.5 Resource TYPe 'PICT' 255 Chapter 6 Summoning Your Resources 257 Identifying Resources 259 Resource Files .261 Access to Resources .264 Resource Attributes .270 Modifying Resources .273 Error Reporting .275 Nuts and Bolts .275 Reference .278 6.1 Resource Types .278 6.1.1 Resource TYPes .278 6 • .2 Resource Files .280 6.2.1 Opening and Closing Resource Files .280 6 .2.2 Current Resource File .281 6.3 Access to Resources .283 6.3 .1 Getting Resources .283 6.3.2 Disposing of Resources .284 6 .3.3 Generating All Resources .285 6.3 .4 Loading Resources .286
Reading notes: Table of contents entries include OCR-like irregular spacing and stray characters (e.g., '.240', '6 • .2') that may be misread. Reading order of chapter 6 subsections is uncertain.
- Languages
- English
PDF page 11
x Contents 6.4 Properties of Resources 288 6 .4 .1 Identifying Information 288 6 .4 .2 Resource Attributes 289 6.4.3 Other Properties .291 6.5 Modifying Resources .29.2 6.5.1 Creating Resource Files .29.2 6.5.2 Marking Changed Resources .293 6.5.3 Adding and Removing Resources .294 6.5.4 Updating Resource Files .295 6.5.5 Purge Checking .296 6.6 Nuts and Bolts .297 6.6.1 Error Reporting .297 6 .6.2 Resource File Attributes .298 Chapter 7 Getting Loaded 301 Code Segments 301 The Jump Table 30.2 Packages 307 Signatures and File Types 309 Finder Startup Information 310 Finder Resources 31.2 Drivers and Desk Accessories 316 The Desk Scrap 317 Nuts and Bolts 3.20 Reference 3.21 7.1 Starting and Ending a Program 3.21 7 .1.1 Starting a Program 3.21 7 .1.2 Loading and Unloading Segments 3.23 7 .1.3 Ending a Program 3.25 7 . .2 Packages 3.26 7.2.1 Standard Packages 3.26 7.2.2 Initializing Packages 328 7.3 Finder Information 3.29 7.3.1 Signatures and File Types 3.29 7 .3 .2 Finder Information Records 330 7 .3.3 Accessing Finder Properties 33.2 7 .3 .4 Startup Information 333 7.4 Desk Scrap 336 7 .4 .1 Scrap Format 336 7 .4.2 Scrap Information 337 7 .4 .3 Reading and Writing the Scrap 339 7.4.4 Loading and Unloading the Scrap 340
Reading notes: Table of contents page numbers are partially garbled with stray spacing (e.g., '3.21', '33.2', '.291'), making some page numbers uncertain. Some section numbers are missing digits or contain spacing errors (e.g., '7 . .2' for 7.2).
- Languages
- English