home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Miscellaneous / CrunchShell Demo / myProg.c < prev   
Encoding:
C/C++ Source or Header  |  1988-06-28  |  1.3 KB  |  40 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  myProg.c
  3.                  Sample main program
  4.                                 
  5.         Copyright 1988 Gregory H. Dow.  All Rights Reserved.
  6.  ******************************************************************************/
  7.  
  8. #include "GlobalVars.h"
  9. #include "CApplication.h"
  10. long    myAppDispatcher();
  11.  
  12. main()
  13. {    
  14.         /* Initialize the Mac programming environment.  The parameter */
  15.         /* is an int specifying the number of additional master       */
  16.         /* pointer blocks to pre-allocate.  More master blocks will   */
  17.         /* be allocated automatically by the system if they are       */
  18.         /* needed.  However, such automatic allocation may result in  */
  19.         /* heap fragmentation (not a good thing).                      */
  20.         
  21.     InitEnvironment(2);
  22.     
  23.         /* Create a new application object.  Store it in a global */
  24.         /* variable since there may be only one instance of an    */
  25.         /* application class.  Then initialize it.                  */
  26.         
  27.     gApplication = (ApplicationObjH) NewObject(sizeof(ApplicationObj),
  28.                                                  myAppDispatcher);
  29.     
  30.     SendMsg(gApplication, msgINITobj);
  31.     
  32.                                         /* Run application with a        */
  33.                                         /*   sleep time of 20 ticks        */
  34.     SendMsg(gApplication, msgRUNappl, 20L);
  35.     
  36.         /* Exit the application.  Perform clean up actions and save */
  37.         /* desired program status information.                        */
  38.  
  39.     SendMsg(gApplication, msgEXITappl);
  40. }