39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
[OFApplication terminateWithStatus: 1];
}
@implementation ObjFWNew
- (void)applicationDidFinishLaunching
{
bool app, class;
OFString *superclass = nil;
OFMutableArray OF_GENERIC(OFString *) *properties = nil;
const OFOptionsParserOption options[] = {
{ 'a', @"app", 0, &app, NULL },
{ 'c', @"class", 0, &class, NULL },
{ 's', @"superclass", 1, NULL, &superclass },
{ 'p', @"property", 1, NULL, NULL },
{ '\0', nil, 0, NULL, NULL }
|
|
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
[OFApplication terminateWithStatus: 1];
}
@implementation ObjFWNew
- (void)applicationDidFinishLaunching
{
bool app, class;
OFString *superclass = nil, *name;
OFMutableArray OF_GENERIC(OFString *) *properties = nil;
const OFOptionsParserOption options[] = {
{ 'a', @"app", 0, &app, NULL },
{ 'c', @"class", 0, &class, NULL },
{ 's', @"superclass", 1, NULL, &superclass },
{ 'p', @"property", 1, NULL, NULL },
{ '\0', nil, 0, NULL, NULL }
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
}
if ((app ^ class) != 1 || optionsParser.remainingArguments.count != 1)
showUsage();
if ((superclass && !class) || (properties != nil && !class))
showUsage();
if (app)
newApp(optionsParser.remainingArguments.firstObject);
else if (class)
newClass(optionsParser.remainingArguments.firstObject,
superclass, properties);
else
showUsage();
[OFApplication terminate];
}
@end
|
>
>
>
>
>
>
|
<
|
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
}
if ((app ^ class) != 1 || optionsParser.remainingArguments.count != 1)
showUsage();
if ((superclass && !class) || (properties != nil && !class))
showUsage();
name = optionsParser.remainingArguments.firstObject;
if ([name rangeOfString: @"."].location != OFNotFound) {
[OFStdErr writeLine: @"Name must not contain dots!"];
[OFApplication terminate];
}
if (app)
newApp(name);
else if (class)
newClass(name, superclass, properties);
else
showUsage();
[OFApplication terminate];
}
@end
|