Cube  Check-in [d35fd65699]

Overview
Comment:Clean up identifiers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d35fd65699e79d96fc0588fff075f73b0dd7eb6ebfa0f6cffd0b0a3940e5fecd
User & Date: js on 2025-03-07 21:02:39
Other Links: manifest | tags
Context
2025-03-07
21:16
Clean up variables check-in: 5e43ae9916 user: js tags: trunk
21:02
Clean up identifiers check-in: d35fd65699 user: js tags: trunk
19:55
Migrate more strings check-in: 5ef6284dcf user: js tags: trunk
Changes

Added src/Alias.h version [257d20d71a].

Added src/Alias.m version [2901519ebd].

Added src/Command.h version [40b405f271].

Added src/Command.mm version [5f4325b0d6].

Renamed and modified src/Ident.h [e4880063ad] to src/Identifier.h [9069c402ca].

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
#import <ObjFW/ObjFW.h>

OF_ASSUME_NONNULL_BEGIN

enum IdentType { ID_VAR, ID_COMMAND, ID_ALIAS };

@interface Ident : OFObject
@property (nonatomic) enum IdentType type;
@property (copy, nonatomic) OFString *name;
@property (nonatomic) int min, max;           // ID_VAR
@property (nonatomic) int *storage;           // ID_VAR
@property (nonatomic) void (*fun)();          // ID_VAR, ID_COMMAND
@property (nonatomic) int narg;               // ID_VAR, ID_COMMAND

@property (copy, nonatomic) OFString *action; // ID_ALIAS
@property (nonatomic) bool persist;
@end

OF_ASSUME_NONNULL_END




<
<
|
<
|
|
<
<
<
>
|
<



1
2
3
4


5

6
7



8
9

10
11
12
#import <ObjFW/ObjFW.h>

OF_ASSUME_NONNULL_BEGIN



@interface Identifier : OFObject

@property (readonly, copy, nonatomic) OFString *name;




- (instancetype)init OF_UNAVAILABLE;
- (instancetype)initWithName:(OFString *)name;

@end

OF_ASSUME_NONNULL_END

Renamed and modified src/Ident.m [2e1b68d918] to src/Identifier.m [dfc38df5ef].

1
2
3








4
#import "Ident.h"

@implementation Ident








@end
|

|
>
>
>
>
>
>
>
>

1
2
3
4
5
6
7
8
9
10
11
12
#import "Identifier.h"

@implementation Identifier
- (instancetype)initWithName:(OFString *)name
{
	self = [super init];

	_name = [name copy];

	return self;
}
@end

Added src/Variable.h version [c2a873c551].

Added src/Variable.m version [f42a4c7759].

Renamed and modified src/command.mm [b47ac34d19] to src/commands.mm [e0ed2b9cbb].

1
2
3
4
5
6
7


8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37


38

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

91


92

93
94
95
96
97
98
99


100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// command.cpp: implements the parsing and execution of a tiny script language
// which is largely backwards compatible with the quake console language.

#include "cube.h"

#include <memory>



#import "Ident.h"


void
itoa(char *s, int i)
{
	sprintf_s(s)("%d", i);
}

char *
exchangestr(char *o, const char *n)
{
	gp()->deallocstr(o);
	return newstring(n);
}

// contains ALL vars/commands/aliases
OFMutableDictionary<OFString *, Ident *> *idents;

void
alias(OFString *name, OFString *action)
{
	Ident *b = idents[name];

	if (b == nil) {
		Ident *b = [[Ident alloc] init];
		b.type = ID_ALIAS;
		b.name = name;
		b.action = action;
		b.persist = true;



		idents[b.name] = b;

	} else {
		if (b.type == ID_ALIAS)
			b.action = action;
		else
			conoutf(
			    @"cannot redefine builtin %@ with an alias", name);
	}
}
COMMAND(alias, ARG_2STR)

