ObjFW  Diff

Differences From Artifact [cd3ec05bca]:

To Artifact [edc6e4e174]:


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
119
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
119







-
+



-
-
+
+

-
-
+
+



-
-
+
+

-
-
+
+




-
-
-
+
+
+

-
-
+
+



-
+


-
+


-
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+


-
+


-
-
+
+


-
+

-
+

-
+

-
+

-
+

-
+


-
+


-
+




	    [OFColor maroon], [OFColor red], [OFColor purple],
	    [OFColor fuchsia], [OFColor green], [OFColor lime], [OFColor olive],
	    [OFColor yellow], [OFColor navy], [OFColor blue], [OFColor teal],
	    [OFColor aqua], nil];
	size_t i;
	OFEnumerator OF_GENERIC(OFColor *) *reverseEnumerator;

	[of_stdout writeFormat: @"%dx%d\n", of_stdout.columns, of_stdout.rows];
	[OFStdOut writeFormat: @"%dx%d\n", OFStdOut.columns, OFStdOut.rows];

	i = 0;
	for (OFColor *color in colors) {
		[of_stdout setForegroundColor: color];
		[of_stdout writeFormat: @"%zx", i++];
		[OFStdOut setForegroundColor: color];
		[OFStdOut writeFormat: @"%zx", i++];
	}
	[of_stdout reset];
	[of_stdout writeLine: @"R"];
	[OFStdOut reset];
	[OFStdOut writeLine: @"R"];

	i = 0;
	for (OFColor *color in colors) {
		[of_stdout setBackgroundColor: color];
		[of_stdout writeFormat: @"%zx", i++];
		[OFStdOut setBackgroundColor: color];
		[OFStdOut writeFormat: @"%zx", i++];
	}
	[of_stdout reset];
	[of_stdout writeLine: @"R"];
	[OFStdOut reset];
	[OFStdOut writeLine: @"R"];

	i = 0;
	reverseEnumerator = [colors.reversedArray objectEnumerator];
	for (OFColor *color in colors) {
		[of_stdout setForegroundColor: color];
		[of_stdout setBackgroundColor: [reverseEnumerator nextObject]];
		[of_stdout writeFormat: @"%zx", i++];
		[OFStdOut setForegroundColor: color];
		[OFStdOut setBackgroundColor: [reverseEnumerator nextObject]];
		[OFStdOut writeFormat: @"%zx", i++];
	}
	[of_stdout reset];
	[of_stdout writeLine: @"R"];
	[OFStdOut reset];
	[OFStdOut writeLine: @"R"];

	for (i = 0; i < colors.count * 2; i++) {
		if (i % 2)
			[of_stdout setBackgroundColor: [colors objectAtIndex:
			[OFStdOut setBackgroundColor: [colors objectAtIndex:
			    ((i / 2) + 2) % colors.count]];
		else
			[of_stdout setForegroundColor:
			[OFStdOut setForegroundColor:
			    [colors objectAtIndex: i / 2]];

		[of_stdout writeFormat: @"%zx", i / 2];
		[OFStdOut writeFormat: @"%zx", i / 2];
	}
	[of_stdout reset];
	[of_stdout writeLine: @"R"];
	[OFStdOut reset];
	[OFStdOut writeLine: @"R"];

	[of_stdout writeLine: @"Press return"];
	[of_stdin readLine];
	[OFStdOut writeLine: @"Press return"];
	[OFStdIn readLine];

	[of_stdout setBackgroundColor: [OFColor green]];
	[of_stdout writeString: @"Hello!"];
	[OFStdOut setBackgroundColor: [OFColor green]];
	[OFStdOut writeString: @"Hello!"];
	[OFThread sleepForTimeInterval: 2];
	[of_stdout eraseLine];
	[of_stdout writeString: @"World!"];
	[OFStdOut eraseLine];
	[OFStdOut writeString: @"World!"];
	[OFThread sleepForTimeInterval: 2];

	[of_stdout clear];
	[OFStdOut clear];
	[OFThread sleepForTimeInterval: 2];

	[of_stdout setCursorPosition: of_point(5, 3)];
	[of_stdout writeString: @"Text at (5, 3)"];
	[OFStdOut setCursorPosition: OFPointMake(5, 3)];
	[OFStdOut writeString: @"Text at (5, 3)"];
	[OFThread sleepForTimeInterval: 2];

	[of_stdout setRelativeCursorPosition: of_point(-2, 0)];
	[OFStdOut setRelativeCursorPosition: OFPointMake(-2, 0)];
	[OFThread sleepForTimeInterval: 2];
	[of_stdout setRelativeCursorPosition: of_point(2, 0)];
	[OFStdOut setRelativeCursorPosition: OFPointMake(2, 0)];
	[OFThread sleepForTimeInterval: 2];
	[of_stdout setRelativeCursorPosition: of_point(0, -2)];
	[OFStdOut setRelativeCursorPosition: OFPointMake(0, -2)];
	[OFThread sleepForTimeInterval: 2];
	[of_stdout setRelativeCursorPosition: of_point(0, 2)];
	[OFStdOut setRelativeCursorPosition: OFPointMake(0, 2)];
	[OFThread sleepForTimeInterval: 2];
	[of_stdout setRelativeCursorPosition: of_point(1, 1)];
	[OFStdOut setRelativeCursorPosition: OFPointMake(1, 1)];
	[OFThread sleepForTimeInterval: 2];
	[of_stdout setRelativeCursorPosition: of_point(-1, -1)];
	[OFStdOut setRelativeCursorPosition: OFPointMake(-1, -1)];
	[OFThread sleepForTimeInterval: 2];

	[of_stdout setCursorColumn: 2];
	[OFStdOut setCursorColumn: 2];
	[OFThread sleepForTimeInterval: 2];

	[of_stdout reset];
	[OFStdOut reset];

	[OFApplication terminate];
}
@end