Cube  Diff

Differences From Artifact [095c9bcfa3]:

To Artifact [69ee305979]:


229
230
231
232
233
234
235
236

237
238
239
240
241
242
243
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243







-
+







			// empty statement
			if (c.length == 0)
				continue;

			__kindof Identifier *identifier = identifiers[c];
			if (identifier == nil) {
				@try {
					val = (int)[c longLongValueWithBase:0];
					val = [c intValueWithBase:0];
				} @catch (OFInvalidFormatException *e) {
					conoutf(@"unknown command: %@", c);
				}
			} else {
				if ([identifier isKindOfClass:Command.class]) {
					// game defined commands use very
					// ad-hoc function signature, and just
254
255
256
257
258
259
260
261
262


263
264
265
266
267
268
269
254
255
256
257
258
259
260


261
262
263
264
265
266
267
268
269







-
-
+
+







					// game defined variables
					if (isDown) {
						if (w[1].length == 0)
							[identifier printValue];
						else
							[identifier
							    setValue:
							        (int)[w[1]
							            longLongValueWithBase:
							        [w[1]
							            intValueWithBase:
							                0]];
					}
				} else if ([identifier
				               isKindOfClass:Alias.class]) {
					// alias, also used as functions and
					// (global) variables
					for (int i = 1; i < numargs; i++) {
435
436
437
438
439
440
441
442

443
444
445
446
447
448
449
435
436
437
438
439
440
441

442
443
444
445
446
447
448
449







-
+







	execute((![cond hasPrefix:@"0"] ? thenp : elsep));
}

void
loopa(OFString *times, OFString *body)
{
	@autoreleasepool {
		int t = (int)times.longLongValue;
		int t = times.intValue;

		loopi(t)
		{
			intset(@"i", i);
			execute(body);
		}
	}
493
494
495
496
497
498
499
500

501
502
503
504
505
506
507
493
494
495
496
497
498
499

500
501
502
503
504
505
506
507







-
+







	}
}

void
at(OFString *s_, OFString *pos)
{
	@autoreleasepool {
		int n = (int)pos.longLongValue;
		int n = pos.intValue;
		std::unique_ptr<char> copy(strdup(s_.UTF8String));
		char *s = copy.get();

		loopi(n) s += strspn(s += strcspn(s, " \0"), " ");
		s[strcspn(s, " \0")] = 0;
		concat(@(s));
	}