Commit f2abaf86 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Update Teken from FreeBSD source tree

parent 83b41822
......@@ -25,7 +25,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: head/sys/teken/gensequences 223574 2011-06-26 18:25:10Z ed $
# $FreeBSD: head/sys/teken/gensequences 333925 2018-05-20 14:21:20Z dumbbell $
function die(msg) {
print msg;
......@@ -35,6 +35,15 @@ function die(msg) {
function cchar(str) {
if (str == "^[")
return "\\x1B";
if (str == "SP")
return " ";
return str;
}
function csequence(str) {
if (str == "SP")
return " ";
return str;
}
......@@ -57,11 +66,11 @@ while (getline > 0) {
prefix = "";
l_prefix_name[""] = "teken_state_init";
for (i = 1; i < nsequences; i++) {
n = prefix sequence[i];
n = prefix csequence(sequence[i]);
l_prefix_parent[n] = prefix;
l_prefix_suffix[n] = sequence[i];
if (!l_prefix_name[n])
l_prefix_name[n] = "teken_state_" "" ++npr;
l_prefix_name[n] = "teken_state_" ++npr;
prefix = n;
}
......
......@@ -23,93 +23,94 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: head/sys/teken/sequences 322662 2017-08-18 15:40:40Z bde $
# $FreeBSD: head/sys/teken/sequences 334316 2018-05-29 08:41:44Z dumbbell $
# File format is as follows:
# Abbr Abbreviation of sequence name
# Name Sequence name (will be converted to C function name)
# Sequence Bytes that form the sequence
# Arguments Standard value of arguments passed to this sequence
# Args Standard value of arguments passed to this sequence
# - `n' non-zero number (0 gets converted to 1)
# - `r' regular numeric argument
# - `v' means a variable number of arguments
# Abbr Name Sequence Arguments
CBT Cursor Backward Tabulation ^[ [ Z n
CHT Cursor Forward Tabulation ^[ [ I n
CNL Cursor Next Line ^[ [ E n
CPL Cursor Previous Line ^[ [ F n
CPR Cursor Position Report ^[ [ n r
CUB Cursor Backward ^[ [ D n
CUD Cursor Down ^[ [ B n
CUD Cursor Down ^[ [ e n
CUF Cursor Forward ^[ [ C n
CUF Cursor Forward ^[ [ a n
CUP Cursor Position ^[ [ H n n
CUP Cursor Position ^[ [ f n n
CUU Cursor Up ^[ [ A n
DA1 Primary Device Attributes ^[ [ c r
DA2 Secondary Device Attributes ^[ [ > c r
DC Delete character ^[ [ P n
DCS Device Control String ^[ P
DECALN Alignment test ^[ # 8
DECDHL Double Height Double Width Line Top ^[ # 3
DECDHL Double Height Double Width Line Bottom ^[ # 4
DECDWL Single Height Double Width Line ^[ # 6
DECKPAM Keypad application mode ^[ =
DECKPNM Keypad numeric mode ^[ >
DECRC Restore cursor ^[ 8
DECRC Restore cursor ^[ [ u
DECRM Reset DEC mode ^[ [ ? l r
DECSC Save cursor ^[ 7
DECSC Save cursor ^[ [ s
DECSM Set DEC mode ^[ [ ? h r
DECSTBM Set top and bottom margins ^[ [ r r r
DECSWL Single Height Single Width Line ^[ # 5
DL Delete line ^[ [ M n
DSR Device Status Report ^[ [ ? n r
ECH Erase character ^[ [ X n
ED Erase display ^[ [ J r
EL Erase line ^[ [ K r
G0SCS0 G0 SCS Special Graphics ^[ ( 0
G0SCS1 G0 SCS US ASCII ^[ ( 1
G0SCS2 G0 SCS Special Graphics ^[ ( 2
G0SCSA G0 SCS UK National ^[ ( A
G0SCSB G0 SCS US ASCII ^[ ( B
G1SCS0 G1 SCS Special Graphics ^[ ) 0
G1SCS1 G1 SCS US ASCII ^[ ) 1
G1SCS2 G1 SCS Special Graphics ^[ ) 2
G1SCSA G1 SCS UK National ^[ ) A
G1SCSB G1 SCS US ASCII ^[ ) B
HPA Horizontal Position Absolute ^[ [ G n
HPA Horizontal Position Absolute ^[ [ ` n
HTS Horizontal Tab Set ^[ H
ICH Insert character ^[ [ @ n
IL Insert line ^[ [ L n
IND Index ^[ D
NEL Next line ^[ E
OSC Operating System Command ^[ ]
RI Reverse index ^[ M
RIS Reset to Initial State ^[ c
RM Reset Mode ^[ [ l r
SD Pan Up ^[ [ T n
SGR Set Graphic Rendition ^[ [ m v
SM Set Mode ^[ [ h r
ST String Terminator ^[ \\
SU Pan Down ^[ [ S n
TBC Tab Clear ^[ [ g r
VPA Vertical Position Absolute ^[ [ d n
# Abbr Name Sequence Args
CBT Cursor Backward Tabulation ^[ [ Z n
CHT Cursor Forward Tabulation ^[ [ I n
CNL Cursor Next Line ^[ [ E n
CPL Cursor Previous Line ^[ [ F n
CPR Cursor Position Report ^[ [ n r
CUB Cursor Backward ^[ [ D n
CUD Cursor Down ^[ [ B n
CUD Cursor Down ^[ [ e n
CUF Cursor Forward ^[ [ C n
CUF Cursor Forward ^[ [ a n
CUP Cursor Position ^[ [ H n n
CUP Cursor Position ^[ [ f n n
CUU Cursor Up ^[ [ A n
DA1 Primary Device Attributes ^[ [ c r
DA2 Secondary Device Attributes ^[ [ > c r
DC Delete character ^[ [ P n
DCS Device Control String ^[ P
DECALN Alignment test ^[ # 8
DECDHL Double Height Double Width Line Top ^[ # 3
DECDHL Double Height Double Width Line Bottom ^[ # 4
DECDWL Single Height Double Width Line ^[ # 6
DECKPAM Keypad application mode ^[ =
DECKPNM Keypad numeric mode ^[ >
DECRC Restore cursor ^[ 8
DECRC Restore cursor ^[ [ u
DECRM Reset DEC mode ^[ [ ? l r
DECSC Save cursor ^[ 7
DECSC Save cursor ^[ [ s
DECSCUSR Set Cursor Style ^[ [ SP q r
DECSM Set DEC mode ^[ [ ? h r
DECSTBM Set top and bottom margins ^[ [ r r r
DECSWL Single Height Single Width Line ^[ # 5
DL Delete line ^[ [ M n
DSR Device Status Report ^[ [ ? n r
ECH Erase character ^[ [ X n
ED Erase display ^[ [ J r
EL Erase line ^[ [ K r
G0SCS0 G0 SCS Special Graphics ^[ ( 0
G0SCS1 G0 SCS US ASCII ^[ ( 1
G0SCS2 G0 SCS Special Graphics ^[ ( 2
G0SCSA G0 SCS UK National ^[ ( A
G0SCSB G0 SCS US ASCII ^[ ( B
G1SCS0 G1 SCS Special Graphics ^[ ) 0
G1SCS1 G1 SCS US ASCII ^[ ) 1
G1SCS2 G1 SCS Special Graphics ^[ ) 2
G1SCSA G1 SCS UK National ^[ ) A
G1SCSB G1 SCS US ASCII ^[ ) B
HPA Horizontal Position Absolute ^[ [ G n
HPA Horizontal Position Absolute ^[ [ ` n
HTS Horizontal Tab Set ^[ H
ICH Insert character ^[ [ @ n
IL Insert line ^[ [ L n
IND Index ^[ D
NEL Next line ^[ E
OSC Operating System Command ^[ ]
RI Reverse index ^[ M
RIS Reset to Initial State ^[ c
RM Reset Mode ^[ [ l r
SD Pan Up ^[ [ T n
SGR Set Graphic Rendition ^[ [ m v
SM Set Mode ^[ [ h r
ST String Terminator ^[ \\
SU Pan Down ^[ [ S n
TBC Tab Clear ^[ [ g r
VPA Vertical Position Absolute ^[ [ d n
# Cons25 compatibility sequences
C25BLPD Cons25 set bell pitch duration ^[ [ = B r r
C25BORD Cons25 set border ^[ [ = A r
C25DBG Cons25 set default background ^[ [ = G r
C25DFG Cons25 set default foreground ^[ [ = F r
C25GCS Cons25 set global cursor shape ^[ [ = C v
C25LCT Cons25 set local cursor type ^[ [ = S r
C25MODE Cons25 set terminal mode ^[ [ = T r
C25SGR Cons25 set graphic rendition ^[ [ x r r
C25VTSW Cons25 switch virtual terminal ^[ [ z r
C25BLPD Cons25 set bell pitch duration ^[ [ = B r r
C25BORD Cons25 set border ^[ [ = A r
C25DBG Cons25 set default background ^[ [ = G r
C25DFG Cons25 set default foreground ^[ [ = F r
C25GCS Cons25 set global cursor shape ^[ [ = C v
C25LCT Cons25 set local cursor type ^[ [ = S r
C25MODE Cons25 set terminal mode ^[ [ = T r
C25SGR Cons25 set graphic rendition ^[ [ x r r
C25VTSW Cons25 switch virtual terminal ^[ [ z r
# VT52 compatibility
#DECID VT52 DECID ^[ Z
#DECID VT52 DECID ^[ Z
......@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/sys/teken/teken.c 326272 2017-11-27 15:23:17Z pfg $
* $FreeBSD: head/sys/teken/teken.c 333683 2018-05-16 18:12:49Z cem $
*/
#include "config.h"
......@@ -35,14 +35,13 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define teken_assert(x) assert(x)
#include "vdef.h"
#include "vas.h"
#define teken_assert(x) assert(x)
/* debug messages */
#define teken_printf(...)
#define teken_printf(x,...)
/* Private flags for t_stateflags. */
#define TS_FIRSTDIGIT 0x0001 /* First numeric digit in escape sequence. */
......@@ -128,20 +127,36 @@ teken_funcs_copy(const teken_t *t, const teken_rect_t *r, const teken_pos_t *p)
t->t_funcs->tf_copy(t->t_softc, r, p);
}
static inline void
teken_funcs_pre_input(const teken_t *t)
{
if (t->t_funcs->tf_pre_input != NULL)
t->t_funcs->tf_pre_input(t->t_softc);
}
static inline void
teken_funcs_post_input(const teken_t *t)
{
if (t->t_funcs->tf_post_input != NULL)
t->t_funcs->tf_post_input(t->t_softc);
}
static inline void
teken_funcs_param(const teken_t *t, int cmd, unsigned int value)
{
if (t->t_funcs->tf_param != NULL)
t->t_funcs->tf_param(t->t_softc, cmd, value);
teken_assert(t->t_funcs->tf_param != NULL);
t->t_funcs->tf_param(t->t_softc, cmd, value);
}
static inline void
teken_funcs_respond(const teken_t *t, const void *buf, size_t len)
{
if (t->t_funcs->tf_respond != NULL)
t->t_funcs->tf_respond(t->t_softc, buf, len);
teken_assert(t->t_funcs->tf_respond != NULL);
t->t_funcs->tf_respond(t->t_softc, buf, len);
}
#include "teken_subr.h"
......@@ -288,8 +303,10 @@ teken_input(teken_t *t, const void *buf, size_t len)
{
const char *c = buf;
teken_funcs_pre_input(t);
while (len-- > 0)
teken_input_byte(t, *c++);
teken_funcs_post_input(t);
}
const teken_pos_t *
......
......@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/sys/teken/teken.h 326272 2017-11-27 15:23:17Z pfg $
* $FreeBSD: head/sys/teken/teken.h 333669 2018-05-16 09:01:02Z dumbbell $
*/
#ifndef _TEKEN_H_
......@@ -93,6 +93,8 @@ typedef void tf_putchar_t(void *, const teken_pos_t *, teken_char_t,
typedef void tf_fill_t(void *, const teken_rect_t *, teken_char_t,
const teken_attr_t *);
typedef void tf_copy_t(void *, const teken_rect_t *, const teken_pos_t *);
typedef void tf_pre_input_t(void *);
typedef void tf_post_input_t(void *);
typedef void tf_param_t(void *, int, unsigned int);
#define TP_SHOWCURSOR 0
#define TP_KEYPADAPP 1
......@@ -114,6 +116,8 @@ typedef struct {
tf_putchar_t *tf_putchar;
tf_fill_t *tf_fill;
tf_copy_t *tf_copy;
tf_pre_input_t *tf_pre_input;
tf_post_input_t *tf_post_input;
tf_param_t *tf_param;
tf_respond_t *tf_respond;
} teken_funcs_t;
......
......@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/sys/teken/teken_scs.h 326272 2017-11-27 15:23:17Z pfg $
* $FreeBSD: head/sys/teken/teken_scs.h 332297 2018-04-08 19:23:50Z phk $
*/
static inline teken_char_t
......
......@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/sys/teken/teken_subr.h 326272 2017-11-27 15:23:17Z pfg $
* $FreeBSD: head/sys/teken/teken_subr.h 333995 2018-05-21 20:35:16Z dumbbell $
*/
static void teken_subr_cursor_up(teken_t *, unsigned int);
......@@ -371,6 +371,27 @@ teken_subr_cursor_up(teken_t *t, unsigned int nrows)
teken_funcs_cursor(t);
}
static void
teken_subr_set_cursor_style(teken_t *t, unsigned int style)
{
/* TODO */
(void)t;
(void)style;
/*
* CSI Ps SP q
* Set cursor style (DECSCUSR), VT520.
* Ps = 0 -> blinking block.
* Ps = 1 -> blinking block (default).
* Ps = 2 -> steady block.
* Ps = 3 -> blinking underline.
* Ps = 4 -> steady underline.
* Ps = 5 -> blinking bar (xterm).
* Ps = 6 -> steady bar (xterm).
*/
}
static void
teken_subr_delete_character(const teken_t *t, unsigned int ncols)
{
......
......@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/sys/teken/teken_subr_compat.h 326272 2017-11-27 15:23:17Z pfg $
* $FreeBSD: head/sys/teken/teken_subr_compat.h 332297 2018-04-08 19:23:50Z phk $
*/
static void
......
......@@ -7,7 +7,7 @@
*
* Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
*
* $FreeBSD: head/sys/teken/teken_wcwidth.h 186681 2009-01-01 13:26:53Z ed $
* $FreeBSD: head/sys/teken/teken_wcwidth.h 332297 2018-04-08 19:23:50Z phk $
*/
struct interval {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment