Deleted Added
full compact
teken_demo.c (256281) teken_demo.c (262861)
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: stable/10/sys/teken/demo/teken_demo.c 223574 2011-06-26 18:25:10Z ed $
26 * $FreeBSD: stable/10/sys/teken/demo/teken_demo.c 262861 2014-03-06 18:30:56Z jhb $
27 */
28
29#include <sys/ioctl.h>
30
31#include <assert.h>
32#include <errno.h>
33#include <inttypes.h>
34#include <locale.h>

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

81{
82 int y, x, attr = 0;
83 struct pixel *px;
84 char str[5] = { 0 };
85
86 assert(p->tp_row < NROWS);
87 assert(p->tp_col < NCOLS);
88
27 */
28
29#include <sys/ioctl.h>
30
31#include <assert.h>
32#include <errno.h>
33#include <inttypes.h>
34#include <locale.h>

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

81{
82 int y, x, attr = 0;
83 struct pixel *px;
84 char str[5] = { 0 };
85
86 assert(p->tp_row < NROWS);
87 assert(p->tp_col < NCOLS);
88
89 getyx(stdscr, y, x);
90
91 px = &buffer[p->tp_col][p->tp_row];
89 px = &buffer[p->tp_col][p->tp_row];
90 /* No need to print right hand side of CJK character manually. */
91 if (px->a.ta_format & TF_CJK_RIGHT)
92 return;
92
93 /* Convert Unicode to UTF-8. */
94 if (px->c < 0x80) {
95 str[0] = px->c;
96 } else if (px->c < 0x800) {
97 str[0] = 0xc0 | (px->c >> 6);
98 str[1] = 0x80 | (px->c & 0x3f);
99 } else if (px->c < 0x10000) {

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

113 attr |= A_UNDERLINE;
114 if (px->a.ta_format & TF_BLINK)
115 attr |= A_BLINK;
116 if (px->a.ta_format & TF_REVERSE)
117 attr |= A_REVERSE;
118
119 bkgdset(attr | COLOR_PAIR(teken_256to8(px->a.ta_fgcolor) +
120 8 * teken_256to8(px->a.ta_bgcolor)));
93
94 /* Convert Unicode to UTF-8. */
95 if (px->c < 0x80) {
96 str[0] = px->c;
97 } else if (px->c < 0x800) {
98 str[0] = 0xc0 | (px->c >> 6);
99 str[1] = 0x80 | (px->c & 0x3f);
100 } else if (px->c < 0x10000) {

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

114 attr |= A_UNDERLINE;
115 if (px->a.ta_format & TF_BLINK)
116 attr |= A_BLINK;
117 if (px->a.ta_format & TF_REVERSE)
118 attr |= A_REVERSE;
119
120 bkgdset(attr | COLOR_PAIR(teken_256to8(px->a.ta_fgcolor) +
121 8 * teken_256to8(px->a.ta_bgcolor)));
122 getyx(stdscr, y, x);
121 mvaddstr(p->tp_row, p->tp_col, str);
123 mvaddstr(p->tp_row, p->tp_col, str);
122
123 move(y, x);
124}
125
126static void
127test_bell(void *s __unused)
128{
129
130 beep();

--- 224 unchanged lines hidden ---
124 move(y, x);
125}
126
127static void
128test_bell(void *s __unused)
129{
130
131 beep();

--- 224 unchanged lines hidden ---