Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Upgrades the standard NetBSD curses library to...



details:   https://anonhg.NetBSD.org/src/rev/5fdfbb619000
branches:  trunk
changeset: 471851:5fdfbb619000
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Apr 13 14:08:17 1999 +0000

description:
Upgrades the standard NetBSD curses library to provide some
of the SYSV curses facilities.  The added features are the collapsing
of arrow and function keysequences (as defined by termcap for the
terminal) into symbolic code returns thus relieving the application of
recognising multi-character key sequences.  Other features are the
capability to perform a timed wait for a key (good for when you are
not sure if there is a keypress ready or not) and the capability for
turning off the inter-key timeout when assembling multi-character
function keys.

this work was done by Julian Coleman <J.D.Coleman%newcastle.ac.uk@localhost>
and blymn%baea.com.au@localhost (Brett Lymn).  i'm just integrating it.  thanks
HEAPS guys!

diffstat:

 lib/libcurses/Makefile        |   22 +-
 lib/libcurses/PSD.doc/fns.doc |  167 +++++++++++++-
 lib/libcurses/addbytes.c      |  115 ++++++--
 lib/libcurses/addch.c         |   12 +-
 lib/libcurses/addnstr.c       |   12 +-
 lib/libcurses/attributes.c    |  292 ++++++++++++++++++++++++
 lib/libcurses/bell.c          |   70 +++++
 lib/libcurses/box.c           |   12 +-
 lib/libcurses/clear.c         |    6 +-
 lib/libcurses/clrtobot.c      |   10 +-
 lib/libcurses/clrtoeol.c      |   17 +-
 lib/libcurses/cr_put.c        |   89 +++---
 lib/libcurses/ctrace.c        |   18 +-
 lib/libcurses/cur_hash.c      |   26 +-
 lib/libcurses/curses.3        |   33 ++-
 lib/libcurses/curses.c        |   23 +-
 lib/libcurses/curses.h        |  231 ++++++++++++++++--
 lib/libcurses/delch.c         |   10 +-
 lib/libcurses/deleteln.c      |   18 +-
 lib/libcurses/delwin.c        |    6 +-
 lib/libcurses/erase.c         |   12 +-
 lib/libcurses/fullname.c      |   16 +-
 lib/libcurses/getch.c         |  465 +++++++++++++++++++++++++++++++++++++-
 lib/libcurses/getstr.c        |    8 +-
 lib/libcurses/id_subwins.c    |   12 +-
 lib/libcurses/idlok.c         |    8 +-
 lib/libcurses/initscr.c       |    6 +-
 lib/libcurses/insch.c         |   16 +-
 lib/libcurses/insertln.c      |   18 +-
 lib/libcurses/keypad.c        |   54 ++++
 lib/libcurses/longname.c      |   12 +-
 lib/libcurses/move.c          |    8 +-
 lib/libcurses/mvwin.c         |   10 +-
 lib/libcurses/newwin.c        |   57 ++--
 lib/libcurses/nodelay.c       |   54 ++++
 lib/libcurses/notimeout.c     |   54 ++++
 lib/libcurses/overlay.c       |   12 +-
 lib/libcurses/overwrite.c     |   14 +-
 lib/libcurses/printw.c        |   56 ++--
 lib/libcurses/putchar.c       |   10 +-
 lib/libcurses/refresh.c       |  506 ++++++++++++++++++++++++++++-------------
 lib/libcurses/scanw.c         |   47 +--
 lib/libcurses/scroll.c        |    8 +-
 lib/libcurses/setterm.c       |   58 ++--
 lib/libcurses/shlib_version   |    4 +-
 lib/libcurses/standout.c      |    7 +-
 lib/libcurses/timeout.c       |   46 +++
 lib/libcurses/toucholap.c     |    9 +-
 lib/libcurses/touchwin.c      |   22 +-
 lib/libcurses/tscroll.c       |   34 +-
 lib/libcurses/tstp.c          |   72 +++--
 lib/libcurses/tty.c           |  173 ++++++++++++-
 lib/libcurses/unctrl.c        |   76 +++---
 lib/libcurses/underscore.c    |   65 +++++
 54 files changed, 2511 insertions(+), 707 deletions(-)

diffs (truncated from 5660 to 300 lines):

diff -r d17e71f5a5d5 -r 5fdfbb619000 lib/libcurses/Makefile
--- a/lib/libcurses/Makefile    Tue Apr 13 07:40:53 1999 +0000
+++ b/lib/libcurses/Makefile    Tue Apr 13 14:08:17 1999 +0000
@@ -1,25 +1,27 @@
-#      $NetBSD: Makefile,v 1.19 1998/02/18 22:08:12 jtc Exp $
+#      $NetBSD: Makefile,v 1.20 1999/04/13 14:08:17 mrg Exp $
 #      @(#)Makefile    8.2 (Berkeley) 1/2/94
 
 CPPFLAGS+=#-DTFILE=\"/dev/ttyp0\"
-CPPFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR}
+CPPFLAGS+=-D_CURSES_PRIVATE -I${.CURDIR} 
 LIB=   curses
-SRCS=  addbytes.c addch.c addnstr.c box.c clear.c clrtobot.c clrtoeol.c \
-       cr_put.c ctrace.c cur_hash.c curses.c delch.c deleteln.c delwin.c \
-       erase.c fullname.c getch.c getstr.c id_subwins.c idlok.c initscr.c \
-       insch.c insertln.c longname.c move.c mvwin.c newwin.c overlay.c \
-       overwrite.c printw.c putchar.c refresh.c scanw.c scroll.c setterm.c \
-       standout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c unctrl.c
+SRCS=  addbytes.c addch.c addnstr.c attributes.c bell.c box.c clear.c \
+       clrtobot.c clrtoeol.c cr_put.c ctrace.c cur_hash.c curses.c delch.c \
+       deleteln.c delwin.c erase.c fullname.c getch.c getstr.c id_subwins.c \
+       idlok.c initscr.c insch.c insertln.c keypad.c longname.c move.c \
+       mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c \
+       printw.c putchar.c refresh.c scanw.c scroll.c setterm.c standout.c \
+       timeout.c toucholap.c touchwin.c tscroll.c tstp.c tty.c unctrl.c \
+       underscore.c
 MAN=   curses.3
 INCS=  curses.h unctrl.h
 INCSDIR=/usr/include
 
 CPPFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D
-SRCS+= termcap.c tgoto.c tputs.c
+SRCS+=  termcap.c tgoto.c tputs.c
 .PATH: ${.CURDIR}/../libterm
 
 .if make(install)
-SUBDIR+=PSD.doc
+SUBDIR+= PSD.doc
 .endif
 
 .include <bsd.lib.mk>
