Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Implement POSIX Curses functions immedok(3) and syncok(3).



details:   https://anonhg.NetBSD.org/src/rev/5705457713d9
branches:  trunk
changeset: 350022:5705457713d9
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Jan 02 10:28:34 2017 +0000

description:
Implement POSIX Curses functions immedok(3) and syncok(3).

diffstat:

 distrib/sets/lists/comp/mi     |   8 +++++-
 lib/libcurses/Makefile         |  15 ++++++-----
 lib/libcurses/addbytes.c       |   6 +++-
 lib/libcurses/clrtobot.c       |   5 ++-
 lib/libcurses/clrtoeol.c       |   8 ++++--
 lib/libcurses/curses.h         |   4 ++-
 lib/libcurses/curses_private.h |   5 +++-
 lib/libcurses/curses_refresh.3 |  42 +++++++++++++++++++++------------
 lib/libcurses/curses_touch.3   |  14 +++++++++-
 lib/libcurses/delch.c          |   5 ++-
 lib/libcurses/immedok.c        |  52 ++++++++++++++++++++++++++++++++++++++++++
 lib/libcurses/ins_wch.c        |   6 ++--
 lib/libcurses/ins_wstr.c       |   5 ++-
 lib/libcurses/insdelln.c       |   5 ++-
 lib/libcurses/insstr.c         |   5 ++-
 lib/libcurses/line.c           |   7 ++++-
 lib/libcurses/syncok.c         |  52 ++++++++++++++++++++++++++++++++++++++++++
 lib/libcurses/touchwin.c       |  18 ++++++++++++-
 18 files changed, 212 insertions(+), 50 deletions(-)

diffs (truncated from 692 to 300 lines):

diff -r 9ea566011d80 -r 5705457713d9 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Mon Jan 02 09:53:04 2017 +0000
+++ b/distrib/sets/lists/comp/mi        Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.2088 2017/01/01 03:06:06 roy Exp $
+#      $NetBSD: mi,v 1.2089 2017/01/02 10:28:35 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp                           comp-sys-root
@@ -6807,6 +6807,7 @@
 ./usr/share/man/cat3/ilogbl.0                  comp-c-catman           .cat
 ./usr/share/man/cat3/imaxabs.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/imaxdiv.0                 comp-c-catman           .cat
+./usr/share/man/cat3/immedok.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/inch.0                    comp-c-catman           .cat
 ./usr/share/man/cat3/inchnstr.0                        comp-c-catman           .cat
 ./usr/share/man/cat3/inchstr.0                 comp-c-catman           .cat
@@ -9322,6 +9323,7 @@
 ./usr/share/man/cat3/swapon.0                  comp-c-catman           .cat
 ./usr/share/man/cat3/swprintf.0                        comp-c-catman           .cat
 ./usr/share/man/cat3/swscanf.0                 comp-c-catman           .cat
+./usr/share/man/cat3/synckok.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/sys_errlist.0             comp-c-catman           .cat
 ./usr/share/man/cat3/sys_nerr.0                        comp-c-catman           .cat
 ./usr/share/man/cat3/sys_siglist.0             comp-c-catman           .cat
@@ -14153,6 +14155,7 @@
 ./usr/share/man/html3/ilogbl.html              comp-c-htmlman          html
 ./usr/share/man/html3/imaxabs.html             comp-c-htmlman          html
 ./usr/share/man/html3/imaxdiv.html             comp-c-htmlman          html
+./usr/share/man/html3/immedok.html             comp-c-htmlman          html
 ./usr/share/man/html3/inch.html                        comp-c-htmlman          html
 ./usr/share/man/html3/inchnstr.html            comp-c-htmlman          html
 ./usr/share/man/html3/inchstr.html             comp-c-htmlman          html
@@ -16607,6 +16610,7 @@
 ./usr/share/man/html3/swapon.html              comp-c-htmlman          html
 ./usr/share/man/html3/swprintf.html            comp-c-htmlman          html
 ./usr/share/man/html3/swscanf.html             comp-c-htmlman          html
