Kaydet (Commit) 910e9990 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

iOS hacking, intermediate commit

üst 0d1321e0
......@@ -47,31 +47,46 @@ void SAL_CALL sal_detail_deinitialize();
#import <UIKit/UIKit.h>
#include <postmac.h>
static int sal_argc;
static char **sal_argv;
#define SAL_MAIN_WITH_ARGS_IMPL \
int SAL_CALL main(int argc, char ** argv) \
{ \
sal_argc = argc; \
sal_argv = argv; \
sal_detail_initialize(argc, argv); \
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \
int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"salAppDelegate"); \
\
[pool release]; \
\
sal_detail_deinitialize(); \
return retVal; \
} \
\
static int sal_main_with_args(int argc, char **argv); \
\
static int \
sal_main(void) \
{ \
char *argv[] = { NULL }; \
return sal_main_with_args(0, argv); \
}
#define SAL_MAIN_IMPL \
SAL_MAIN_WITH_ARGS_IMPL \
\
static int \
sal_main_with_args(int argc, char ** argv) \
int SAL_CALL main(int argc, char ** argv) \
{ \
return sal_main(); \
sal_detail_initialize(argc, argv); \
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \
int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"salAppDelegate"); \
[pool release]; \
sal_detail_deinitialize(); \
return retVal; \
}
#define SAL_MAIN_WITH_GUI_IMPL \
int SAL_CALL main(int argc, char ** argv) \
{ \
sal_detail_initialize(argc, argv); \
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \
int retVal = sal_main(); \
[pool release]; \
sal_detail_deinitialize(); \
return retVal; \
}
@interface salAppDelegate : NSObject <UIApplicationDelegate> {
......@@ -79,7 +94,7 @@ sal_main_with_args(int argc, char ** argv) \
@property (nonatomic, retain) UIWindow *window;
@end
static int sal_main_with_args(int argc, char **argv);
static int sal_main(void);
@implementation salAppDelegate
......@@ -92,7 +107,7 @@ static int sal_main_with_args(int argc, char **argv);
self.window = uiw;
[uiw release];
sal_main_with_args(sal_argc, sal_argv);
sal_main();
[self.window makeKeyAndVisible];
return YES;
......@@ -122,6 +137,8 @@ int SAL_CALL main(int argc, char ** argv) \
return ret; \
}
#define SAL_MAIN_WITH_GUI_IMPL SAL_MAIN_IMPL
#endif
......@@ -182,6 +199,19 @@ int WINAPI WinMain( HINSTANCE _hinst, HINSTANCE _dummy, char* _cmdline, int _nsh
SAL_WIN_WinMain \
static int SAL_CALL sal_main(void)
/* Use SAL_IMPLEMENT_MAIN_WITH_GUI in programs that actually have a
* VCL GUI. The difference is meaningful only for iOS support, which
* of course is a highly experimental work in progress. So actually,
* don't bother, just let developers who care for iOS take care of it
* when/if necessary.
*/
#define SAL_IMPLEMENT_MAIN_WITH_GUI() \
static int SAL_CALL sal_main(void); \
SAL_MAIN_WITH_GUI_IMPL \
SAL_WIN_WinMain \
static int SAL_CALL sal_main(void)
/*
"How to use" Examples:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment