Macintosh-Programmers-Workshop
Total Page:16
File Type:pdf, Size:1020Kb
Macintosh Programmers Wo rkshop C++ Shape Land §0§ North40:MP W:EHampl es:CPlusEHampl es:Shap1 §t!J§ cons t shor t width = 25 ; const shor t he ight = 30 ; •• • • TShape : :TShape(Rec t *r ) • { RandomRec t( r ) ; • Ass ign a random fBoundRec t for the shape . II • • vo id TShape : :RandomRec t(Rect *drawRect) { shor t rand 1, rand2 ; rand 1 = abs ( Random ()) � (drawRect->r ight - width >; fBoundRect. I eft = rand 1; .,.,., rand2 = abs (Random ( ) ) � (drawRec t->bottom - (he i gh t !i!i!i fBoundRec t. top = rand2 + draw Rec t-> top; i ! fBoundRect .right = fBoundRec t. left + width; @ i!iiii'''''' • fBoundRec t. bo t tom = fBoundRec t . top + he i gh t; Nort h40:MPW:Work vo id TShape : :Move (Rec t *r ) { RandomRec t( r ) ; 1:23 :41 AM ----- Bu i Id of CP l usShapesApp . 1:23:42 AM ----- Analyzing dependenc ies. • 1:23:44 AM ----- Execu ting bu i Id command TArc : : TArc <Rect *r > : <r > CP lus Shapes .cp -o Shapes .cp.o -sym on Se t Echo 0 { shor t rand 1, rand2 ; Link -d -o CP l usShapesApp -sym on Shap SetF i le CP l usShapesApp -t APPL -c 'MOO rand ! = abs ( Random( )) � 270 ; Rez -append -o CP l usShapesApp ShapesAp fS tartAng le = rand !; Rez -append -o CP l usShapesApp TApp l ica rand2 = abs (Random( )) � 270 ; • 1: 24 :38 AM ----- Done . fArcAng le = rand2 ; CP l usShapesApp Overview C++ is the latest object-oriented and operating system, Object personal computers, or to take programming language available Pascal-based functions and advantage of the powerfulhard foruse with the Macintosh® Pro procedures (such as those found ware foundin the high-end grammer's Wo rkshop (MPW'") in MacApp®), and the Standard Macintosh models. development environment. Apple Numerics Environment MPW C++ provides full sup Apple's implementation fully (SANE®). MPW C ++ can be de port for object-oriented program supports the industry standard for bugged at the C++ source level ming forC- based applications. object-oriented C as definedby using Apple's Symbolic Applica The use of object-oriented pro AT&T's C++ Release 2.0. Apple tion Debugging Environment gramming techniques helps to has extended the language to (SADE'"). Applications built reduce development time while support the Macintosh Toolbox using MPW C++ can be com increasing the reliability of the piled to run on the complete resulting applications. line of Apple® Macintosh Features Bene.fits Support for object-oriented Reduces development time. programming Makes it easier to maintain applications. Increases the reliability of applications. Facilitates the creation of reusable code. Offers a better model forbuilding applications than procedural programming can provide. � Based on AT&T Provides data abstraction, multiple inheritance, Release 2.0 C++ and message-passing capabilities. Offers operatoroverloading and protected variables within classes. Provides strong type-checking forC-based applications. Extensions for the Supplies full access to the Macintosh Toolbox Macintosh environment and operating system. Supports Object Pascal functions and procedures, forcompatibility with MacApp. Provides access to SANE fornumerical accuracy. Supports SADE forsource-level debugging. Includes Apple's Commando interfacefor ease of use. CFront tool is integrated Includes the MPW C scanner and preprocessor. with MPW C Allows MPW C++ to produce tokenized C result ing in reduced build times. Support for multilingual Lets you call Object Pascal functions and Applications procedures fromMPW C++. Allows C++ to be used with MacApp, further enhancing the programmer'sproductivity. � Sample programs Provides examples of two stand-alone, MultiFinder-compatible applications. Provides an example of an MPW tool that is written in C++. Can be used as a learning aid or as the foun dation foractual applications and tools. Product Details Object-Oriented Language Extensions applications and MPW tools. During com C++ and MacApp The MPW C++ system offers object-oriented pilation, MPW C++ can create the symbol MacApp provides an object-oriented programming to programmers using C. Mul files that are needed by SADE to debug C++ frameworkthat implements the standard tiple inheritance, operator overloading, and applications at the C++ source code level. Macintosh user interface,including scroll protected variables and members within This allows the powerfulscripting lan able, resizable windows and multipage classes are but a few of the object-oriented guage of SADE to be harnessed by C++ printing. MacApp fosters developmentof facilitiesof MPW C++. programmers during the development robust, professional-quality applications cycle, to furtherincrease application relia by providing you with extensive memory C++ Translator bility and decrease development time. management support, exception-handling C++ source code is translated to C source SADEis available fromAPDA. mechanisms, support for "undo" com code by the CFront tool. The resulting C mands, and a large body of ready-to-use, source code is then compiled by MPW C. Libraries high-quality code that can be inherited All of this is "automated" by CPlus, an MPW MPW C++ includes libraries forcomplex by your application. script provided with MPW C++. CPlus calls math and I/0 stream processing. Apple has A futurerelease of MacApp will allow both CFront and MPW C, passing appropri completely redone the Complex library. It programmers to use C++ in place of Object ate parameters. This results in a complete retains the functionalityof AT&T's Complex Pascal. This will be accomplished through compilation of C++ source code. library and expands on it, using SANE as the use of special C++ interface files,since MPW C++ uses the same preprocessor the basis forsuperior numerical accuracy. MPW C++ can call Object Pascal-based and scanner as MPW C. This allows MPW Unmangler procedures and functions.These special C++ to output tokenized C source code Error messages produced while linking interfacefiles will be offeredseparately. (as well as "standard" C source code), that C++-based files canbe very cryptic. MPW For more information on MacApp, reduces the build times typically associated C++ comes with a tool forconverting these refer to the MacApp data sheet (order with C++. "mangled" error messages into messages number M0243LL/A) or contact APDA. MPW C is available fromthe Apple that are much easier to read. Also included Programmers and Developers Association Training and Support is a resource foruse with the MacsBug that (APDA' ). Apple offers courses in C++ programming. " allows MacsBug debugger to unmangle For details, please contact: Source Level Debugging C++ function names. Registrar MPW C++ works with Apple's Symbolic Sample Programs Apple Developer University Application Debugging Environment Three sample programs are included 20525 Mariani Avenue, MIS 75-2B (SADE). SADE can be used at either the with MPW C ++. Two of them are com Cupertino, CA 95014 source or the assembly level to debug plete Macintosh applications and the (408) 974-6215 third is a counting tool for MPW.These AppleLink®: DEVUNIV samples make excellent starting points forthe development of other applica tions and tools. Macintosh Programmers Wo rkshop C++ System Requirements To use MPW C++ you will need AnApple Macintosh Plus, Ahard disk the following: Macintosh SE, or Macintosh II Macintosh system software personal computer with at least 6.0.2 or later 2 MB RAM ( 4 MB or more high MPW v.3.0 or later ly reconunended). A 68020 MPW C v.3.0 or later or 68030 microprocessor is recommended. Ordering Information MPWC++ v.3.lBl With your order, you'll receive: Macintosh Programmer's APDA Order No. M0346LL/A Two disks containing the Wo rkshop C++ Reference Macintosh Programmer's AT&TC++ Release 2.0 Wo rkshop C++ translator, C++ Product Reference interfacesand libraries, an un AT&TC++ Release 2.0 mangler forCFront error mes LibraryMa nual sages, and sample programs. AT&TC++ Release 2.0 Selected Readings Apple Programmers Apple Computer, Inc. AppleLink®: APDA and Developers 20525 Mariani Avenue, MIS 33G CompuSe1ve: 766,2045 Association Cupertino, CA 95014 MCI: Postrom TIX: 171-576 Fax: (408) 562-3971 800-282-APDA GEnie: A.DEVELOPER3 (800-282-2732) Apple Computer, Inc. 20525 Mariani Avenue © 1989 Apple Computer, Inc. Apple, the Apple logo, AppleLink, MacApp, Macintosh, and SANE are registered trademarks of Apple Computer, Inc. APDA, MPW, and SADE are trademarks of Apple Cupertino, CA 95014 Computer, Inc. CompuServe is a registered service mark of CompuServe, Inc. GEnie is a trademark (408) 996-1010 of General Electric Company. MCI is a registered service mark of MCI Communications Corporation. September 1989. Product specificationsare subject to change without notice. Printed in U.S.A. TIX: 171-576 M9005LL/A .