MacMainIf.h

Go to the documentation of this file.
00001 //
00002 //
00003 // Upper interface declarations for MacMain functions
00004 //
00005 #ifndef MACMAINIF_H_
00006 #define MACMAINIF_H 1
00007 
00008 // This embarassing hack exists purely because EMACS' electric-c indentation
00009 // mode is too clever by half...
00010 #ifdef __cplusplus
00011 #define BEGIN_EXTERN_C extern "C" {
00012 #define END_EXTERN_C };
00013 #else
00014 #define BEGIN_EXTERN_C
00015 #define END_EXTERN_C
00016 #endif
00017 
00018 #include <CoreServices/CoreServices.h>
00019 
00020 BEGIN_EXTERN_C
00021 
00022 long MacInitialisePWLibEvents(void);
00023 long MacTeardownPWLibEvents(void);
00024 // technically, CALLBACK_API_C returns OSStatus, but that's a long
00025 typedef long(*callback_api_c)(void*);
00026 int SpawnProcessInContext( callback_api_c trampoline );
00027 // The shutdown dance is long and complicated.
00028 // Actually, it's not.  When (or shortly after) the PProcess terminates,
00029 // three things happen:
00030 // The extern variable pwlibAppQueueID gets set to zero;
00031 // the main application event loop receives a special event call;
00032 // and the main application receives a Quit event.
00033 // Here's the special event:
00034 #define kEventClassPwlib    'PWLB'
00035 #define kEventPwlibPProcExit    0
00036 // Here's the variable:
00037 extern MPQueueID pwlibAppQueueID;
00038 // And here's a function you can call to wait for the application PProcess
00039 // to exit (assuming you've already suggested to it that it should).
00040 long MacWaitForPProcess(Duration);
00041 
00042 END_EXTERN_C
00043 #endif

Generated on Mon Feb 23 01:57:54 2009 for PTLib by  doxygen 1.5.1