Deleted Added
full compact
teken_demo.c (187367) teken_demo.c (187469)
1/*-
2 * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/syscons/teken/teken_demo.c 187367 2009-01-17 16:37:13Z ed $
26 * $FreeBSD: head/sys/dev/syscons/teken/teken_demo.c 187469 2009-01-20 11:34:28Z ed $
27 */
28
29#include <sys/ioctl.h>
30
31#include <assert.h>
32#include <errno.h>
33#include <inttypes.h>
34#include <stdio.h>

--- 30 unchanged lines hidden (view full) ---

65};
66
67struct pixel {
68 teken_char_t c;
69 teken_attr_t a;
70};
71
72#define NCOLS 80
27 */
28
29#include <sys/ioctl.h>
30
31#include <assert.h>
32#include <errno.h>
33#include <inttypes.h>
34#include <stdio.h>

--- 30 unchanged lines hidden (view full) ---

65};
66
67struct pixel {
68 teken_char_t c;
69 teken_attr_t a;
70};
71
72#define NCOLS 80
73#ifdef TEKEN_XTERM
74#define NROWS 24
75#else /* !TEKEN_XTERM */
73#define NROWS 25
76#define NROWS 25
77#endif /* TEKEN_XTERM */
74struct pixel buffer[NCOLS][NROWS];
75
76static int ptfd;
77
78static void
79printchar(const teken_pos_t *p)
80{
81 int y, x, attr = 0;

--- 17 unchanged lines hidden (view full) ---

99
100 if (px->a.ta_format & TF_BOLD)
101 attr |= A_BOLD;
102 if (px->a.ta_format & TF_UNDERLINE)
103 attr |= A_UNDERLINE;
104 if (px->a.ta_format & TF_BLINK)
105 attr |= A_BLINK;
106
78struct pixel buffer[NCOLS][NROWS];
79
80static int ptfd;
81
82static void
83printchar(const teken_pos_t *p)
84{
85 int y, x, attr = 0;

--- 17 unchanged lines hidden (view full) ---

103
104 if (px->a.ta_format & TF_BOLD)
105 attr |= A_BOLD;
106 if (px->a.ta_format & TF_UNDERLINE)
107 attr |= A_UNDERLINE;
108 if (px->a.ta_format & TF_BLINK)
109 attr |= A_BLINK;
110
107 bkgdset(attr | COLOR_PAIR(px->a.ta_fgcolor + 8 * px->a.ta_bgcolor + 1));
111 bkgdset(attr | COLOR_PAIR(px->a.ta_fgcolor + 8 * px->a.ta_bgcolor));
108 mvaddch(p->tp_row, p->tp_col, px->c);
109
110 move(y, x);
111}
112
113static void
114test_bell(void *s __unused)
115{

--- 180 unchanged lines hidden (view full) ---

296 teken_init(&t, &tf, NULL);
297 teken_set_winsize(&t, &tp);
298
299 initscr();
300 raw();
301 start_color();
302 for (i = 0; i < 8; i++)
303 for (j = 0; j < 8; j++)
112 mvaddch(p->tp_row, p->tp_col, px->c);
113
114 move(y, x);
115}
116
117static void
118test_bell(void *s __unused)
119{

--- 180 unchanged lines hidden (view full) ---

300 teken_init(&t, &tf, NULL);
301 teken_set_winsize(&t, &tp);
302
303 initscr();
304 raw();
305 start_color();
306 for (i = 0; i < 8; i++)
307 for (j = 0; j < 8; j++)
304 init_pair(i + 8 * j + 1, ccolors[i], ccolors[j]);
308 init_pair(i + 8 * j, ccolors[i], ccolors[j]);
305
306 redraw_border();
307
308 FD_ZERO(&rfds);
309
310 for (;;) {
311 FD_SET(STDIN_FILENO, &rfds);
312 FD_SET(ptfd, &rfds);

--- 30 unchanged lines hidden ---
309
310 redraw_border();
311
312 FD_ZERO(&rfds);
313
314 for (;;) {
315 FD_SET(STDIN_FILENO, &rfds);
316 FD_SET(ptfd, &rfds);

--- 30 unchanged lines hidden ---