Cube  Diff

Differences From Artifact [645f04d656]:

To Artifact [f53c401a17]:


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
511

512
513
514
515
516
517
518
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
511
512
513
514
515
516
517
518
519

520
521
522
523
524
525
526
527







-
+

-
-
-
-
+
+
+
+
+
+

-
+


-
+




-
+

+
-
-
-
+
+
+




-
+

+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+












-
+








		while (execute(cond.get()))
			execute(body.get());
	}
}

void
onrelease(bool on, char *body)
onrelease(bool on, OFString *body)
{
	if (!on)
		execute(body);
}

	if (!on) {
		std::unique_ptr<char> copy(strdup(body.UTF8String));
		execute(copy.get());
	}
}

void
concat(char *s)
concat(OFString *s)
{
	@autoreleasepool {
		alias(@"s", @(s));
		alias(@"s", s);
	}
}

void
concatword(char *s)
concatword(OFString *s)
{
	// The original used this code which does nothing:
	for (char *a = s, *b = s; *a = *b; b++)
		if (*a != ' ')
			a++;
	// for (char *a = s, *b = s; *a = *b; b++)
	//	if (*a != ' ')
	//		a++;
	concat(s);
}

int
listlen(char *a)
listlen(OFString *a_)
{
	@autoreleasepool {
		const char *a = a_.UTF8String;

	if (!*a)
		return 0;
	int n = 0;
	while (*a)
		if (*a++ == ' ')
			n++;
	return n + 1;
		if (!*a)
			return 0;

		int n = 0;
		while (*a)
			if (*a++ == ' ')
				n++;

		return n + 1;
	}
}

void
at(OFString *s_, OFString *pos)
{
	@autoreleasepool {
		int n = (int)pos.longLongValue;
		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);
		concat(@(s));
	}
}

COMMANDN(loop, loopa, ARG_2STR)
COMMANDN(while, whilea, ARG_2STR)
COMMANDN(if, ifthen, ARG_3STR)
COMMAND(onrelease, ARG_DWN1)
575
576
577
578
579
580
581
582

583
584

585
586
587
588
589
590
591
584
585
586
587
588
589
590

591
592

593
594
595
596
597
598
599
600







-
+

-
+







gt(int a, int b)
{
	return (int)(a > b);
}
COMMANDN(>, gt, ARG_2EXP)

int
strcmpa(char *a, char *b)
strcmpa(OFString *a, OFString *b)
{
	return strcmp(a, b) == 0;
	return [a isEqual:b];
}
COMMANDN(strcmp, strcmpa, ARG_2EST)

int
rndn(int a)
{
	return a > 0 ? rnd(a) : 0;