+./usr/share/man/html3/syncok.html              comp-c-htmlman          html
 ./usr/share/man/html3/sys_errlist.html         comp-c-htmlman          html
 ./usr/share/man/html3/sys_nerr.html            comp-c-htmlman          html
 ./usr/share/man/html3/sys_siglist.html         comp-c-htmlman          html
@@ -21416,6 +21420,7 @@
 ./usr/share/man/man3/ilogbl.3                  comp-c-man              .man
 ./usr/share/man/man3/imaxabs.3                 comp-c-man              .man
 ./usr/share/man/man3/imaxdiv.3                 comp-c-man              .man
+./usr/share/man/man3/immedok.3                 comp-c-man              .man
 ./usr/share/man/man3/inch.3                    comp-c-man              .man
 ./usr/share/man/man3/inchnstr.3                        comp-c-man              .man
 ./usr/share/man/man3/inchstr.3                 comp-c-man              .man
@@ -23927,6 +23932,7 @@
 ./usr/share/man/man3/swapon.3                  comp-c-man              .man
 ./usr/share/man/man3/swprintf.3                        comp-c-man              .man
 ./usr/share/man/man3/swscanf.3                 comp-c-man              .man
+./usr/share/man/man3/syncok.3                  comp-c-man              .man
 ./usr/share/man/man3/sys_errlist.3             comp-c-man              .man
 ./usr/share/man/man3/sys_nerr.3                        comp-c-man              .man
 ./usr/share/man/man3/sys_siglist.3             comp-c-man              .man
diff -r 9ea566011d80 -r 5705457713d9 lib/libcurses/Makefile
--- a/lib/libcurses/Makefile    Mon Jan 02 09:53:04 2017 +0000
+++ b/lib/libcurses/Makefile    Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.76 2017/01/01 03:06:06 roy Exp $
+#      $NetBSD: Makefile,v 1.77 2017/01/02 10:28:34 roy Exp $
 #      @(#)Makefile    8.2 (Berkeley) 1/2/94
 
 .include <bsd.own.mk>
@@ -19,12 +19,12 @@
        ctrace.c cur_hash.c curs_set.c \
        curses.c delch.c deleteln.c delwin.c echochar.c erase.c fileio.c \
        flushok.c fullname.c getch.c getstr.c getyx.c id_subwins.c idlok.c \
-       idcok.c inch.c inchstr.c initscr.c insch.c insdelln.c insertln.c \
-       instr.c keypad.c keyname.c leaveok.c line.c meta.c move.c \
+       idcok.c immedok.c inch.c inchstr.c initscr.c insch.c insdelln.c \
+       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 scanw.c screen.c scroll.c \
-       scrollok.c setterm.c standout.c timeout.c toucholap.c touchwin.c \
-       tstp.c tty.c unctrl.c underscore.c
+       scrollok.c setterm.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 \
        curses_attributes.3 curses_background.3 curses_border.3 \
@@ -94,7 +94,7 @@
         curses_tty.3 halfdelay.3 curses_input.3 has_key.3 \
         curses_tty.3 has_il.3 \
         curses_line.3 hline.3 curses_tty.3 idcok.3 \
-        curses_tty.3 idlok.3 curses_inch.3 inch.3 \
+        curses_tty.3 idlok.3 curses_refresh.3 immedok.3 curses_inch.3 inch.3 \
         curses_inch.3 inchnstr.3 curses_inch.3 inchstr.3 \
         curses_inch.3 innstr.3 curses_color.3 init_color.3 \
         curses_color.3 init_pair.3 curses_screen.3 initscr.3 \
@@ -148,7 +148,8 @@
         curses_screen.3 set_term.3 curses_screen.3 setterm.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_input.3 timeout.3 \
