testpat.c revision 1.5 1 1.5 rillig /* $NetBSD: testpat.c,v 1.5 2021/05/02 12:50:46 rillig Exp $ */
2 1.1 nat
3 1.1 nat /*-
4 1.1 nat * Copyright (c) 2016 Nathanial Sloss <nathanialsloss (at) yahoo.com.au>
5 1.1 nat * All rights reserved.
6 1.1 nat *
7 1.1 nat * Redistribution and use in source and binary forms, with or without
8 1.1 nat * modification, are permitted provided that the following conditions
9 1.1 nat * are met:
10 1.1 nat * 1. Redistributions of source code must retain the above copyright
11 1.1 nat * notice, this list of conditions and the following disclaimer.
12 1.1 nat * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 nat * notice, this list of conditions and the following disclaimer in the
14 1.1 nat * documentation and/or other materials provided with the distribution.
15 1.1 nat *
16 1.1 nat * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 1.1 nat * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.1 nat * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.1 nat * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 1.1 nat * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 1.1 nat * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 1.1 nat * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 1.1 nat * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 1.1 nat * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 1.1 nat * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.1 nat * POSSIBILITY OF SUCH DAMAGE.
27 1.1 nat */
28 1.4 christos #include <sys/cdefs.h>
29 1.5 rillig __RCSID("$NetBSD: testpat.c,v 1.5 2021/05/02 12:50:46 rillig Exp $");
30 1.4 christos
31 1.4 christos #include <sys/types.h>
32 1.4 christos #include <sys/time.h>
33 1.1 nat
34 1.1 nat #include <curses.h>
35 1.1 nat #include <err.h>
36 1.1 nat #include <errno.h>
37 1.1 nat #include <math.h>
38 1.1 nat #include <stdio.h>
39 1.1 nat #include <stdlib.h>
40 1.1 nat #include <string.h>
41 1.1 nat #include <time.h>
42 1.4 christos
43 1.4 christos static int colour_list[6] = {
44 1.4 christos COLOR_YELLOW,
45 1.4 christos COLOR_CYAN,
46 1.4 christos COLOR_GREEN,
47 1.4 christos COLOR_MAGENTA,
48 1.4 christos COLOR_RED,
49 1.4 christos COLOR_BLUE,
50 1.4 christos };
51 1.4 christos static int numcolours = (int)__arraycount(colour_list);
52 1.1 nat
53 1.1 nat int main(int argc, char *argv[]) {
54 1.1 nat int i, col, colour, line, x_limit, y_limit, colourOK, spacing;
55 1.1 nat int xpos, ypos, spacing_residual, spacing_start, spacing_end;
56 1.4 christos int grid_x, grid_y, **circle_pos;
57 1.4 christos size_t ncpos;
58 1.1 nat float grid_unit;
59 1.4 christos const char *title = "NetBSD";
60 1.1 nat float coord_x, circle_int;
61 1.1 nat float a_axis, b_axis;
62 1.1 nat
63 1.4 christos if (!initscr()) {
64 1.4 christos errx(EXIT_FAILURE, "Unknown terminal type");
65 1.1 nat }
66 1.4 christos
67 1.3 jmcneill curs_set(0);
68 1.1 nat
69 1.1 nat if (argc > 2) {
70 1.1 nat endwin();
71 1.4 christos fprintf(stderr, "Usage: %s <title>", getprogname());
72 1.4 christos return EXIT_FAILURE;
73 1.1 nat }
74 1.2 jmcneill
75 1.4 christos if (argc == 2) {
76 1.4 christos title = argv[1];
77 1.4 christos if (strlen(title) >= (size_t)COLS) {
78 1.4 christos endwin();
79 1.4 christos errx(EXIT_FAILURE,
80 1.4 christos "Title string is longer than display cols");
81 1.4 christos }
82 1.1 nat }
83 1.1 nat
84 1.1 nat colourOK = has_colors();
85 1.1 nat
86 1.1 nat if (COLS < 13 || LINES < 13) {
87 1.1 nat endwin();
88 1.4 christos errx(EXIT_FAILURE, "Terminal size must be at least 72x25.");
89 1.1 nat }
90 1.1 nat
91 1.1 nat if (colourOK) {
92 1.1 nat start_color();
93 1.2 jmcneill
94 1.4 christos init_pair(0, COLOR_WHITE, COLOR_BLACK);
95 1.4 christos init_pair(1, COLOR_WHITE, COLOR_RED);
96 1.4 christos init_pair(2, COLOR_WHITE, COLOR_GREEN);
97 1.4 christos init_pair(3, COLOR_WHITE, COLOR_YELLOW);
98 1.4 christos init_pair(4, COLOR_WHITE, COLOR_BLUE);
99 1.4 christos init_pair(5, COLOR_WHITE, COLOR_MAGENTA);
100 1.4 christos init_pair(6, COLOR_WHITE, COLOR_CYAN);
101 1.4 christos init_pair(7, COLOR_BLACK, COLOR_WHITE);
102 1.1 nat
103 1.1 nat attrset(COLOR_PAIR(0));
104 1.1 nat }
105 1.1 nat
106 1.1 nat x_limit = (COLS - 1) / 2;
107 1.1 nat x_limit = x_limit * 2;
108 1.1 nat y_limit = (LINES - 2) / 2;
109 1.1 nat y_limit = y_limit * 2;
110 1.1 nat spacing = 2 * y_limit / numcolours;
111 1.1 nat spacing_residual = ((2 * y_limit) % numcolours) / 2;
112 1.1 nat a_axis = y_limit / 2;
113 1.1 nat b_axis = y_limit;
114 1.1 nat grid_unit = b_axis / 13;
115 1.1 nat grid_y = grid_unit;
116 1.1 nat grid_x = grid_unit * 2;
117 1.1 nat
118 1.5 rillig
119 1.4 christos ncpos = y_limit * sizeof(*circle_pos)
120 1.4 christos + y_limit * 2 * sizeof(**circle_pos);
121 1.4 christos circle_pos = malloc(ncpos);
122 1.4 christos if (circle_pos == NULL) {
123 1.4 christos endwin();
124 1.4 christos errx(EXIT_FAILURE, "Can't allocate circle positions");
125 1.4 christos }
126 1.4 christos for (i = 0; i < y_limit; i++) {
127 1.4 christos circle_pos[i] = (void *)&circle_pos[y_limit + i * 2];
128 1.4 christos circle_pos[i][0] = circle_pos[i][1] = -1;
129 1.4 christos }
130 1.1 nat
131 1.1 nat for (i = 0; i < y_limit; i++) {
132 1.4 christos /* Draw an ellipse (looks more circular.) */
133 1.1 nat circle_int = (i - a_axis) / a_axis;
134 1.1 nat circle_int = 1 - powf(circle_int, 2);
135 1.1 nat circle_int = circle_int * powf(b_axis, 2);
136 1.1 nat #if 0
137 1.1 nat /* Draw a circle, commented out as elipse looks better.*/
138 1.1 nat circle_int = powf(a_axis, 2) - powf(i - a_axis, 2);
139 1.1 nat #endif
140 1.1 nat coord_x = sqrtf(circle_int);
141 1.1 nat circle_pos[i][0] = (-coord_x + ((float)x_limit / 2));
142 1.1 nat circle_pos[i][1] = (coord_x + ((float)x_limit / 2));
143 1.1 nat }
144 1.1 nat
145 1.1 nat clear();
146 1.1 nat
147 1.1 nat attron(A_ALTCHARSET);
148 1.1 nat move(0, 0);
149 1.1 nat
150 1.1 nat /* Draw a grid. */
151 1.1 nat for (line = 1; line < y_limit; line += grid_y) {
152 1.1 nat for (col = 1; col < x_limit; col = col + grid_x) {
153 1.1 nat xpos = col;
154 1.1 nat while ((xpos < col + grid_x - 1) && (xpos <
155 1.1 nat x_limit)) {
156 1.1 nat mvaddch(line + grid_y - 1, xpos, 113 |
157 1.1 nat A_ALTCHARSET);
158 1.1 nat xpos++;
159 1.1 nat }
160 1.1 nat if (xpos < x_limit)
161 1.1 nat mvaddch(line + grid_y - 1, xpos, 110 |
162 1.1 nat A_ALTCHARSET);
163 1.1 nat }
164 1.1 nat ypos = line;
165 1.1 nat while (ypos < line + grid_y - 1) {
166 1.1 nat for (col = grid_x - 1; col < x_limit; col += grid_x) {
167 1.1 nat mvaddch(ypos, col + 1, 120 | A_ALTCHARSET);
168 1.1 nat }
169 1.1 nat ypos++;
170 1.1 nat }
171 1.1 nat }
172 1.1 nat
173 1.1 nat for (line = 1; line < y_limit; line += grid_y) {
174 1.1 nat mvaddch(line + grid_y - 1, 0, 116 | A_ALTCHARSET);
175 1.1 nat mvaddch(line + grid_y - 1, x_limit, 117 | A_ALTCHARSET);
176 1.1 nat
177 1.1 nat ypos = line;
178 1.1 nat while (ypos < line + grid_y - 1) {
179 1.1 nat mvaddch(ypos, 0, 120 | A_ALTCHARSET);
180 1.1 nat mvaddch(ypos, x_limit, 120 | A_ALTCHARSET);
181 1.1 nat ypos++;
182 1.1 nat }
183 1.1 nat }
184 1.1 nat
185 1.1 nat for (col = 1; col < x_limit; col += grid_x) {
186 1.1 nat mvaddch(0, col + grid_x - 1, 119 | A_ALTCHARSET);
187 1.1 nat mvaddch(y_limit, col + grid_x - 1, 118 | A_ALTCHARSET);
188 1.1 nat
189 1.1 nat xpos = col;
190 1.1 nat while ((xpos < col + grid_x - 1) && (xpos < x_limit)) {
191 1.1 nat mvaddch(0, xpos, 113 | A_ALTCHARSET);
192 1.1 nat mvaddch(y_limit, xpos, 113 | A_ALTCHARSET);
193 1.1 nat xpos++;
194 1.1 nat }
195 1.1 nat }
196 1.1 nat
197 1.1 nat mvaddch(0, 0, 108 | A_ALTCHARSET);
198 1.1 nat mvaddch(0, x_limit, 107 | A_ALTCHARSET);
199 1.1 nat mvaddch(y_limit, 0, 109 | A_ALTCHARSET);
200 1.1 nat mvaddch(y_limit, x_limit, 106 | A_ALTCHARSET);
201 1.1 nat
202 1.1 nat /* Draw a white circle. */
203 1.1 nat for (i = 1; i < y_limit; i++) {
204 1.1 nat for (col = circle_pos[i][0]; col <= circle_pos[i][1]; col++) {
205 1.1 nat mvaddch(i, col, 32 | A_REVERSE);
206 1.1 nat }
207 1.1 nat }
208 1.2 jmcneill
209 1.1 nat /* Add title segment. */
210 1.1 nat for (i = roundf(1 * grid_unit); i < roundf(2 * grid_unit); i++) {
211 1.1 nat if (colourOK)
212 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
213 1.1 nat
214 1.1 nat for (col = roundf((4 * grid_unit * 2) +
215 1.4 christos circle_pos[y_limit / 2][0]); col <= roundf((9 * grid_unit
216 1.4 christos * 2) + circle_pos[y_limit / 2][0]); col++)
217 1.1 nat mvaddch(i, col, ' ');
218 1.1 nat }
219 1.1 nat
220 1.2 jmcneill i = roundf(1.4 * grid_unit);
221 1.1 nat
222 1.1 nat col = y_limit - (strlen(title) / 2) + circle_pos[y_limit / 2][0];
223 1.1 nat mvprintw(i, col, "%s", title);
224 1.1 nat
225 1.1 nat /* Add black segments at top. */
226 1.1 nat for (line = roundf(2 * grid_unit); line < 4 * grid_unit; line++) {
227 1.1 nat if (colourOK)
228 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
229 1.1 nat
230 1.1 nat for (col = 0; col <= roundf((3.5 * grid_unit * 2)); col++) {
231 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
232 1.1 nat if (xpos >= circle_pos[line][0] &&
233 1.1 nat xpos <= circle_pos[line][1])
234 1.1 nat mvaddch(line, xpos, ' ');
235 1.1 nat }
236 1.1 nat
237 1.2 jmcneill for (col = roundf((9.5 * grid_unit * 2)); col <
238 1.1 nat roundf((13 * grid_unit * 2)); col++) {
239 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
240 1.1 nat if (xpos >= circle_pos[line][0] &&
241 1.1 nat xpos <= circle_pos[line][1])
242 1.1 nat mvaddch(line, xpos, ' ');
243 1.1 nat }
244 1.1 nat }
245 1.1 nat
246 1.1 nat /* Add black and white squares close to top. */
247 1.1 nat int gap = (circle_pos[(int)(5 * grid_unit)][1] -
248 1.1 nat circle_pos[(int)(5 * grid_unit)][0]) / 13;
249 1.1 nat
250 1.1 nat for (i = roundf(3 * grid_unit); i < roundf(4 * grid_unit); i++) {
251 1.1 nat for (xpos = 0; xpos <= x_limit; xpos += 2 * gap) {
252 1.1 nat if (colourOK)
253 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
254 1.1 nat
255 1.1 nat for (col = xpos; col < xpos + gap; col++) {
256 1.1 nat if (col >= circle_pos[i][0] &&
257 1.1 nat col <= circle_pos[i][1])
258 1.1 nat mvaddch(i, col, ' ');
259 1.1 nat }
260 1.1 nat
261 1.1 nat if (colourOK)
262 1.1 nat attrset(COLOR_PAIR(COLOR_WHITE));
263 1.1 nat
264 1.1 nat for (col = xpos + gap ; col < xpos + (2 * gap);
265 1.1 nat col++) {
266 1.1 nat if (col >= circle_pos[i][0] &&
267 1.1 nat col <= circle_pos[i][1])
268 1.1 nat mvaddch(i, col, ' ');
269 1.1 nat }
270 1.1 nat }
271 1.1 nat }
272 1.1 nat
273 1.1 nat /* Add colour bars. */
274 1.1 nat for (i = 0; i < numcolours; i++) {
275 1.1 nat colour = colour_list[i];
276 1.1 nat if (colourOK)
277 1.1 nat attrset(COLOR_PAIR(colour));
278 1.1 nat
279 1.2 jmcneill if (i == 0)
280 1.1 nat spacing_start = 0;
281 1.1 nat else
282 1.1 nat spacing_start = (spacing * i) + spacing_residual;
283 1.1 nat
284 1.1 nat if (i == numcolours - 1)
285 1.1 nat spacing_end = circle_pos[y_limit / 2][1];
286 1.1 nat else
287 1.1 nat spacing_end = (spacing * (i + 1)) + spacing_residual;
288 1.1 nat
289 1.1 nat for (line = roundf(4 * grid_unit); line < (y_limit / 2);
290 1.1 nat line++) {
291 1.1 nat for (col = spacing_start; col < spacing_end; col++) {
292 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
293 1.1 nat if (xpos >= circle_pos[line][0] &&
294 1.1 nat xpos <= circle_pos[line][1])
295 1.1 nat mvprintw(line, xpos, " ");
296 1.1 nat }
297 1.1 nat }
298 1.1 nat }
299 1.1 nat
300 1.1 nat /* Add black segment under centre line. */
301 1.1 nat for (line = y_limit / 2; line < (9.5 * grid_unit); line++) {
302 1.1 nat if (colourOK)
303 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
304 1.1 nat
305 1.1 nat for (col = circle_pos[line][0]; col <= circle_pos[line][1];
306 1.1 nat col++)
307 1.1 nat mvaddch(line, col, ' ');
308 1.1 nat
309 1.2 jmcneill for (col = roundf((1.5 * grid_unit * 2)); col <
310 1.1 nat roundf((4.3 * grid_unit * 2)); col++) {
311 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
312 1.1 nat if (xpos >= circle_pos[line][0] &&
313 1.1 nat xpos < circle_pos[line][1])
314 1.1 nat mvaddch(line, xpos, 120 | A_ALTCHARSET);
315 1.1 nat }
316 1.1 nat
317 1.2 jmcneill for (col = roundf((4.3 * grid_unit * 2)); col <
318 1.1 nat roundf((7.6 * grid_unit * 2)); col++) {
319 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
320 1.1 nat if (xpos >= circle_pos[line][0] &&
321 1.1 nat xpos < circle_pos[line][1])
322 1.1 nat mvaddch(line, xpos, '|');
323 1.1 nat }
324 1.1 nat
325 1.2 jmcneill for (col = roundf((7.6 * grid_unit * 2)); col <
326 1.1 nat roundf((11.5 * grid_unit * 2)); col++) {
327 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
328 1.1 nat if (xpos >= circle_pos[line][0] &&
329 1.1 nat xpos < circle_pos[line][1])
330 1.1 nat mvaddch(line, xpos, 97 | A_ALTCHARSET);
331 1.1 nat }
332 1.1 nat }
333 1.1 nat
334 1.1 nat /* Add black segment close to bottom. */
335 1.1 nat for (line = roundf(9.5 * grid_unit); line <= (10.5 * grid_unit);
336 1.1 nat line++) {
337 1.1 nat if (colourOK)
338 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
339 1.1 nat
340 1.2 jmcneill for (col = roundf((0 * grid_unit * 2)); col <
341 1.1 nat roundf((4 * grid_unit * 2)); col++) {
342 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
343 1.1 nat if (xpos >= circle_pos[line][0] &&
344 1.1 nat xpos < circle_pos[line][1])
345 1.1 nat mvaddch(line, xpos, ' ');
346 1.1 nat }
347 1.1 nat
348 1.2 jmcneill for (col = roundf((4 * grid_unit * 2)); col <
349 1.1 nat roundf((6.5 * grid_unit * 2)); col++) {
350 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
351 1.1 nat if (xpos >= circle_pos[line][0] &&
352 1.1 nat xpos < circle_pos[line][1])
353 1.1 nat mvaddch(line, xpos, 97 | A_ALTCHARSET);
354 1.1 nat }
355 1.1 nat
356 1.1 nat if (colourOK)
357 1.1 nat attrset(COLOR_PAIR(COLOR_WHITE));
358 1.1 nat
359 1.2 jmcneill for (col = roundf((6.5 * grid_unit * 2)); col <
360 1.1 nat roundf((9 * grid_unit * 2)); col++) {
361 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
362 1.1 nat if (xpos >= circle_pos[line][0] &&
363 1.1 nat xpos < circle_pos[line][1])
364 1.1 nat mvaddch(line, xpos, 97 | A_ALTCHARSET);
365 1.1 nat }
366 1.1 nat
367 1.2 jmcneill for (col = roundf((9 * grid_unit * 2)); col <
368 1.1 nat roundf((13 * grid_unit * 2)); col++) {
369 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
370 1.1 nat if (xpos >= circle_pos[line][0] &&
371 1.1 nat xpos < circle_pos[line][1])
372 1.1 nat mvaddch(line, xpos, ' ');
373 1.1 nat }
374 1.1 nat }
375 1.1 nat
376 1.1 nat /* Add name segment close to bottom. */
377 1.1 nat for (line = roundf(10.5 * grid_unit); line < (12 * grid_unit);
378 1.1 nat line++) {
379 1.1 nat if (colourOK)
380 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
381 1.1 nat
382 1.1 nat for (col = roundf(3.5 * grid_unit * 2); col <= roundf(9.5 *
383 1.1 nat grid_unit * 2); col++) {
384 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
385 1.1 nat if (xpos >= circle_pos[line][0] &&
386 1.1 nat xpos < circle_pos[line][1])
387 1.1 nat mvaddch(line, xpos, ' ');
388 1.1 nat }
389 1.1 nat
390 1.1 nat if (colourOK)
391 1.1 nat attrset(COLOR_PAIR(COLOR_WHITE));
392 1.1 nat
393 1.1 nat for (col = roundf(0 * grid_unit * 2); col <= roundf(3.5 *
394 1.1 nat grid_unit * 2); col++) {
395 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
396 1.1 nat if (xpos >= circle_pos[line][0] &&
397 1.1 nat xpos < circle_pos[line][1])
398 1.1 nat mvaddch(line, xpos, ' ');
399 1.1 nat }
400 1.1 nat
401 1.1 nat for (col = roundf(9.5 * grid_unit * 2); col <= roundf(13 *
402 1.1 nat grid_unit * 2); col++) {
403 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
404 1.1 nat if (xpos >= circle_pos[line][0] &&
405 1.1 nat xpos < circle_pos[line][1])
406 1.1 nat mvaddch(line, xpos, ' ');
407 1.1 nat }
408 1.1 nat }
409 1.1 nat
410 1.1 nat /* Add yellow segment at bottom. */
411 1.1 nat for (line = 12 * grid_unit; line < y_limit; line++) {
412 1.1 nat if (colourOK)
413 1.1 nat attrset(COLOR_PAIR(COLOR_YELLOW));
414 1.1 nat
415 1.1 nat for (col = circle_pos[line][0]; col <= circle_pos[line][1];
416 1.1 nat col++)
417 1.1 nat mvaddch(line, col, ' ');
418 1.1 nat
419 1.1 nat if (colourOK)
420 1.1 nat attrset(COLOR_PAIR(COLOR_RED));
421 1.1 nat
422 1.2 jmcneill for (col = roundf((6 * grid_unit * 2)); col <
423 1.1 nat roundf((7 * grid_unit * 2)); col++) {
424 1.1 nat xpos = col + circle_pos[y_limit / 2][0];
425 1.1 nat if (xpos >= circle_pos[line][0] &&
426 1.1 nat xpos < circle_pos[line][1])
427 1.1 nat mvaddch(line, xpos, ' ');
428 1.1 nat }
429 1.1 nat }
430 1.1 nat
431 1.1 nat if (colourOK)
432 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
433 1.2 jmcneill
434 1.1 nat for (line = 6 * grid_unit; line <= (7 * grid_unit) + 1; line++) {
435 1.1 nat if (colourOK)
436 1.1 nat attrset(COLOR_PAIR(COLOR_BLACK));
437 1.1 nat
438 1.1 nat col = x_limit / 2;
439 1.1 nat if (line != a_axis) {
440 1.1 nat mvaddch(line, col - 1, ' ');
441 1.1 nat mvaddch(line, col, 120 | A_ALTCHARSET);
442 1.1 nat mvaddch(line, col + 1, ' ');
443 1.1 nat }
444 1.1 nat }
445 1.1 nat
446 1.1 nat line = y_limit / 2;
447 1.1 nat for (col = 1; col < x_limit; col = col + grid_x) {
448 1.1 nat xpos = col;
449 1.1 nat while (xpos < col + grid_x - 1) {
450 1.4 christos if (xpos >= circle_pos[line][0]
451 1.4 christos && xpos < circle_pos[line][1])
452 1.1 nat mvaddch(line, xpos, 113 | A_ALTCHARSET);
453 1.1 nat xpos++;
454 1.1 nat }
455 1.1 nat if (xpos >= circle_pos[line][0] && xpos < circle_pos[line][1])
456 1.1 nat mvaddch(line, xpos, 110 | A_ALTCHARSET);
457 1.1 nat }
458 1.1 nat
459 1.1 nat line = y_limit / 2;
460 1.1 nat col = x_limit / 2;
461 1.1 nat mvaddch(line, col, 110 | A_ALTCHARSET);
462 1.1 nat mvaddch(line, col - 1, 113 | A_ALTCHARSET);
463 1.1 nat mvaddch(line, col + 1, 113 | A_ALTCHARSET);
464 1.1 nat
465 1.1 nat refresh();
466 1.1 nat
467 1.1 nat getch();
468 1.1 nat
469 1.1 nat endwin();
470 1.1 nat
471 1.1 nat return EXIT_SUCCESS;
472 1.1 nat }
473 1.1 nat
474