Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Implement POSIX Curses Soft Label Key functions.
details: https://anonhg.NetBSD.org/src/rev/1e4567d6eed0
branches: trunk
changeset: 350843:1e4567d6eed0
user: roy <roy%NetBSD.org@localhost>
date: Tue Jan 24 17:27:30 2017 +0000
description:
Implement POSIX Curses Soft Label Key functions.
diffstat:
distrib/sets/lists/comp/mi | 53 ++-
lib/libcurses/Makefile | 16 +-
lib/libcurses/curses.h | 20 +-
lib/libcurses/curses_private.h | 35 +-
lib/libcurses/curses_slk.3 | 244 ++++++++++++
lib/libcurses/resize.c | 19 +-
lib/libcurses/ripoffline.c | 26 +-
lib/libcurses/screen.c | 13 +-
lib/libcurses/slk.c | 808 +++++++++++++++++++++++++++++++++++++++++
9 files changed, 1218 insertions(+), 16 deletions(-)
diffs (truncated from 1456 to 300 lines):
diff -r 35ab0dff88a6 -r 1e4567d6eed0 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Tue Jan 24 16:45:41 2017 +0000
+++ b/distrib/sets/lists/comp/mi Tue Jan 24 17:27:30 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.2102 2017/01/11 12:02:24 joerg Exp $
+# $NetBSD: mi,v 1.2103 2017/01/24 17:27:30 roy Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
./etc/mtree/set.comp comp-sys-root
@@ -5739,6 +5739,7 @@
./usr/share/man/cat3/curses_scanw.0 comp-c-catman .cat
./usr/share/man/cat3/curses_screen.0 comp-c-catman .cat
./usr/share/man/cat3/curses_scroll.0 comp-c-catman .cat
+./usr/share/man/cat3/curses_slk.0 comp-c-catman .cat
./usr/share/man/cat3/curses_standout.0 comp-c-catman .cat
./usr/share/man/cat3/curses_termcap.0 comp-c-catman .cat
./usr/share/man/cat3/curses_touch.0 comp-c-catman .cat
@@ -9008,6 +9009,22 @@
./usr/share/man/cat3/sl_find.0 comp-c-catman .cat
./usr/share/man/cat3/sl_free.0 comp-c-catman .cat
./usr/share/man/cat3/sl_init.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_attroff.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_attr_off.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_attron.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_attr_on.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_attrset.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_attr_set.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_clear.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_color.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_init.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_label.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_noutrefresh.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_refresh.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_restore.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_set.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_touch.0 comp-c-catman .cat
+./usr/share/man/cat3/slk_wset.0 comp-c-catman .cat
./usr/share/man/cat3/sleep.0 comp-c-catman .cat
./usr/share/man/cat3/snprintb.0 comp-c-catman .cat
./usr/share/man/cat3/snprintb_m.0 comp-c-catman .cat
@@ -13134,6 +13151,7 @@
./usr/share/man/html3/curses_scanw.html comp-c-htmlman html
./usr/share/man/html3/curses_screen.html comp-c-htmlman html
./usr/share/man/html3/curses_scroll.html comp-c-htmlman html
+./usr/share/man/html3/curses_slk.html comp-c-htmlman html
./usr/share/man/html3/curses_standout.html comp-c-htmlman html
./usr/share/man/html3/curses_termcap.html comp-c-htmlman html
./usr/share/man/html3/curses_touch.html comp-c-htmlman html
@@ -16339,6 +16357,22 @@
./usr/share/man/html3/sl_find.html comp-c-htmlman html
./usr/share/man/html3/sl_free.html comp-c-htmlman html
./usr/share/man/html3/sl_init.html comp-c-htmlman html
+./usr/share/man/html3/slk_attroff.html comp-c-htmlman html
+./usr/share/man/html3/slk_attr_off.html comp-c-htmlman html
+./usr/share/man/html3/slk_attron.html comp-c-htmlman html
+./usr/share/man/html3/slk_attr_on.html comp-c-htmlman html
+./usr/share/man/html3/slk_attrset.html comp-c-htmlman html
+./usr/share/man/html3/slk_attr_set.html comp-c-htmlman html
+./usr/share/man/html3/slk_clear.html comp-c-htmlman html
+./usr/share/man/html3/slk_color.html comp-c-htmlman html
+./usr/share/man/html3/slk_init.html comp-c-htmlman html
+./usr/share/man/html3/slk_label.html comp-c-htmlman html
+./usr/share/man/html3/slk_noutrefresh.html comp-c-htmlman html
+./usr/share/man/html3/slk_refresh.html comp-c-htmlman html
+./usr/share/man/html3/slk_restore.html comp-c-htmlman html
+./usr/share/man/html3/slk_set.html comp-c-htmlman html
+./usr/share/man/html3/slk_touch.html comp-c-htmlman html
+./usr/share/man/html3/slk_wset.html comp-c-htmlman html
./usr/share/man/html3/sleep.html comp-c-htmlman html
./usr/share/man/html3/snprintb.html comp-c-htmlman html
./usr/share/man/html3/snprintb_m.html comp-c-htmlman html
@@ -20436,6 +20470,7 @@
./usr/share/man/man3/curses_scanw.3 comp-c-man .man
./usr/share/man/man3/curses_screen.3 comp-c-man .man
./usr/share/man/man3/curses_scroll.3 comp-c-man .man
+./usr/share/man/man3/curses_slk.3 comp-c-man .man
./usr/share/man/man3/curses_standout.3 comp-c-man .man
./usr/share/man/man3/curses_termcap.3 comp-c-man .man
./usr/share/man/man3/curses_touch.3 comp-c-man .man
@@ -23701,6 +23736,22 @@
./usr/share/man/man3/sl_find.3 comp-c-man .man
./usr/share/man/man3/sl_free.3 comp-c-man .man
./usr/share/man/man3/sl_init.3 comp-c-man .man
+./usr/share/man/man3/slk_attroff.3 comp-c-man .man
+./usr/share/man/man3/slk_attr_off.3 comp-c-man .man
+./usr/share/man/man3/slk_attron.3 comp-c-man .man
+./usr/share/man/man3/slk_attr_on.3 comp-c-man .man
+./usr/share/man/man3/slk_attrset.3 comp-c-man .man
+./usr/share/man/man3/slk_attr_set.3 comp-c-man .man
+./usr/share/man/man3/slk_clear.3 comp-c-man .man
+./usr/share/man/man3/slk_color.3 comp-c-man .man
+./usr/share/man/man3/slk_init.3 comp-c-man .man
+./usr/share/man/man3/slk_label.3 comp-c-man .man
+./usr/share/man/man3/slk_noutrefresh.3 comp-c-man .man
+./usr/share/man/man3/slk_refresh.3 comp-c-man .man
+./usr/share/man/man3/slk_restore.3 comp-c-man .man
+./usr/share/man/man3/slk_set.3 comp-c-man .man
+./usr/share/man/man3/slk_touch.3 comp-c-man .man
+./usr/share/man/man3/slk_wset.3 comp-c-man .man
./usr/share/man/man3/sleep.3 comp-c-man .man
./usr/share/man/man3/snprintb.3 comp-c-man .man
./usr/share/man/man3/snprintb_m.3 comp-c-man .man
diff -r 35ab0dff88a6 -r 1e4567d6eed0 lib/libcurses/Makefile
--- a/lib/libcurses/Makefile Tue Jan 24 16:45:41 2017 +0000
+++ b/lib/libcurses/Makefile Tue Jan 24 17:27:30 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.83 2017/01/11 20:43:03 roy Exp $
+# $NetBSD: Makefile,v 1.84 2017/01/24 17:27:30 roy Exp $
# @(#)Makefile 8.2 (Berkeley) 1/2/94
.include <bsd.own.mk>
@@ -23,7 +23,7 @@
insertln.c instr.c keypad.c keyname.c leaveok.c line.c meta.c move.c \
mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c \
printw.c putchar.c refresh.c resize.c ripoffline.c scanw.c screen.c \
- scroll.c scrollok.c setterm.c standout.c syncok.c timeout.c \
+ scroll.c scrollok.c setterm.c slk.c standout.c syncok.c timeout.c \
toucholap.c touchwin.c tstp.c tty.c unctrl.c underscore.c
MAN= curses.3 curses_addch.3 curses_addchstr.3 curses_addstr.3 \
@@ -34,8 +34,8 @@
curses_inch.3 curses_input.3 curses_insertch.3 curses_insertln.3 \
curses_insdelln.3 curses_keyname.3 curses_line.3 curses_pad.3 \
curses_print.3 curses_refresh.3 curses_scanw.3 curses_screen.3 \
- curses_scroll.3 curses_standout.3 curses_termcap.3 curses_touch.3 \
- curses_tty.3 curses_underscore.3 curses_window.3
+ curses_scroll.3 curses_slk.3 curses_standout.3 curses_termcap.3 \
+ curses_touch.3 curses_tty.3 curses_underscore.3 curses_window.3
INCS= curses.h unctrl.h
INCSDIR=/usr/include
@@ -150,6 +150,14 @@
curses_cursor.3 setsyx.3 \
curses_input.3 set_escdelay.3 curses_screen.3 set_tabsize.3 \
curses_screen.3 set_term.3 curses_screen.3 setterm.3 \
+ curses_slk.3 slk_attroff.3 curses_slk.3 slk_attr_off.3 \
+ curses_slk.3 slk_attron.3 curses_slk.3 slk_attr_on.3 \
+ curses_slk.3 slk_attrset.3 curses_slk.3 slk_attr_set.3 \
+ curses_slk.3 slk_clear.3 curses_slk.3 slk_color.3 \
+ curses_slk.3 slk_init.3 curses_slk.3 slk_label.3 \
+ curses_slk.3 slk_noutrefresh.3 curses_slk.3 slk_refresh.3 \
+ curses_slk.3 slk_restore.3 curses_slk.3 slk_set.3 \
+ curses_slk.3 slk_touch.3 curses_slk.3 slk_wset.3 \
curses_standout.3 standend.3 curses_standout.3 standout.3 \
curses_color.3 start_color.3 curses_pad.3 subpad.3 \
curses_window.3 subwin.3 curses_touch.3 syncok.3 \
diff -r 35ab0dff88a6 -r 1e4567d6eed0 lib/libcurses/curses.h
--- a/lib/libcurses/curses.h Tue Jan 24 16:45:41 2017 +0000
+++ b/lib/libcurses/curses.h Tue Jan 24 17:27:30 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses.h,v 1.120 2017/01/10 10:13:24 roy Exp $ */
+/* $NetBSD: curses.h,v 1.121 2017/01/24 17:27:30 roy Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -843,6 +843,24 @@
int mvchgat(int, int, int, attr_t, short, const void *);
int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);
+/* Soft Label Keys. */
+int slk_attroff(const chtype);
+int slk_attr_off(const attr_t, void *);
+int slk_attron(const chtype);
+int slk_attr_on(const attr_t, void *);
+int slk_attrset(const chtype);
+int slk_attr_set(const attr_t, short, void *);
+int slk_clear(void);
+int slk_color(short);
+int slk_init(int);
+char *slk_label(int);
+int slk_noutrefresh(void);
+int slk_refresh(void);
+int slk_restore(void);
+int slk_set(int, const char *, int);
+int slk_touch(void);
+int slk_wset(int, const wchar_t *, int);
+
/* wide-character support routines */
/* return ERR when HAVE_WCHAR is not defined */
/* add */
diff -r 35ab0dff88a6 -r 1e4567d6eed0 lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h Tue Jan 24 16:45:41 2017 +0000
+++ b/lib/libcurses/curses_private.h Tue Jan 24 17:27:30 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses_private.h,v 1.59 2017/01/11 20:43:03 roy Exp $ */
+/* $NetBSD: curses_private.h,v 1.60 2017/01/24 17:27:30 roy Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@@ -189,6 +189,22 @@
typedef struct keymap keymap_t;
+/* POSIX allows up to 8 columns in a label. */
+#define MAX_SLK_COLS 8
+#ifdef HAVE_WCHAR
+#define MAX_SLK_LABEL sizeof(wchar_t) * MAX_SLK_COLS
+#else
+#define MAX_SLK_LABEL MAX_SLK_COLS
+#endif
+struct __slk_label {
+ char *text;
+ int justify;
+#define SLK_JUSTIFY_LEFT 0
+#define SLK_JUSTIFY_CENTER 1
+#define SLK_JUSTIFY_RIGHT 2
+ char label[MAX_SLK_LABEL + 1];
+ int x;
+};
#define MAX_RIPS 5
struct __ripoff {
@@ -268,6 +284,18 @@
int unget_len, unget_pos;
int filtered;
int checkfd;
+
+ /* soft label key */
+ bool is_term_slk;
+ WINDOW *slk_window;
+ int slk_format;
+#define SLK_FMT_3_2_3 0
+#define SLK_FMT_4_4 1
+ int slk_nlabels;
+ int slk_label_len;
+ bool slk_hidden;
+ struct __slk_label *slk_labels;
+
#ifdef HAVE_WCHAR
#define MB_LEN_MAX 8
#define MAX_CBUF_SIZE MB_LEN_MAX
@@ -357,6 +385,10 @@
void __set_stophandler(void);
void __set_winchhandler(void);
void __set_subwin(WINDOW *, WINDOW *);
+int __slk_init(SCREEN *);
+void __slk_free(SCREEN *);
+int __slk_resize(SCREEN *, int cols);
+int __slk_noutrefresh(SCREEN *);
void __startwin(SCREEN *);
void __stop_signal_handler(int);
int __stopwin(void);
@@ -365,6 +397,7 @@
int __timeout(int);
int __touchline(WINDOW *, int, int, int);
int __touchwin(WINDOW *);
+int __unripoffline(int (*)(WINDOW *, int));
void __unsetattr(int);
void __unset_color(WINDOW *win);
int __waddch(WINDOW *, __LDATA *);
diff -r 35ab0dff88a6 -r 1e4567d6eed0 lib/libcurses/curses_slk.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libcurses/curses_slk.3 Tue Jan 24 17:27:30 2017 +0000
@@ -0,0 +1,244 @@
+.\" $NetBSD: curses_slk.3,v 1.1 2017/01/24 17:27:30 roy Exp $
+.\"
+.\" Copyright (c) 2017 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Roy Marples.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\"
+.Dd January 12, 2017
+.Dt CURSES_SLK 3
+.Os
+.Sh NAME
+.Nm slk_attroff ,
+.Nm slk_attr_off ,
+.Nm slk_attron ,
+.Nm slk_attr_on ,
+.Nm slk_attrset ,
+.Nm slk_attr_set ,
+.Nm slk_clear ,
+.Nm slk_color ,
+.Nm slk_init ,
+.Nm slk_label ,
+.Nm slk_noutrefresh ,
+.Nm slk_refresh ,
Home |
Main Index |
Thread Index |
Old Index