+        curses_window.3 subwin.3 curses_touch.3 syncok.3 \
+        curses_input.3 timeout.3 \
         curses_touch.3 touchline.3 curses_touch.3 touchoverlap.3 \
         curses_touch.3 touchwin.3 curses_tty.3 typeahead.3 \
         curses_print.3 unctrl.3 \
diff -r 9ea566011d80 -r 5705457713d9 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Mon Jan 02 09:53:04 2017 +0000
+++ b/lib/libcurses/addbytes.c  Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addbytes.c,v 1.44 2016/11/28 18:25:26 christos Exp $   */
+/*     $NetBSD: addbytes.c,v 1.45 2017/01/02 10:28:34 roy Exp $        */
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.44 2016/11/28 18:25:26 christos Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.45 2017/01/02 10:28:34 roy Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -328,6 +328,7 @@
                 *y, *x, *win->alines[*y]->firstchp,
                 *win->alines[*y]->lastchp);
 #endif
+       __sync(win);
        return (OK);
 }
 
@@ -608,6 +609,7 @@
 #ifdef DEBUG
        __CTRACE(__CTRACE_INPUT, "add_wch: %d : 0x%x\n", lp->ch, lp->attr);
 #endif /* DEBUG */
+       __sync(win);
        return OK;
 #endif
 }
diff -r 9ea566011d80 -r 5705457713d9 lib/libcurses/clrtobot.c
--- a/lib/libcurses/clrtobot.c  Mon Jan 02 09:53:04 2017 +0000
+++ b/lib/libcurses/clrtobot.c  Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clrtobot.c,v 1.22 2012/02/19 19:38:13 christos Exp $   */
+/*     $NetBSD: clrtobot.c,v 1.23 2017/01/02 10:28:34 roy Exp $        */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: clrtobot.c,v 1.22 2012/02/19 19:38:13 christos Exp $");
+__RCSID("$NetBSD: clrtobot.c,v 1.23 2017/01/02 10:28:34 roy Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -114,5 +114,6 @@
                                    (int) (maxx - win->alines[y]->line));
                startx = 0;
        }
+       __sync(win);
        return (OK);
 }
diff -r 9ea566011d80 -r 5705457713d9 lib/libcurses/clrtoeol.c
--- a/lib/libcurses/clrtoeol.c  Mon Jan 02 09:53:04 2017 +0000
+++ b/lib/libcurses/clrtoeol.c  Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clrtoeol.c,v 1.26 2012/02/19 19:38:13 christos Exp $   */
+/*     $NetBSD: clrtoeol.c,v 1.27 2017/01/02 10:28:34 roy Exp $        */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: clrtoeol.c,v 1.26 2012/02/19 19:38:13 christos Exp $");
+__RCSID("$NetBSD: clrtoeol.c,v 1.27 2017/01/02 10:28:34 roy Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -114,5 +114,7 @@
            *win->alines[y]->firstchp, *win->alines[y]->lastchp);
 #endif
        /* Update firstch and lastch for the line. */
-       return (__touchline(win, y, x, (int) win->maxx - 1));
+       __touchline(win, y, x, (int) win->maxx - 1);
+       __sync(win);
+       return OK;
 }
