Inside Mac OS X: System Overview Is Intended for Anyone Who Wants to Develop Software for Mac OS X
Total Page:16
File Type:pdf, Size:1020Kb
Inside Mac OS X System Overview July 2002 Apple Computer, Inc. and TrueType are trademarks of THE WARRANTY AND REMEDIES SET © 2000–2002 Apple Computer, Inc. Apple Computer, Inc., registered in FORTH ABOVE ARE EXCLUSIVE AND All rights reserved. the United States and other countries. IN LIEU OF ALL OTHERS, ORAL OR WRITTEN, EXPRESS OR IMPLIED. No No part of this publication may be Carbon, Quartz, and Velocity Engine Apple dealer, agent, or employee is reproduced, stored in a retrieval are trademarks of Apple Computer, authorized to make any modification, system, or transmitted, in any form or Inc. extension, or addition to this warranty. by any means, mechanical, electronic, Enterprise Objects, Enterprise Objects photocopying, recording, or Framework, NeXT, Objective-C, and Some states do not allow the exclusion or otherwise, without prior written OpenStep are registered trademarks limitation of implied warranties or permission of Apple Computer, Inc., of NeXT Software, Inc., registered in liability for incidental or consequential with the following exceptions: Any the United States and other countries. damages, so the above limitation or person is hereby authorized to store Java and all Java-based trademarks exclusion may not apply to you. This documentation on a single computer are trademarks or registered warranty gives you specific legal rights, for personal use only and to print trademarks of Sun Microsystems, and you may also have other rights which copies of documentation for personal Inc., in the United States and other vary from state to state. use provided that the documentation countries. contains Apple’s copyright notice. Netscape Navigator is a trademark of The Apple logo is a trademark of Netscape Communications Apple Computer, Inc. Corporation. Use of the “keyboard” Apple logo OpenGL is a registered trademark of (Option-Shift-K) for commercial Silicon Graphics, Inc. purposes without the prior written consent of Apple may constitute PostScript is a trademark of Adobe trademark infringement and unfair Systems Incorporated. competition in violation of federal PowerPC is a trademark of and state laws. International Business Machines No licenses, express or implied, are Corporation, used under license granted with respect to any of the therefrom. technology described in this book. Simultaneously published in the Apple retains all intellectual property United States and Canada. rights associated with the technology Even though Apple has reviewed this described in this book. This book is manual, APPLE MAKES NO intended to assist application WARRANTY OR REPRESENTATION, developers to develop applications EITHER EXPRESS OR IMPLIED, WITH only for Apple-labeled or RESPECT TO THIS MANUAL, ITS Apple-licensed computers. QUALITY, ACCURACY, Every effort has been made to ensure MERCHANTABILITY, OR FITNESS that the information in this document FOR A PARTICULAR PURPOSE. AS A is accurate. Apple is not responsible RESULT, THIS MANUAL IS SOLD “AS for typographical errors. IS,” AND YOU, THE PURCHASER, ARE Apple Computer, Inc. ASSUMING THE ENTIRE RISK AS TO 1 Infinite Loop ITS QUALITY AND ACCURACY. Cupertino, CA 95014 IN NO EVENT WILL APPLE BE LIABLE 408-996-1010 FOR DIRECT, INDIRECT, SPECIAL, Apple, the Apple logo, AirPort, INCIDENTAL, OR CONSEQUENTIAL AppleScript, AppleShare, AppleTalk, DAMAGES RESULTING FROM ANY Aqua, Cocoa, ColorSync,Finder, DEFECT OR INACCURACY IN THIS FireWire, iBook, iMac, Mac, MANUAL, even if advised of the Macintosh, Power Mac, QuickDraw, possibility of such damages. QuickTime, PowerBook, Sherlock, Contents Figures, Listings, and Tables 13 Chapter 1 About This Book 17 Why Read This Book 17 Further Investigations 19 Installed Developer Documentation 19 Other Apple Publications 20 Information on BSD 21 Other Information on the Web 21 Chapter 2 System Technologies 23 The User Experience 24 Aqua 25 The Finder 26 Application Support 28 Multiple Users 29 Internationalization 30 Accessibility 30 AppleScript 31 Exported Application Services 32 Other Parts of the User Experience 32 Darwin 33 Mach 33 BSD 34 Device-Driver Support 35 Networking Extensions 35 File Systems 36 Darwin and Open Source Development 38 3 Apple Computer, Inc. July 2002 CONTENTS Graphics and Imaging 38 Quartz 38 QuickDraw 40 OpenGL 41 QuickTime 41 Printing 42 Apple Type Solution 43 Application Technologies 43 Application Extensibility 44 Disc Recording 45 Contact Database 45 Networking and the Internet 46 Media Types 46 Standard Protocols 47 Legacy Network Services and Protocols 48 Rendezvous 49 Routing and Multihoming 49 Personal File and Web Services 49 Advanced Hardware Features 50 USB 50 FireWire 51 Velocity Engine 51 AirPort 51 Video Features 52 Chapter 3 System Architecture 53 A Layered Perspective 54 Application Environments 59 Carbon 60 Cocoa 63 Java 64 The Graphics and Windowing Environment 67 Quartz Compositor 69 Quartz 2D 70 4 Apple Computer, Inc. July 2002 CONTENTS The Printing System 72 The User Interface of the Printing System 73 Summary of Printing Architecture 74 Printer Discovery 76 The Printing Process 76 Other Application Services 77 Process Manager 78 Carbon Event Manager 78 Apple Events 78 The Clipboard 79 Core Services 79 Core Foundation 79 Carbon Core 82 CFNetwork 83 Web Services 84 Open Transport 84 Tracking a User Event 85 Chapter 4 Booting and Logging In 89 The Boot Sequence 89 BootROM 90 BootX 90 System Initialization 91 The rc.boot and rc Scripts 92 Startup Items 93 System Daemons 96 Launching Daemons on Demand 99 Managing User Sessions 100 Logging In 100 Authenticating Users 101 Setting Up the User Environment 102 Logging Out 102 Application Responsibilities 103 Terminating Processes 104 5 Apple Computer, Inc. July 2002 CONTENTS Customization Techniques 105 Creating Custom Startup Items 105 Creating the Startup Item Executable 106 Specifying the Startup Item Properties 107 Starting and Stopping Startup Items 109 Customizing Login and Logout Procedures 110 Using Environment Variables 112 Replacing the Finder 112 Chapter 5 Bundles 115 Benefits of Using Bundles 116 Anatomy of a Bundle 117 The Finder and Bundles 122 Types of Bundles 123 An Application’s Main Bundle 124 Framework Bundles 124 Loadable Bundles and Dynamic Linking 124 Localized Resources 125 Localized Character Strings 126 Search Algorithm 127 Bundles and the Resource Manager 129 Chapter 6 Application Packaging 131 An Application Is a Bundle 131 Application Frameworks, Libraries, and Helpers 133 Private Frameworks 134 Shared Frameworks and the Central Directory 135 Other Shared Application Code 136 Applications and Loadable Bundles 137 User Resources in Applications 138 Application Help 138 Application Preferences 139 Document Resources 140 6 Apple Computer, Inc. July 2002 CONTENTS Chapter 7 Frameworks 141 The Framework as a Library Package 142 The Internal Structure of Frameworks 143 Standard Locations for Frameworks 145 Dynamic Shared Libraries 146 Framework Versioning 148 Major Versions 148 Minor Versions 150 Versioning Summary and Guidelines 151 Chapter 8 Umbrella Frameworks 155 Kinds of Frameworks 156 The Purpose of Umbrella Frameworks 157 Linking and Including Guideline 159 The Structure of an Umbrella Framework 160 Restrictions on Subframework Linking 162 Chapter 9 The File System 165 How the File System Is Organized 165 File-System Domains 167 The User Domain 168 The Local Domain 170 The Network Domain 171 The System Domain 172 The Library Directory 172 The Developer Directory 174 Directories of the Classic Environment 176 Searching Within the File-System Domains 177 Hiding Filename Extensions 177 Localizing File System Names 178 Displaying Localized Path Names 179 Localizing Bundle Names 179 Localizing Directory Names 180 7 Apple Computer, Inc. July 2002 CONTENTS Differences Between HFS+ and UFS 181 Aliases and Symbolic Links 182 Resource Forks 183 File Encodings and Fonts 186 Chapter 10 The Finder 189 The Role of the Finder 189 Finder Interfaces to Applications 191 Apple Events 191 Information Property Lists 191 Information Stored by the Finder 192 Collecting Application Information 192 The Desktop Folder 193 Finder Attributes 194 The Handling of Applications and Documents 194 Presenting Documents 195 Sorting Files 196 Choosing Applications to Launch 196 The Finder and File Operations 197 Copy and Move Operations 197 Management of Aliases and Symbolic Links 198 Chapter 11 Software Configuration 199 Property Lists 199 Information Property Lists 200 Document Configuration 201 An Example of an Information Property List 202 The Preferences System 205 How Preferences Are Stored 206 Preference Domains 207 The defaults Utility 208 8 Apple Computer, Inc. July 2002 CONTENTS Chapter 12 Internationalization 211 Internationalizing Your Application 212 Language Preferences and Bundle Resources 213 Designating Languages and Locales 215 Tools for Internationalization and Localization 216 Localizing User Interfaces 218 Localizing Strings 219 Composing a Strings File 220 Generating Strings Files 222 Adding Multiscript Support 222 Chapter 13 Installation and Integration 225 Preparing Software for Mac OS X 225 Applications and Documents FAQ 226 What metadata must I specify for an application? 226 Must I package my CFM executable in a bundle? 227 How should I store application resources? 227 How do I indicate document types in Mac OS X? 229 Can I treat my plug-ins as documents? 229 How does the Finder handle documents? 229 Why even have extensions? 230 How should my application save documents? 231 CFM Executables 231 User Interface Issues 234 Icons 235 Custom