Develop-21 9503 March 1995.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
develop E D I T O R I A L S T A F F T H I N G S T O K N O W C O N T A C T I N G U S Editor-in-Cheek Caroline Rose develop, The Apple Technical Feedback. Send editorial suggestions Managing Editor Toni Moccia Journal, a quarterly publication of or comments to Caroline Rose at Technical Buckstopper Dave Johnson Apple Computer’s Developer Press AppleLink CROSE, Internet group, is published in March, June, [email protected], or fax Bookmark CD Leader Alex Dosher September, and December. develop (408)974-6395. Send technical Able Assistants Meredith Best, Liz Hujsak articles and code have been reviewed questions about develop to Dave Our Boss Greg Joswiak for robustness by Apple engineers. Johnson at AppleLink JOHNSON.DK, His Boss Dennis Matthews Internet [email protected], CompuServe This issue’s CD. Subscription issues Review Board Pete “Luke” Alexander, Dave 75300,715, or fax (408)974-6395. Or of develop are accompanied by the Radcliffe, Jim Reekes, Bryan K. “Beaker” write to Caroline or Dave at Apple develop Bookmark CD. The Bookmark Ressler, Larry Rosenstein, Andy Shebanow, Computer, Inc., One Infinite Loop, CD contains a subset of the materials Gregg Williams M/S 303-4DP, Cupertino, CA 95014. on the monthly Developer CD Series, Contributing Editors Lorraine Anderson, which is available from APDA. Article submissions. Ask for our Steve Chernicoff, Toni Haskell, Judy Included on the CD are this issue and Author’s Guidelines and a submission Helfand, Cheryl Potter all back issues of develop along with the form at AppleLink DEVELOP, Indexer Marc Savage code that the articles describe. The Internet [email protected], develop code is updated when necessary, or fax (408)974-6395. Or write to A R T & P R O D U C T I O N so always use the most recent CD. Caroline Rose at the above address. Production Manager Diane Wilcox The CD also contains Technical Notes, sample code, and other useful Subscriptions and back issues. Technical Illustration Deb Dennis, Sandee documentation and tools (these You can subscribe to develop through Karr, Shawn Morningstar contents are subject to change). APDA (see below) or use the Formatting Forbes Mill Press Software and documentation referred subscription card in this issue. You can Photography Sharon Beals, Maggie Fishell, to as being on this issue’s CD are also order printed back issues. For Marcie Griffith, Tin Janssens, Michael located on either the Bookmark CD or subscription changes or queries or back Johnson, Mark Maxham the Reference Library or Tool Chest issue orders, call 1-800-877-5548 in Cover Illustration Graham Metcalfe edition of the Developer CD Series. the U.S., (815)734-1116 outside the The develop issues and code are also U.S. Or write AppleLink DEV.SUBS or Internet [email protected]. ISSN #1047-0735. © 1995 Apple Computer, Inc. available on AppleLink and via All rights reserved. Apple, the Apple logo, APDA, anonymous ftp at ftp.info.apple.com, Be sure to include your name, address, and AppleLink, AppleScript, AppleTalk, HyperCard, in the Developer Services area. account number as it appears on your mailing ImageWriter, LaserWriter, Mac, MacApp, Macintosh, label in all correspondence related to your Macintosh Quadra, MacTCP, MPW, MultiFinder, Macintosh Technical Notes. subscription. One-year U.S. subscription Newton, PowerBook, QuickTime, SANE, TrueType, Where references to Macintosh price is $30 for 4 issues of develop and the and WorldScript are trademarks of Apple Computer, Technical Notes in develop are followed develop Bookmark CD; all other countries, Inc., registered in the U.S. and other countries. AOCE, by something like “(QT 4),” this $50 U.S. For Canadian orders, price AppleScript, A/ROSE, Balloon Help, ColorSync, indicates the category and number of includes GST (R100236199). Back issues develop, Dylan, Finder, NewtonMail, NewtonScript, the Note on this issue’s CD. (QT is the are $13 each in the U.S., $20 all other OpenDoc, Power Macintosh, PowerTalk, QuickDraw, QuickTime category.) countries. and QuickTake are trademarks of Apple Computer, Inc. PostScript is a trademark of Adobe Systems Incorporated, E-mail addresses. Most e-mail APDA. To order products from APDA which may be registered in certain jurisdictions. addresses mentioned in develop are or receive a catalog, call 1-800-282- PowerPC is a trademark of International Business AppleLink addresses; to convert one of 2732 in the U.S., 1-800-637-0029 in Machines Corporation, used under license therefrom. Smalltalk is a trademark of ParcPlace Systems. NuBus these to an Internet address, append Canada, (716)871-6555 internationally, is a trademark of Texas Instruments. UNIX is a “@applelink.apple.com” to it. For or (716)871-6511 for fax. Order registered trademark of UNIX System Laboratories, example, DEVELOP on AppleLink electronically at AppleLink APDA, a wholly owned subsidiary of Novell, Inc. All other becomes [email protected] Internet [email protected], trademarks are the property of their respective owners. on the Internet. To convert a CompuServe 76666,2405, or America NewtonMail address to an Internet Online APDAorder. Or write APDA, address, append “@online.apple.com” Apple Computer, Inc., P.O. Box 319, Printed on recycled paper to it. Buffalo, NY 14207-0319. Issue 21 March 1995 A R T I C L E S 5 Getting Started With OpenDoc Graphics by Kurt Piersol OpenDoc provides very powerful document layout and imaging capabilities, but the basic graphics tasks that everyone needs to accomplish aren’t much more complex. Here are some recipes to get you started. 29 A First Look at Dylan: Classes, Functions, and Modules by Steve Strassmann Dylan has fundamentally different notions about classes and methods than C++, notions that make specifying and using methods simpler and more expressive. Here’s an overview of the Dylan way of doing things. 48 Designing a Scripting Implementation by Cal Simone The design of your application’s scripting vocabulary is as important as the design of your user interface. These guidelines will help you create a clean and consistent scripting vocabulary. 78 An Object-Oriented Approach to Hierarchical Lists by Jan Bruyndonckx This article shows how to implement the hierarchical lists described in Issue 18 (and other custom list types) in PowerPlant, CodeWarrior’s object-oriented framework. C O L U M N S 23 BALANCE OF POWER 98 MACINTOSH Q & A Introducing PowerPC Assembly Language Apple’s Developer Support Center answers by Dave Evans queries about Macintosh product development. You won’t often need to write it, but you’ll surely have to read it and debug it. Get the 108 THE VETERAN NEOPHYTE basics here. The Downside by Dave Johnson 44 MPW TIPS AND TRICKS Programming is great . most of the time. Launching MPW Faster Than a Speeding Turtle 112 NEWTON Q & A: ASK THE LLAMA by Tim Maroney Answers to Newton-related development The first installment of a new column to help questions; you can send in your own. you get the most out of MPW. This time: speeding up MPW’s launching. 117 KON AND BAL’S PUZZLE PAGE Printing Pains 73 PRINT HINTS by Josh Horwich Writing QuickDraw GX Drivers With Josh attempts to flummox KON with yet Custom I/O and Buffering another series of events that lead to a bus error. by Dave Hersey Here’s what you’ll need to know to write a 122 THE ART OF HUMAN COMPUTING QuickDraw GX driver that uses custom I/O or Finger-Coded Binary buffering schemes. by Tobias Engler Trapped in the wilderness with dead batteries? 94 SOMEWHERE IN QUICKTIME Don’t despair: you can still twiddle bits around Choosing the Right Codec the campfire. by John Wang Compressor/decompressor components vary widely in their capabilities and limitations. 2 EDITOR’S NOTE Learn how to pick the right one. 3 LETTERS 123 INDEX CONTENTS 1 EDITOR’S NOTE From time to time people I know outside of Apple ask me what kind of Macintosh they should buy for home use. I in turn always ask what made them decide on a Macintosh in the first place. The answer is usually along the lines of “My kid has one at school and loves it” or “I use PCs at work but write my memos on a Macintosh, and I love my Mac.” Typically they can’t pinpoint the reasons for this “love.” People enjoy using the Macintosh; you might say they’re charmed by it. Charm sells. I used to think my taste for older houses with all their nooks and crannies — and yes, imperfections — would work to my benefit in the real estate market. But in fact it seems that’s what everyone wants. The houses that suit me are rarely put up for sale, their owners are so loathe to part with them; on those few occasions that they are on the market, they’re sold in the blink of an eye. Newer, bigger houses that go for the same price sell much more slowly. CAROLINE ROSE So when I hear about how some new computer is expected to run infinitesimally faster than some other one, I’m not swayed. (You’d be amazed to learn the creaky model of the Macintosh I use at home for my personal tasks.) Through years of complaints about how slow and otherwise imperfect the Macintosh was, I just knew it would thrive. I don’t think people in the home market, especially, are going to focus on performance measurements or the number of applications available. Of course they need reasonable speed and the necessary applications to do what they want to do — but most of all they want a computer they’ll enjoy using.