int
variable(OFString *name, int min, int cur, int max, int *storage, void (*fun)(),
    bool persist)
{
	if (idents == nil)
		idents = [[OFMutableDictionary alloc] init];

	Ident *v = [[Ident alloc] init];
	v.type = ID_VAR;
	v.name = name;
	v.min = min;
	v.max = max;
	v.storage = storage;
	v.fun = fun;
	v.persist = persist;




	idents[name] = v;

	return cur;
}

void
setvar(OFString *name, int i)
{
	*idents[name].storage = i;
}

int
getvar(OFString *name)
{
	return *idents[name].storage;
}

bool
identexists(OFString *name)
{
	return (idents[name] != nil);
}

OFString *
getalias(OFString *name)
{

	Ident *i = idents[name];


	return i != nil && i.type == ID_ALIAS ? i.action : nil;

}

bool
addcommand(OFString *name, void (*fun)(), int narg)
{
	if (idents == nil)
		idents = [[OFMutableDictionary alloc] init];



	@autoreleasepool {
		Ident *c = [[Ident alloc] init];
		c.type = ID_COMMAND;
		c.name = name;
		c.fun = fun;
		c.narg = narg;

		idents[name] = c;
	}

	return false;
}

char *
parseexp(char *&p, int right) // parse any nested set of () or []
{







>
>
|
>















|




|

|
|
<
<
|
|

>
>
|
>

|
|








|
|

<
<
|
<
<
<
|
|
|
|
|

>
>
>
|







|





|





|





>
|
>
>
|
>



|

<
|
>
>

<
|
<
|
<
<

|
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56


57



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107

108

109


110
111

112
113
114
115
116
117
118
// command.cpp: implements the parsing and execution of a tiny script language
// which is largely backwards compatible with the quake console language.

#include "cube.h"

#include <memory>

#import "Alias.h"
#import "Command.h"
#import "Identifier.h"
#import "Variable.h"

void
itoa(char *s, int i)
{
	sprintf_s(s)("%d", i);
}

char *
exchangestr(char *o, const char *n)
{
	gp()->deallocstr(o);
	return newstring(n);
}

// contains ALL vars/commands/aliases
static OFMutableDictionary<OFString *, __kindof Identifier *> *identifiers;

void
alias(OFString *name, OFString *action)
{
	Alias *alias = identifiers[name];

	if (alias == nil) {
		alias = [[Alias alloc] initWithName:name


		                             action:action
		                          persisted:true];

		if (identifiers == nil)
			identifiers = [[OFMutableDictionary alloc] init];

		identifiers[name] = alias;
	} else {
		if ([alias isKindOfClass:[Alias class]])
			alias.action = action;
		else
			conoutf(
			    @"cannot redefine builtin %@ with an alias", name);
	}
}
COMMAND(alias, ARG_2STR)

int
variable(OFString *name, int min, int cur, int max, int *storage,
    void (*function)(), bool persisted)
{


	Variable *variable = [[Variable alloc] initWithName:name



	                                                min:min
	                                                max:max
	                                            storage:storage
	                                           function:function
	                                          persisted:persisted];

	if (identifiers == nil)
		identifiers = [[OFMutableDictionary alloc] init];

	identifiers[name] = variable;

	return cur;
}

void
setvar(OFString *name, int i)
{
	*[identifiers[name] storage] = i;
}

int
getvar(OFString *name)
{
	return *[identifiers[name] storage];
}

bool
identexists(OFString *name)
{
	return (identifiers[name] != nil);
}

OFString *
getalias(OFString *name)
{
	Alias *alias = identifiers[name];

	if ([alias isKindOfClass:[Alias class]])
		return alias.action;

	return nil;
}

bool
addcommand(OFString *name, void (*function)(), int argumentsTypes)
{

	Command *command = [[Command alloc] initWithName:name
	                                        function:function
	                                  argumentsTypes:argumentsTypes];


	if (identifiers == nil)

		identifiers = [[OFMutableDictionary alloc] init];



	identifiers[name] = command;


	return false;
}

char *
parseexp(char *&p, int right) // parse any nested set of () or []
{
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192
	return newstring(word, p - word);
}

char *
lookup(char *n) // find value of ident referenced with $ in exp
{
	@autoreleasepool {
		Ident *ID = idents[@(n + 1)];

		if (ID != nil) {
			switch (ID.type) {
			case ID_VAR:
				string t;
				itoa(t, *(ID.storage));
				return exchangestr(n, t);
			case ID_ALIAS:

				return exchangestr(n, ID.action.UTF8String);
			}
		}
	}

	conoutf(@"unknown alias lookup: %s", n + 1);
	return n;
}

int







|

|
<
<
|
|
|
<
>
|
<
<







169
170
171
172
173
174
175
176
177
178


179
180
181

182
183


184
185
186
187
188
189
190
	return newstring(word, p - word);
}