diff -r 9ea566011d80 -r 5705457713d9 lib/libcurses/curses.h
--- a/lib/libcurses/curses.h    Mon Jan 02 09:53:04 2017 +0000
+++ b/lib/libcurses/curses.h    Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses.h,v 1.112 2017/01/01 03:06:06 roy Exp $ */
+/*     $NetBSD: curses.h,v 1.113 2017/01/02 10:28:34 roy Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -681,6 +681,7 @@
 int     hline(chtype, int);
 int     idcok(WINDOW *, bool);
 int     idlok(WINDOW *, bool);
+int     immedok(WINDOW *, bool);
 int     init_color(short, short, short, short);
 int     init_pair(short, short, short);
 WINDOW *initscr(void);
@@ -746,6 +747,7 @@
 int     start_color(void);
 WINDOW *subpad(WINDOW *, int, int, int, int);
 WINDOW *subwin(WINDOW *, int, int, int, int);
+int     syncok(WINDOW *, bool);
 chtype  termattrs(void);
 attr_t  term_attrs(void);
 int     touchline(WINDOW *, int, int);
diff -r 9ea566011d80 -r 5705457713d9 lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h    Mon Jan 02 09:53:04 2017 +0000
+++ b/lib/libcurses/curses_private.h    Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses_private.h,v 1.53 2016/12/31 22:47:01 roy Exp $  */
+/*     $NetBSD: curses_private.h,v 1.54 2017/01/02 10:28:34 roy Exp $  */
 
 /*-
  * Copyright (c) 1998-2000 Brett Lymn
@@ -131,6 +131,8 @@
 #define __IDCHAR       0x00040000      /* insert/delete char sequences */
 #define __ISPAD                0x00080000      /* "window" is a pad */
 #define __ISDERWIN     0x00100000      /* "window" is derived from parent */
+#define __IMMEDOK      0x00200000      /* refreshed when changed */
+#define __SYNCOK       0x00400000      /* sync when changed */
        unsigned int flags;
        int     delay;                  /* delay for getch() */
        attr_t  wattr;                  /* Character attributes */
@@ -344,6 +346,7 @@
 void    __stop_signal_handler(int);
 int     __stopwin(void);
 void    __swflags(WINDOW *);
+void    __sync(WINDOW *);
 int     __timeout(int);
 int     __touchline(WINDOW *, int, int, int);
 int     __touchwin(WINDOW *);
diff -r 9ea566011d80 -r 5705457713d9 lib/libcurses/curses_refresh.3
--- a/lib/libcurses/curses_refresh.3    Mon Jan 02 09:53:04 2017 +0000
+++ b/lib/libcurses/curses_refresh.3    Mon Jan 02 10:28:34 2017 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: curses_refresh.3,v 1.11 2016/12/31 13:50:16 roy Exp $
+.\"    $NetBSD: curses_refresh.3,v 1.12 2017/01/02 10:28:34 roy Exp $
 .\"
 .\" Copyright (c) 2002
 .\"    Brett Lymn (blymn%NetBSD.org@localhost, brett_lymn%yahoo.com.au@localhost)
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd December 31, 2016
+.Dd January 2, 2017
 .Dt CURSES_REFRESH 3
 .Os
 .Sh NAME
@@ -39,9 +39,10 @@
 .Nm wrefresh ,
 .Nm wnoutrefresh ,
 .Nm doupdate ,
+.Nm immedok ,
+.Nm flushok ,
 .Nm leaveok ,
-.Nm is_leaveok ,
-.Nm flushok
+.Nm is_leaveok
 .Nd curses terminal update routines
 .Sh LIBRARY
 .Lb libcurses
@@ -56,11 +57,13 @@
 .Ft int
 .Fn doupdate "void"
 .Ft int
+.Fn immedok "WINDOW *win" "boolf flag"
+.Ft int
+.Fn flushok "WINDOW *win" "boolf flag"
+.Ft int
 .Fn leaveok "WINDOW *win" "boolf flag"
 .Ft bool
 .Fn is_leaveok "const WINDOW *win"
-.Ft int
-.Fn flushok "WINDOW *win" "boolf flag"
 .Sh DESCRIPTION
 These functions update the terminal with the contents of
 .Dv stdscr
@@ -110,6 +113,23 @@
 .Fn doupdate .
 .Pp
 The
+.Fn immedok
+function determines whether the screen is refreshed whenever the window is
+changed.
+The initial state is
+.Dv FALSE .
+.Pp
+The
+.Fn flushok
+function is used to determine whether or not the screen's output file
+descriptor will be flushed on refresh.



Home | Main Index | Thread Index | Old Index