ObjFW  Check-in [cd677a3484]

Overview
Comment:Better storing of argc and argv for real now.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cd677a3484a875c39fa7aa73c112e7f0570d092045c41488b78931c05e075788
User & Date: js on 2010-10-10 21:09:43
Other Links: manifest | tags
Context
2010-10-15
18:46
D'oh. Rename namespace to ns in the block declaration.
This unbreaks ObjC++.
check-in: bd02818a56 user: js tags: trunk
2010-10-10
21:09
Better storing of argc and argv for real now. check-in: cd677a3484 user: js tags: trunk
12:01
Better storing of argc and argv. check-in: f282aaa672 user: js tags: trunk
Changes

Modified src/OFApplication.h from [53d78093d3] to [20532cb77f].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@class OFMutableArray;
@class OFMutableDictionary;

#define OF_APPLICATION_DELEGATE(cls)					\
	int								\
	main(int argc, char *argv[])					\
	{								\
		return of_application_main(argc, argv, [cls class]);	\
	}

/**
 * \brief A protocol for delegates of OFApplication.
 */
@protocol OFApplicationDelegate
/**







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@class OFMutableArray;
@class OFMutableDictionary;

#define OF_APPLICATION_DELEGATE(cls)					\
	int								\
	main(int argc, char *argv[])					\
	{								\
		return of_application_main(&argc, &argv, [cls class]);	\
	}

/**
 * \brief A protocol for delegates of OFApplication.
 */
@protocol OFApplicationDelegate
/**
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 *
 * You should not call this directly! Use of_application_main instead!
 *
 * \param argc The number of arguments
 * \param argv The argument values
 */
- (void)setArgumentCount: (int*)argc
       andArgumentValues: (char***)argv;

/**
 * Gets args and argv.o
 *
 * \param argc A pointer where a pointer to argc should be stored
 * \param argv A pointer where a pointer to argv should be stored
 */
- (void)getArgumentCount: (int**)argc
       andArgumentValues: (char****)argv;

/**
 * \return The name of the program (argv[0])
 */
- (OFString*)programName;

/**







|








|







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 *
 * You should not call this directly! Use of_application_main instead!
 *
 * \param argc The number of arguments
 * \param argv The argument values
 */
- (void)setArgumentCount: (int*)argc
       andArgumentValues: (char**[])argv;

/**
 * Gets args and argv.o
 *
 * \param argc A pointer where a pointer to argc should be stored
 * \param argv A pointer where a pointer to argv should be stored
 */
- (void)getArgumentCount: (int**)argc
       andArgumentValues: (char***[])argv;

/**
 * \return The name of the program (argv[0])
 */
- (OFString*)programName;

/**
156
157
158
159
160
161
162
163
 */
- (void)terminateWithStatus: (int)status;
@end

@interface OFObject (OFApplicationDelegate) <OFApplicationDelegate>
@end

extern int of_application_main(int, char*[], Class);







|
156
157
158
159
160
161
162
163
 */
- (void)terminateWithStatus: (int)status;
@end

@interface OFObject (OFApplicationDelegate) <OFApplicationDelegate>
@end

extern int of_application_main(int*, char**[], Class);

Modified src/OFApplication.m from [52b96796ce] to [b4963086e3].

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
	id <OFApplicationDelegate> delegate = [app delegate];

	[delegate applicationWillTerminate];
}

int
of_application_main(int argc, char *argv[], Class cls)
{
	OFApplication *app = [OFApplication sharedApplication];
	id <OFApplicationDelegate> delegate = [[cls alloc] init];

	[app setArgumentCount: &argc
	    andArgumentValues: &argv];

	[app setDelegate: delegate];
	[(id)delegate release];

	[app run];

	return 0;







|




|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
	id <OFApplicationDelegate> delegate = [app delegate];

	[delegate applicationWillTerminate];
}

int
of_application_main(int *argc, char **argv[], Class cls)
{
	OFApplication *app = [OFApplication sharedApplication];
	id <OFApplicationDelegate> delegate = [[cls alloc] init];

	[app setArgumentCount: argc
	    andArgumentValues: argv];

	[app setDelegate: delegate];
	[(id)delegate release];

	[app run];

	return 0;
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
	argc = argc_;
	argv = argv_;

	programName = [[OFString alloc] initWithCString: (*argv)[0]];
	arguments = [[OFMutableArray alloc] init];

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

	[pool release];
}

- (void)getArgumentCount: (int**)argc_
       andArgumentValues: (char****)argv_
{







|







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
	argc = argc_;
	argv = argv_;

	programName = [[OFString alloc] initWithCString: (*argv)[0]];
	arguments = [[OFMutableArray alloc] init];

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

	[pool release];
}

- (void)getArgumentCount: (int**)argc_
       andArgumentValues: (char****)argv_
{