char *
lookup(char *n) // find value of ident referenced with $ in exp
{
	@autoreleasepool {
		__kindof Identifier *identifier = identifiers[@(n + 1)];

		if ([identifier isKindOfClass:[Variable class]]) {


			string t;
			itoa(t, *[identifier storage]);
			return exchangestr(n, t);

		} else if ([identifier isKindOfClass:[Alias class]])
			return exchangestr(n, [identifier action].UTF8String);


	}

	conoutf(@"unknown alias lookup: %s", n + 1);
	return n;
}

int
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233

234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401

402
403
404

405
406
407
408
409
410
411
412
413

414
415

416
417
418
419
420
421

422

423

424
425
426
427
428
429
430
431
		char *c = w[0];
		if (*c == '/')
			c++; // strip irc-style command prefix
		if (!*c)
			continue; // empty statement

		@autoreleasepool {
			Ident *ID = idents[@(c)];

			if (ID == nil) {
				val = ATOI(c);
				if (!val && *c != '0')
					conoutf(@"unknown command: %s", c);
			} else {
				switch (ID.type) {

				// game defined commands
				case ID_COMMAND:
					// use very ad-hoc function signature,
					// and just call it
					switch (ID.narg) {
					case ARG_1INT:
						if (isdown)
							((void(__cdecl *)(
							    int))ID.fun)(
							    ATOI(w[1]));
						break;
					case ARG_2INT:
						if (isdown)
							((void(__cdecl *)(
							    int, int))ID.fun)(
							    ATOI(w[1]),
							    ATOI(w[2]));
						break;
					case ARG_3INT:
						if (isdown)
							((void(__cdecl *)(int,
							    int, int))ID.fun)(
							    ATOI(w[1]),
							    ATOI(w[2]),
							    ATOI(w[3]));
						break;
					case ARG_4INT:
						if (isdown)
							((void(__cdecl *)(int,
							    int, int,
							    int))ID.fun)(
							    ATOI(w[1]),
							    ATOI(w[2]),
							    ATOI(w[3]),
							    ATOI(w[4]));
						break;
					case ARG_NONE:
						if (isdown)
							((void(__cdecl *)())
							        ID.fun)();
						break;
					case ARG_1STR:
						if (isdown) {
							@autoreleasepool {
								((void(
								    __cdecl *)(
								    OFString *))
								        ID.fun)(
								    @(w[1]));
							}
						}
						break;
					case ARG_2STR:
						if (isdown) {
							@autoreleasepool {
								((void(
								    __cdecl *)(
								    OFString *,
								    OFString *))
								        ID.fun)(
								    @(w[1]),
								    @(w[2]));
							}
						}
						break;
					case ARG_3STR:
						if (isdown) {
							@autoreleasepool {
								((void(
								    __cdecl *)(
								    OFString *,
								    OFString *,
								    OFString *))
								        ID.fun)(
								    @(w[1]),
								    @(w[2]),
								    @(w[3]));
							}
						}
						break;
					case ARG_5STR:
						if (isdown) {
							@autoreleasepool {
								((void(
								    __cdecl *)(
								    OFString *,
								    OFString *,
								    OFString *,
								    OFString *,
								    OFString *))
								        ID.fun)(
								    @(w[1]),
								    @(w[2]),
								    @(w[3]),
								    @(w[4]),
								    @(w[5]));
							}
						}
						break;
					case ARG_DOWN:
						((void(__cdecl *)(bool))ID.fun)(
						    isdown);
						break;
					case ARG_DWN1:
						((void(__cdecl *)(
						    bool, char *))ID.fun)(
						    isdown, w[1]);
						break;
					case ARG_1EXP:
						if (isdown)
							val = ((int(__cdecl *)(
							    int))ID.fun)(
							    execute(w[1]));
						break;
					case ARG_2EXP:
						if (isdown)
							val = ((int(__cdecl *)(
							    int, int))ID.fun)(
							    execute(w[1]),
							    execute(w[2]));
						break;
					case ARG_1EST:
						if (isdown)
							val = ((int(__cdecl *)(
							    char *))ID.fun)(
							    w[1]);
						break;
					case ARG_2EST:
						if (isdown)
							val = ((int(__cdecl *)(
							    char *,
							    char *))ID.fun)(
							    w[1], w[2]);
						break;
					case ARG_VARI:
						if (isdown) {
							// limit, remove
							string r;
							r[0] = 0;
							for (int i = 1;
							     i < numargs; i++) {
								// make
								// string-list
								// out of all
								// arguments
								strcat_s(
								    r, w[i]);
								if (i ==
								    numargs - 1)
									break;
								strcat_s(
								    r, " ");
							}
							((void(__cdecl *)(
							    char *))ID.fun)(r);
							break;
						}
					}
					break;

				// game defined variables
				case ID_VAR:
					if (isdown) {
						if (!w[1][0])
							// var with no value
							// just prints its
							// current value
							conoutf(@"%s = %d", c,

							    *ID.storage);
						else {
							if (ID.min > ID.max) {

								conoutf(
								    @"variable "
								    @"is "
								    @"read-"
								    @"only");
							} else {
								int i1 =
								    ATOI(w[1]);
								if (i1 <

								        ID.min ||
								    i1 >

								        ID.max) {
									// clamp
									// to
									// valid
									// range
									i1 =

									    i1 < ID.min

									        ? ID.min

									        : ID.max;
									conoutf(
									    @"v"
									    @"a"
									    @"l"
									    @"i"
									    @"d"
									    @" "







|

|




|
>
|
<


<
<
|
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
|
|
<






>
|

|
>









>
|

>
|





>
|
>
|
>
|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233

234
235


236

237




















238







239













































































































240
241










242
243

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
		char *c = w[0];
		if (*c == '/')
			c++; // strip irc-style command prefix
		if (!*c)
			continue; // empty statement

		@autoreleasepool {
			__kindof Identifier *identifier = identifiers[@(c)];

			if (identifier == nil) {
				val = ATOI(c);
				if (!val && *c != '0')
					conoutf(@"unknown command: %s", c);
			} else {
				if ([identifier
				        isKindOfClass:[Command class]]) {
					// game defined commands

					// use very ad-hoc function signature,
					// and just call it


					val = [identifier

					    callWithArguments:w




















					         numArguments:numargs







					               isDown:isdown];













































































































				} else if ([identifier
				               isKindOfClass:[Variable










				                                 class]]) {
					// game defined variables

					if (isdown) {
						if (!w[1][0])
							// var with no value
							// just prints its
							// current value
							conoutf(@"%s = %d", c,
							    *[identifier
							        storage]);
						else {
							if ([identifier min] >
							    [identifier max]) {
								conoutf(
								    @"variable "
								    @"is "
								    @"read-"
								    @"only");
							} else {
								int i1 =
								    ATOI(w[1]);
								if (i1 <
								        [identifier
								            min] ||
								    i1 >
								        [identifier
								            max]) {
									// clamp
									// to
									// valid
									// range
									i1 =
									    i1 < [identifier
									             min]
									        ? [identifier
									              min]
									        : [identifier
									              max];
									conoutf(
									    @"v"
									    @"a"
									    @"l"
									    @"i"
									    @"d"
									    @" "
448
449
450
451
452
453
454

455

456
457

458
459
460
461


462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
									    @"%"
									    @"d"
									    @"."
									    @"."
									    @"%"
									    @"d",
									    c,

									    ID.min,

									    ID.max);
								}

								*ID.storage =
								    i1;
							}
							if (ID.fun)


								// call trigger
								// function if
								// available
								((void(__cdecl
								        *)())ID
								        .fun)();
						}
					}
					break;

				// alias, also used as functions and (global)
				// variables
				case ID_ALIAS:
					for (int i = 1; i < numargs; i++) {
						@autoreleasepool {
							// set any arguments as
							// (global) arg values
							// so functions can
							// access them
							OFString *t = [OFString
							    stringWithFormat:
							        @"arg%d", i];
							alias(t, @(w[i]));
						}
					}
					// create new string here because alias
					// could rebind itself
					char *action =
					    newstring(ID.action.UTF8String);
					val = execute(action, isdown);
					gp()->deallocstr(action);
					break;
				}
			}
		}
		loopj(numargs) gp()->deallocstr(w[j]);
	}

	return val;
}

// tab-completion of all idents

int completesize = 0, completeidx = 0;

void
resetcomplete()
{
	completesize = 0;







>
|
>
|

>
|


|
>
>




|
|


|
|
|
|
<














|
|












|







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333

334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
									    @"%"
									    @"d"
									    @"."
									    @"."
									    @"%"
									    @"d",
									    c,
									    [identifier
									        min],
									    [identifier
									        max]);
								}
								*[identifier
								    storage] =
								    i1;
							}
							if ([identifier
							        function] !=
							    NULL)
								// call trigger
								// function if
								// available
								((void(__cdecl
								        *)())[identifier
								        function])();
						}
					}
				} else if ([identifier
				               isKindOfClass:[Alias class]]) {
					// alias, also used as functions and
					// (global) variables

					for (int i = 1; i < numargs; i++) {
						@autoreleasepool {
							// set any arguments as
							// (global) arg values
							// so functions can
							// access them
							OFString *t = [OFString
							    stringWithFormat:
							        @"arg%d", i];
							alias(t, @(w[i]));
						}
					}
					// create new string here because alias
					// could rebind itself
					char *action = newstring(
					    [identifier action].UTF8String);
					val = execute(action, isdown);
					gp()->deallocstr(action);
					break;
				}
			}
		}
		loopj(numargs) gp()->deallocstr(w[j]);
	}

	return val;
}

