ObjFW  Diff

Differences From Artifact [84a11f1539]:

To Artifact [8597dbb10a]:


69
70
71
72
73
74
75
76

77
78
79

80
81
82
83
84
85
86
87
69
70
71
72
73
74
75

76

77

78

79
80
81
82
83
84
85







-
+
-

-
+
-







# include <nds.h>
# undef asm
#endif

OF_DIRECT_MEMBERS
@interface OFApplication ()
- (instancetype)of_init OF_METHOD_FAMILY(init);
- (void)of_setArgumentCount: (int *)argc
- (void)of_setArgumentCount: (int *)argc andArgumentValues: (char **[])argv;
	  andArgumentValues: (char **[])argv;
#ifdef OF_WINDOWS
- (void)of_setArgumentCount: (int)argc
- (void)of_setArgumentCount: (int)argc andWideArgumentValues: (wchar_t *[])argv;
      andWideArgumentValues: (wchar_t *[])argv;
#endif
- (void)of_run;
@end

static OFApplication *app = nil;

static void
112
113
114
115
116
117
118
119

120
121
122
123

124
125
126
127
128
129
130
131
110
111
112
113
114
115
116

117

118
119

120

121
122
123
124
125
126
127







-
+
-


-
+
-







	[[OFLocale alloc] init];

	app = [[OFApplication alloc] of_init];

#ifdef OF_WINDOWS
	if ([OFSystemInfo isWindowsNT]) {
		__wgetmainargs(&wargc, &wargv, &wenvp, _CRT_glob, &si);
		[app of_setArgumentCount: wargc
		[app of_setArgumentCount: wargc andWideArgumentValues: wargv];
		   andWideArgumentValues: wargv];
	} else
#endif
		[app of_setArgumentCount: argc
		[app of_setArgumentCount: argc andArgumentValues: argv];
		       andArgumentValues: argv];

	app.delegate = delegate;

	[app of_run];

	[delegate release];

327
328
329
330
331
332
333
334

335
336
337
338
339
340
341
342
323
324
325
326
327
328
329

330

331
332
333
334
335
336
337







-
+
-







				continue;

			path = [@"ENV:" stringByAppendingString: name];

			if ([fileManager directoryExistsAtPath: path])
				continue;

			file = [OFFile fileWithPath: path
			file = [OFFile fileWithPath: path mode: @"r"];
					       mode: @"r"];

			value = [file readLineWithEncoding: encoding];
			if (value != nil)
				[_environment setObject: value forKey: name];

			objc_autoreleasePoolPop(pool2);
		}
465
466
467
468
469
470
471
472

473
474
475
476
477
478
479
480
460
461
462
463
464
465
466

467

468
469
470
471
472
473
474







-
+
-







{
	[_arguments release];
	[_environment release];

	[super dealloc];
}

- (void)of_setArgumentCount: (int *)argc
- (void)of_setArgumentCount: (int *)argc andArgumentValues: (char ***)argv
	  andArgumentValues: (char ***)argv
{
	void *pool = objc_autoreleasePoolPush();
	OFMutableArray *arguments;
	of_string_encoding_t encoding;

	_argc = argc;
	_argv = argv;
499
500
501
502
503
504
505
506

507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528

529
530
531
532
533
534
535
536
493
494
495
496
497
498
499

500

501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520

521

522
523
524
525
526
527
528







-
+
-




















-
+
-







		[arguments makeImmutable];
	}

	objc_autoreleasePoolPop(pool);
}

#ifdef OF_WINDOWS
- (void)of_setArgumentCount: (int)argc
- (void)of_setArgumentCount: (int)argc andWideArgumentValues: (wchar_t **)argv
      andWideArgumentValues: (wchar_t **)argv
{
	void *pool = objc_autoreleasePoolPush();
	OFMutableArray *arguments;

	if (argc > 0) {
		_programName = [[OFString alloc] initWithUTF16String: argv[0]];
		arguments = [[OFMutableArray alloc] init];

		for (int i = 1; i < argc; i++)
			[arguments addObject:
			    [OFString stringWithUTF16String: argv[i]]];

		[arguments makeImmutable];
		_arguments = arguments;
	}

	objc_autoreleasePoolPop(pool);
}
#endif

- (void)getArgumentCount: (int **)argc
- (void)getArgumentCount: (int **)argc andArgumentValues: (char ****)argv
       andArgumentValues: (char ****)argv
{
	*argc = _argc;
	*argv = _argv;
}

- (id <OFApplicationDelegate>)delegate
{