Add TextWriter, IOException, per-VM module data and pre-load imports; Add console module with Console class

This commit is contained in:
2026-11-23 18:36:46 +01:00
parent 2243557bf5
commit 4d06edd045
55 changed files with 1679 additions and 675 deletions
+21 -20
View File
@@ -1,3 +1,4 @@
import 'console';
class Program {
private string $s = 'monkey';
private string $t = 'many monkeys';
@@ -11,29 +12,29 @@ class Program {
}
private void testMonkey() {
printf("[%s]\n", $this->s);
printf("[%10s]\n", $this->s);
printf("[%-10s]\n", $this->s);
printf("[%010s]\n", $this->s);
printf("[%'#10s]\n", $this->s);
printf("[%10.10s]\n", $this->t);
Console::Print("[%s]\n", $this->s);
Console::Print("[%10s]\n", $this->s);
Console::Print("[%-10s]\n", $this->s);
Console::Print("[%010s]\n", $this->s);
Console::Print("[%'#10s]\n", $this->s);
Console::Print("[%10.10s]\n", $this->t);
}
private void testNumbers() {
printf("%%b = '%b'\n", $this->n);
printf("%%c = '%c'\n", $this->c);
printf("%%d = '%d'\n", $this->c);
printf("%%d = '%d'\n", $this->n);
printf("%%e = '%e'\n", $this->n);
printf("%%u = '%u'\n", $this->n);
printf("%%u = '%u'\n", $this->u);
printf("%%f = '%f'\n", $this->n);
printf("%%o = '%o'\n", $this->n);
printf("%%s = '%s'\n", $this->n);
printf("%%x = '%x'\n", $this->n);
printf("%%X = '%X'\n", $this->n);
printf("%%+d = '%+d'\n", $this->n);
printf("%%+d = '%+d'\n", $this->u);
Console::Print("%%b = '%b'\n", $this->n);
Console::Print("%%c = '%c'\n", $this->c);
Console::Print("%%d = '%d'\n", $this->c);
Console::Print("%%d = '%d'\n", $this->n);
Console::Print("%%e = '%e'\n", $this->n);
Console::Print("%%u = '%u'\n", $this->n);
Console::Print("%%u = '%u'\n", $this->u);
Console::Print("%%f = '%f'\n", $this->n);
Console::Print("%%o = '%o'\n", $this->n);
Console::Print("%%s = '%s'\n", $this->n);
Console::Print("%%x = '%x'\n", $this->n);
Console::Print("%%X = '%X'\n", $this->n);
Console::Print("%%+d = '%+d'\n", $this->n);
Console::Print("%%+d = '%+d'\n", $this->u);
}
}