// tab-completion of all identifiers

int completesize = 0, completeidx = 0;

void
resetcomplete()
{
	completesize = 0;
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549

		if (!completesize) {
			completesize = strlen(s) - 1;
			completeidx = 0;
		}

		__block int idx = 0;
		[idents enumerateKeysAndObjectsUsingBlock:^(
		    OFString *name, Ident *ident, bool *stop) {
			if (strncmp(ident.name.UTF8String, s + 1,
			        completesize) == 0 &&
			    idx++ == completeidx) {
				strcpy_s(s, "/");
				strcat_s(s, ident.name.UTF8String);
			}
		}];

		completeidx++;

		if (completeidx >= idx)
			completeidx = 0;







|
|
|



|







388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408

		if (!completesize) {
			completesize = strlen(s) - 1;
			completeidx = 0;
		}

		__block int idx = 0;
		[identifiers enumerateKeysAndObjectsUsingBlock:^(
		    OFString *name, Identifier *identifier, bool *stop) {
			if (strncmp(identifier.name.UTF8String, s + 1,
			        completesize) == 0 &&
			    idx++ == completeidx) {
				strcpy_s(s, "/");
				strcat_s(s, identifier.name.UTF8String);
			}
		}];

		completeidx++;

		if (completeidx >= idx)
			completeidx = 0;
598
599
600
601
602
603
604
605
606

607
608
609
610


611
612
613
614
615
616
617
618
619
620


621
622
623
624
625
626
627
628
629
	            @"settings\n"
	            @"// modify settings in game, or put settings in "
	            @"autoexec.cfg to override anything\n"
	            @"\n"];
	writeclientinfo(stream);
	[stream writeString:@"\n"];

	[idents enumerateKeysAndObjectsUsingBlock:^(
	    OFString *name, Ident *ident, bool *stop) {

		if (ident.type == ID_VAR && ident.persist) {
			[stream
			    writeFormat:@"%@ %d\n", ident.name, *ident.storage];
		}


	}];
	[stream writeString:@"\n"];

	writebinds(stream);
	[stream writeString:@"\n"];

	[idents enumerateKeysAndObjectsUsingBlock:^(
	    OFString *name, Ident *ident, bool *stop) {
		if (ident.type == ID_ALIAS &&
		    ![ident.name hasPrefix:@"nextmap_"])


			[stream writeFormat:@"alias \"%@\" [%@]\n", ident.name,
			        ident.action];
	}];

	[stream close];
}

