Deleted Added
full compact
teken.c (206141) teken.c (221698)
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/teken/teken.c 206141 2010-04-03 17:22:28Z ed $
26 * $FreeBSD: head/sys/teken/teken.c 221698 2011-05-09 16:27:39Z ed $
27 */
28
29#include <sys/cdefs.h>
30#if defined(__FreeBSD__) && defined(_KERNEL)
31#include <sys/param.h>
32#include <sys/lock.h>
33#include <sys/systm.h>
34#define teken_assert(x) MPASS(x)
27 */
28
29#include <sys/cdefs.h>
30#if defined(__FreeBSD__) && defined(_KERNEL)
31#include <sys/param.h>
32#include <sys/lock.h>
33#include <sys/systm.h>
34#define teken_assert(x) MPASS(x)
35#define teken_printf(x,...)
36#else /* !(__FreeBSD__ && _KERNEL) */
37#include <sys/types.h>
38#include <assert.h>
39#include <stdint.h>
40#include <stdio.h>
41#include <string.h>
42#define teken_assert(x) assert(x)
35#else /* !(__FreeBSD__ && _KERNEL) */
36#include <sys/types.h>
37#include <assert.h>
38#include <stdint.h>
39#include <stdio.h>
40#include <string.h>
41#define teken_assert(x) assert(x)
43#define teken_printf(x,...) do { \
44 if (df != NULL) \
45 fprintf(df, x, ## __VA_ARGS__); \
46} while (0)
47/* debug messages */
48static FILE *df;
49#endif /* __FreeBSD__ && _KERNEL */
50
42#endif /* __FreeBSD__ && _KERNEL */
43
44/* debug messages */
45#define teken_printf(x,...)
46
51/* Private flags for t_stateflags. */
52#define TS_FIRSTDIGIT 0x0001 /* First numeric digit in escape sequence. */
53#define TS_INSERT 0x0002 /* Insert mode. */
54#define TS_AUTOWRAP 0x0004 /* Autowrap. */
55#define TS_ORIGIN 0x0008 /* Origin mode. */
56#define TS_WRAPPED 0x0010 /* Next character should be printed on col 0. */
57#define TS_8BIT 0x0020 /* UTF-8 disabled. */
58#define TS_CONS25 0x0040 /* cons25 emulation. */

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

148 * Programming interface.
149 */
150
151void
152teken_init(teken_t *t, const teken_funcs_t *tf, void *softc)
153{
154 teken_pos_t tp = { .tp_row = 24, .tp_col = 80 };
155
47/* Private flags for t_stateflags. */
48#define TS_FIRSTDIGIT 0x0001 /* First numeric digit in escape sequence. */
49#define TS_INSERT 0x0002 /* Insert mode. */
50#define TS_AUTOWRAP 0x0004 /* Autowrap. */
51#define TS_ORIGIN 0x0008 /* Origin mode. */
52#define TS_WRAPPED 0x0010 /* Next character should be printed on col 0. */
53#define TS_8BIT 0x0020 /* UTF-8 disabled. */
54#define TS_CONS25 0x0040 /* cons25 emulation. */

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

144 * Programming interface.
145 */
146
147void
148teken_init(teken_t *t, const teken_funcs_t *tf, void *softc)
149{
150 teken_pos_t tp = { .tp_row = 24, .tp_col = 80 };
151
156#if !(defined(__FreeBSD__) && defined(_KERNEL))
157 df = fopen("teken.log", "w");
158 if (df != NULL)
159 setvbuf(df, NULL, _IOLBF, BUFSIZ);
160#endif /* !(__FreeBSD__ && _KERNEL) */
161
162 t->t_funcs = tf;
163 t->t_softc = softc;
164
165 t->t_nextstate = teken_state_init;
166 t->t_stateflags = 0;
167 t->t_utf8_left = 0;
168
169 t->t_defattr.ta_format = 0;

--- 374 unchanged lines hidden ---
152 t->t_funcs = tf;
153 t->t_softc = softc;
154
155 t->t_nextstate = teken_state_init;
156 t->t_stateflags = 0;
157 t->t_utf8_left = 0;
158
159 t->t_defattr.ta_format = 0;

--- 374 unchanged lines hidden ---