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(); ...@@ -47,31 +47,46 @@ void SAL_CALL sal_detail_deinitialize();
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include <postmac.h> #include <postmac.h>
static int sal_argc;
static char **sal_argv;
#define SAL_MAIN_WITH_ARGS_IMPL \ #define SAL_MAIN_WITH_ARGS_IMPL \
int SAL_CALL main(int argc, char ** argv) \ int SAL_CALL main(int argc, char ** argv) \
{ \ { \
sal_argc = argc; \
sal_argv = argv; \
sal_detail_initialize(argc, argv); \ sal_detail_initialize(argc, argv); \
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \
int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"salAppDelegate"); \ int retVal = UIApplicationMain (argc, argv, @"UIApplication", @"salAppDelegate"); \
\
[pool release]; \ [pool release]; \
\
sal_detail_deinitialize(); \ sal_detail_deinitialize(); \
return retVal; \ 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 \ #define SAL_MAIN_IMPL \
SAL_MAIN_WITH_ARGS_IMPL \ int SAL_CALL main(int argc, char ** argv) \
\
static int \
sal_main_with_args(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> { @interface salAppDelegate : NSObject <UIApplicationDelegate> {
...@@ -79,7 +94,7 @@ sal_main_with_args(int argc, char ** argv) \ ...@@ -79,7 +94,7 @@ sal_main_with_args(int argc, char ** argv) \
@property (nonatomic, retain) UIWindow *window; @property (nonatomic, retain) UIWindow *window;
@end @end
static int sal_main_with_args(int argc, char **argv); static int sal_main(void);
@implementation salAppDelegate @implementation salAppDelegate
...@@ -92,7 +107,7 @@ static int sal_main_with_args(int argc, char **argv); ...@@ -92,7 +107,7 @@ static int sal_main_with_args(int argc, char **argv);
self.window = uiw; self.window = uiw;
[uiw release]; [uiw release];
sal_main_with_args(sal_argc, sal_argv); sal_main();
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
return YES; return YES;
...@@ -122,6 +137,8 @@ int SAL_CALL main(int argc, char ** argv) \ ...@@ -122,6 +137,8 @@ int SAL_CALL main(int argc, char ** argv) \
return ret; \ return ret; \
} }
#define SAL_MAIN_WITH_GUI_IMPL SAL_MAIN_IMPL
#endif #endif
...@@ -182,6 +199,19 @@ int WINAPI WinMain( HINSTANCE _hinst, HINSTANCE _dummy, char* _cmdline, int _nsh ...@@ -182,6 +199,19 @@ int WINAPI WinMain( HINSTANCE _hinst, HINSTANCE _dummy, char* _cmdline, int _nsh
SAL_WIN_WinMain \ SAL_WIN_WinMain \
static int SAL_CALL sal_main(void) 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: "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