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 197117 2009-09-12 12:44:21Z 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)
--- 8 unchanged lines hidden (view full) ---
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
51#include "teken.h"
52#include "teken_wcwidth.h"
53#include "teken_scs.h"
54
55/* Private flags for t_stateflags. */
56#define TS_FIRSTDIGIT 0x01 /* First numeric digit in escape sequence. */
57#define TS_INSERT 0x02 /* Insert mode. */
58#define TS_AUTOWRAP 0x04 /* Autowrap. */
59#define TS_ORIGIN 0x08 /* Origin mode. */
60#define TS_WRAPPED 0x10 /* Next character should be printed on col 0. */
61#define TS_8BIT 0x20 /* UTF-8 disabled. */
62#define TS_CONS25 0x40 /* cons25 emulation. */
63
64/* Character that blanks a cell. */
65#define BLANK ' '
66
67static teken_state_t teken_state_init;
68
69/*
70 * Wrappers for hooks.
71 */
72
73static inline void
74teken_funcs_bell(teken_t *t)
--- 338 unchanged lines hidden ---
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 197117 2009-09-12 12:44:21Z 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)
--- 8 unchanged lines hidden (view full) ---
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
51#include "teken.h"
52#include "teken_wcwidth.h"
53#include "teken_scs.h"
54
55/* Private flags for t_stateflags. */
56#define TS_FIRSTDIGIT 0x01 /* First numeric digit in escape sequence. */
57#define TS_INSERT 0x02 /* Insert mode. */
58#define TS_AUTOWRAP 0x04 /* Autowrap. */
59#define TS_ORIGIN 0x08 /* Origin mode. */
60#define TS_WRAPPED 0x10 /* Next character should be printed on col 0. */
61#define TS_8BIT 0x20 /* UTF-8 disabled. */
62#define TS_CONS25 0x40 /* cons25 emulation. */
63
64/* Character that blanks a cell. */
65#define BLANK ' '
66
67static teken_state_t teken_state_init;
68
69/*
70 * Wrappers for hooks.
71 */
72
73static inline void
74teken_funcs_bell(teken_t *t)
--- 338 unchanged lines hidden ---