|
From: Andre P. <at...@us...> - 2004-05-10 07:49:40
|
Update of /cvsroot/hoc/hoc/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17042/docs Modified Files: Introduction.pod Quick_Start.pod Log Message: Use withAutoreleasePool instead of newAutoreleasePool/releaseObject in UniqSort example, because it's Better Coding Style. (Also updated documentation to reflect this.) Corrected note about ifgen communicating with ObjC runtime system: it actually parses header files. Index: Introduction.pod =================================================================== RCS file: /cvsroot/hoc/hoc/docs/Introduction.pod,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Introduction.pod 7 May 2004 08:38:03 -0000 1.2 --- Introduction.pod 10 May 2004 07:49:31 -0000 1.3 *************** *** 37,47 **** =item * Automatically Generated ! HOC uses an I<interface generator> that communicates with the ! Objective-C runtime system, to produce Haskell source code that ! contains data types representing the Objective-C class hierarchy, ! and methods and selectors belonging to frameworks. If you are ! familiar with other Haskell interface generators such as F<c2hs> ! or F<GreenCard>, HOC's I<ifgen> tool does the same job, but for ! creating bindings to Objective-C classes instead. By default, HOC is configured to build bindings for the --- 37,48 ---- =item * Automatically Generated ! HOC uses an I<interface generator> that parses Objective-C header ! files to produce Haskell source code. The Haskell code contains ! data types representing the Objective-C class hierarchy, and ! methods and selectors which enable HOC to communicate with ! Objective-C frameworks. If you are familiar with other Haskell ! interface generators such as F<c2hs> or F<GreenCard>, HOC's ! I<ifgen> tool does the same job, but for creating bindings to ! Objective-C classes instead. By default, HOC is configured to build bindings for the Index: Quick_Start.pod =================================================================== RCS file: /cvsroot/hoc/hoc/docs/Quick_Start.pod,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Quick_Start.pod 8 May 2004 00:04:42 -0000 1.3 --- Quick_Start.pod 10 May 2004 07:49:31 -0000 1.4 *************** *** 33,37 **** main = do -- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; ! pool <- newAutoreleasePool -- NSArray *args = [[[NSProcessInfo processInfo] arguments]; args <- _NSProcessInfo # processInfo >>= arguments --- 33,41 ---- main = do -- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; ! -- ... ! -- [pool release]; ! withAutoreleasePool main' ! ! main' = do -- NSArray *args = [[[NSProcessInfo processInfo] arguments]; args <- _NSProcessInfo # processInfo >>= arguments *************** *** 58,63 **** -- Don't need to release anything: HOC manages memory for you via -- Haskell's garbage collector! - -- [pool release]; - releaseObject pool -- return 0; return () --- 62,65 ---- *************** *** 186,195 **** =head2 Autorelease Pools ! The code shown for the uniquing sorting command-line tool above ! imported the C<newAutoreleasePool> and C<releaseObject> functions ! from the module C<HOC.Base>. You normally won't use these two ! functions at all: to create a new autorelease pool, use the ! higher-level function C<withAutoreleasePool :: IO a>, which takes ! an IO action as a parameter and runs that: main = do --- 188,193 ---- =head2 Autorelease Pools ! Use the function C<withAutoreleasePool :: IO a> to create an ! autorelease pool and run an IO action which which use the pool: main = do *************** *** 200,205 **** ... ! Using C<withAutoreleasePool> saves you from remembering to ! release the pool: after your action has been run, the pool is automatically released. --- 198,204 ---- ... ! Using C<withAutoreleasePool> instead of an explict C<alloc> and ! C<release> for the pool saves you from remembering to ! release it: after your action has been run, the pool is automatically released. |