2003-03-24 18:15:56 +00:00
|
|
|
#include <Foundation/Foundation.h>
|
|
|
|
#include <AppKit/AppKit.h>
|
1998-01-30 00:34:25 +00:00
|
|
|
|
1997-12-04 01:58:57 +00:00
|
|
|
int main (int argc, char** argv, char** env)
|
|
|
|
{
|
2001-07-31 16:57:26 +00:00
|
|
|
id pool = [NSAutoreleasePool new];
|
|
|
|
NSArray* arguments;
|
|
|
|
NSProcessInfo* processInfo;
|
|
|
|
NSString *model;
|
1997-12-04 01:58:57 +00:00
|
|
|
|
1999-02-02 00:08:58 +00:00
|
|
|
#ifdef LIB_FOUNDATION_LIBRARY
|
1997-12-04 01:58:57 +00:00
|
|
|
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
processInfo = [NSProcessInfo processInfo];
|
|
|
|
arguments = [processInfo arguments];
|
2002-08-25 02:47:00 +00:00
|
|
|
[NSApplication sharedApplication];
|
2001-07-31 16:57:26 +00:00
|
|
|
if ([arguments count] < 2)
|
2002-08-25 02:47:00 +00:00
|
|
|
{
|
|
|
|
model = @"test.gmodel";
|
|
|
|
if (![NSBundle loadNibNamed: model owner: NSApp])
|
|
|
|
{
|
|
|
|
printf ("Cannot load Interface Modeller file!\n");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
2001-07-31 16:57:26 +00:00
|
|
|
else
|
2002-08-25 02:47:00 +00:00
|
|
|
{
|
|
|
|
NSDictionary *table;
|
|
|
|
table = [NSDictionary dictionaryWithObject: NSApp forKey: @"NSOwner"];
|
|
|
|
model = [arguments objectAtIndex: 1];
|
|
|
|
if (![NSBundle loadNibFile: model
|
|
|
|
externalNameTable: table
|
|
|
|
withZone: [NSApp zone]])
|
|
|
|
{
|
|
|
|
printf ("Cannot load Interface Modeller file!\n");
|
|
|
|
exit (1);
|
|
|
|
}
|
1997-12-04 01:58:57 +00:00
|
|
|
|
2002-08-25 02:47:00 +00:00
|
|
|
}
|
1997-12-04 01:58:57 +00:00
|
|
|
|
|
|
|
[[NSApplication sharedApplication] run];
|
|
|
|
printf ("exiting...\n");
|
|
|
|
|
|
|
|
[pool release];
|
|
|
|
exit (0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|