COMMAND(writecfg, ARG_NONE)








|
|
>
|
|
<
|
>
>






|
|
|
|
>
>
|
|







457
458
459
460
461
462
463
464
465
466
467
468

469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
	            @"settings\n"
	            @"// modify settings in game, or put settings in "
	            @"autoexec.cfg to override anything\n"
	            @"\n"];
	writeclientinfo(stream);
	[stream writeString:@"\n"];

	[identifiers enumerateKeysAndObjectsUsingBlock:^(
	    OFString *name, __kindof Identifier *identifier, bool *stop) {
		if (![identifier isKindOfClass:[Variable class]] ||
		    ![identifier persisted])
			return;


		[stream writeFormat:@"%@ %d\n", identifier.name,
		        *[identifier storage]];
	}];
	[stream writeString:@"\n"];

	writebinds(stream);
	[stream writeString:@"\n"];

	[identifiers enumerateKeysAndObjectsUsingBlock:^(
	    OFString *name, __kindof Identifier *identifier, bool *stop) {
		if (![identifier isKindOfClass:[Alias class]] ||
		    [identifier.name hasPrefix:@"nextmap_"])
			return;

		[stream writeFormat:@"alias \"%@\" [%@]\n", identifier.name,
		        [identifier action]];
	}];

	[stream close];
}

COMMAND(writecfg, ARG_NONE)

Modified src/meson.build from [784a6d82d7] to [4579a2b4bb].

1
2


3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
executable('client',
  [


    'Cube.mm',
    'Ident.m',
    'KeyMapping.m',
    'MD2.mm',
    'MapModelInfo.m',
    'Menu.m',
    'MenuItem.m',

    'client.mm',
    'clientextras.mm',
    'clientgame.mm',
    'clients2c.mm',
    'command.mm',
    'console.mm',
    'editing.mm',
    'entities.mm',
    'init.mm',
    'menus.mm',
    'monster.mm',
    'physics.mm',


>
>

|





>




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
executable('client',
  [
    'Alias.m',
    'Command.mm',
    'Cube.mm',
    'Identifier.m',
    'KeyMapping.m',
    'MD2.mm',
    'MapModelInfo.m',
    'Menu.m',
    'MenuItem.m',
    'Variable.m',
    'client.mm',
    'clientextras.mm',
    'clientgame.mm',
    'clients2c.mm',
    'commands.mm',
    'console.mm',
    'editing.mm',
    'entities.mm',
    'init.mm',
    'menus.mm',
    'monster.mm',
    'physics.mm',