diff -r d17e71f5a5d5 -r 5fdfbb619000 lib/libcurses/PSD.doc/fns.doc
--- a/lib/libcurses/PSD.doc/fns.doc     Tue Apr 13 07:40:53 1999 +0000
+++ b/lib/libcurses/PSD.doc/fns.doc     Tue Apr 13 14:08:17 1999 +0000
@@ -1,5 +1,3 @@
-.\"    $NetBSD: fns.doc,v 1.4 1998/01/09 04:12:10 perry Exp $
-.\"
 .\" Copyright (c) 1992, 1993
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
@@ -66,6 +64,43 @@
 \*(Es
 In this case, it will put on as much as it can.
 .Ds
+.Fn addnstr "char *str" "int len" \(dg
+.De
+Add no more than
+.Vn len
+characters of the string pointed to by                                                 
+.Vn str
+on the window at the current \*y.
+\*(Es
+In this case, it will put on as much as it can.
+.Ds
+.Fn attroff "int attribute" \(dg
+.De
+Remove character attributes set by
+.Fn attron or
+.Fn attrset .
+To clear all character attributes, use
+.Fn attroff "A_ATTRIBUTES" .
+.Fn attroff "A_UNDERLINE"
+is equivalent to 
+.Fn underend .
+.Ds
+.Fn attron "int attribute" \(dg
+.De
+Add character attributes for any characters
+added to the window (if it has that capability).
+The attributes that can be set are \fBA_UNDERLINE\fR,
+\fBA_REVERSE\fR, \fBA_BLINK\fR, \fBA_DIM\fR,
+\fBA_BOLD\fR, \fBA_BLANK\fR and \fBA_PROTECT\fB.
+.Fn attron "A_UNDERLINE"
+is equivalent to 
+.Fn underscore .
+.Ds
+.Fn attrset "int attribute" \(dg
+.De
+Set character attributes for any characters
+added to the window (if it has that capability).
+.Ds
 .Fn baudrate "" \(dg
 .De
 Returns the output baud rate of the terminal.
@@ -76,6 +111,12 @@
 which is included by
 .b <curses.h> ).
 .Ds
+.Fn beep ""
+.De
+Sound the terminal bell.  If the terminal has no bell capability,
+but has the ability to flash the screen, do that instead.  See also
+.Fn flash
+.Ds
 .Fn box "WINDOW win" "char vert" "char hor"
 .De
 .Pp
@@ -90,7 +131,7 @@
 .Ds
 .Fn cbreak "" \(dg
 .De
-Set or the terminal to cbreak mode.
+Set the terminal to cbreak mode.
 .Ds
 .Fn clear "" \(dg
 .De
@@ -223,6 +264,17 @@
 .i i.e. ,
 the character used by the user to erase a single character from the input.
 .Ds
+.Fn flash ""
+.De
+Flash the terminal screen.  If the terminal has no flash capability,
+but has the ability to sound the bell, do that instead.  See also
+.Fn bell
+.Ds
+.Fn flushinp ""
+.De
+Throw away any input that has been typed by the user but has not yet
+been read by the program.
+.Ds
 .Fn flushok "WINDOW *win" "int boolf"
 .De
 Normally,
@@ -359,6 +411,25 @@
 The current line will become blank,
 and the current \*y will remain unchanged.
 .Ds
+.Fn isendwin ""
+.De
+Returns TRUE if
+.Fn endwin
+has been called without a subsequent call to
+.Fn wrefresh ,
+and FALSE otherwise.
+.Ds
+.Fn keypad "WINDOW *win" "int boolf"
+.De
+Sets the boolean flag for interpretation of escape sequences.  If
+.Vn boolf
+is non-zero, escape sequences from terminal keypad and function
+keys will be interpreted by the library.  Escape sequnces are not
+interpreted by default.  The include file
+.b <curses.h>
+contains the list of recognised keypad and function keys.  See also
+.Fn notimeout .
+.Ds
 .Fn killchar "" \(dg
 .De
 Returns the line kill character
@@ -509,6 +580,20 @@
 is retained for backwards compatibility
 with ealier versions of the library.
 .Ds
+.Fn nodelay "WINDOW *win1" "int boolf"
+.De
+Sets the boolean flag for non-blocking
+.Fn getch .
+If
+.Vn boolf
+is non-zero,
+.Fn getch
+will return ERR is no input is waiting.  The default
+is to for
+.Fn getch
+to block indefinitely.  See also
+.Fn timeout .
+.Ds
 .Fn noecho "" \(dg
 .De
 Turn echoing of characters off.
@@ -524,6 +609,25 @@
 Unset the terminal from raw mode.  See 
 .Fn raw .
 .Ds
+.Fn notimeout "WINDOW *win1" "int boolf"
+.De
+Sets the boolean flag for inter-key timeouts
+for escape sequences interpreted when
+.Fn keypad
+is set.
+By default,
+.Fn keypad
+sets a timer while waiting for the next character of
+an escape sequence.
+If
+.Vn boolf
+is non-zero,
+.Fn getch
+will wait indefinitely between escape sequence characters,
+or until a delay set by
+.Fn timeout
+expires.
+.Ds
 .Fn overlay "WINDOW *win1" "WINDOW *win2"
 .De
 Overlay
@@ -658,12 +762,21 @@
 .De
 End standout mode initiated by
 .Fn standout .
+This function is provided for compatibility
+with older curses implementations.
 .Ds
 .Fn standout "" \(dg
 .De
 Causes any characters added to the window
 to be put in standout mode on the terminal
-(if it has that capability).
+(if it has that capability).  This function
+is provided for compatibility with older curses
+implementations.  A larger range of character
+attributes supported by modern terminals can be
+accessed using
+.Fn attron
+and
+.Fn attrset .
 .Ds
 .Ft "WINDOW *"
 .Fn subwin "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x"
@@ -694,6 +807,30 @@
 .Vn "COLS \- begin\*_x" ) (
 respectively.
 .Ds
+.Fn timeout "int delay" \(dg
+.De
+Sets blocking or non-blocking
+.Fn getch .
+If
+.Vn delay
+is positive,
+.Fn getch
+will block for
+.Vn delay
+milliseconds before returning.  If
+.Vn delay
+is zero,
+.Fn getch
+will return ERR is no input is waiting.  If
+.Vn delay
+is negative,
+.Fn getch
+will block indefinitely.  See also
+.Fn keypad ,
+.Fn nodelay
+and
+.Fn notimeout .
+.Ds
 .Fn touchline "WINDOW *win" "int y" "int startx" "int endx"
 .De
 This function performs a function similar to
@@ -751,6 +888,21 @@
 .Vn ch .
 .ne 1i
 .Ds
+.Fn underend "" \(dg
+.De
+End underscore mode initiated by
+.Fn underscore .
+This is equivalent to
+.Fn attroff "A_UNDERLINE" .
+.Ds
+.Fn underscore "" \(dg
+.De
+Causes any characters added to the window
+to be put in underscore mode on the terminal
+(if it has that capability).
+This is equivalent to
+.Fn attron "A_UNDERLINE" .
+.Ds
 .Fn vwprintw "WINDOW *win" "const char *fmt" "va_list ap"
 .De
 Identical to 
@@ -781,6 +933,10 @@
 .Ds
 .Fn waddch "WINDOW *win" "char ch" 
 .Fn waddstr "WINDOW *win" "char *str" 
+.Fn waddnstr "WINDOW *win" "char *str" "int len"
+.Fn wattron  "WINDOW *win" "int attr"
+.Fn wattroff  "WINDOW *win" "int attr"
+.Fn wattrset  "WINDOW *win" "int attr"
 .Fn wclear "WINDOW *win"  
 .Fn wclrtobot "WINDOW *win"  
 .Fn wclrtoeol "WINDOW *win"  
@@ -798,4 +954,7 @@
 .Fn wscanw "WINDOW *win" "char *fmt" "..." 
 .Fn wstandend "WINDOW *win" 
 .Fn wstandout "WINDOW *win"
+.Fn wtimeout "WINDOW *win" "int delay"
+.Fn wunderend "WINDOW *win" 



Home | Main Index | Thread Index | Old Index