Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Added functions to replace what were previousl...



details:   https://anonhg.NetBSD.org/src/rev/603839f97009
branches:  trunk
changeset: 484938:603839f97009
user:      blymn <blymn%NetBSD.org@localhost>
date:      Sat Apr 15 13:17:02 2000 +0000

description:
Added functions to replace what were previously macros in curses.h
(this is a requirement of SUSv2) - the old macro behaviour can be
restored by defining _CURSES_USE_MACROS.
Changed function prototypes to use ANSI style.
All externally visible functions now have ANSI style declarations.

diffstat:

 lib/libcurses/acs.c            |    4 +-
 lib/libcurses/addbytes.c       |   57 +++++++-
 lib/libcurses/addch.c          |   50 ++++++-
 lib/libcurses/addnstr.c        |   80 +++++++++++-
 lib/libcurses/attributes.c     |   49 +++++-
 lib/libcurses/background.c     |   13 +-
 lib/libcurses/border.c         |   25 +++-
 lib/libcurses/box.c            |    8 +-
 lib/libcurses/clear.c          |   21 ++-
 lib/libcurses/clearok.c        |    6 +-
 lib/libcurses/clrtobot.c       |   21 ++-
 lib/libcurses/clrtoeol.c       |   21 ++-
 lib/libcurses/color.c          |   26 +--
 lib/libcurses/cr_put.c         |   10 +-
 lib/libcurses/ctrace.c         |   11 +-
 lib/libcurses/cur_hash.c       |    8 +-
 lib/libcurses/curses.h         |  269 +++++++++++++++++++++++++---------------
 lib/libcurses/curses_private.h |   58 ++++----
 lib/libcurses/delch.c          |   43 +++++-
 lib/libcurses/deleteln.c       |   21 ++-
 lib/libcurses/delwin.c         |    7 +-
 lib/libcurses/erase.c          |   21 ++-
 lib/libcurses/flushok.c        |    6 +-
 lib/libcurses/fullname.c       |    7 +-
 lib/libcurses/getch.c          |   55 +++++++-
 lib/libcurses/getstr.c         |   46 ++++++-
 lib/libcurses/getyx.c          |   20 +-
 lib/libcurses/id_subwins.c     |    7 +-
 lib/libcurses/idlok.c          |    8 +-
 lib/libcurses/inch.c           |   42 +++++-
 lib/libcurses/initscr.c        |    6 +-
 lib/libcurses/insch.c          |   45 ++++++-
 lib/libcurses/insdelln.c       |   20 ++-
 lib/libcurses/insertln.c       |   22 ++-
 lib/libcurses/keypad.c         |    6 +-
 lib/libcurses/leaveok.c        |    6 +-
 lib/libcurses/longname.c       |    7 +-
 lib/libcurses/move.c           |   21 ++-
 lib/libcurses/mvwin.c          |    8 +-
 lib/libcurses/newwin.c         |   17 +-
 lib/libcurses/nodelay.c        |    6 +-
 lib/libcurses/notimeout.c      |    6 +-
 lib/libcurses/overlay.c        |    8 +-
 lib/libcurses/overwrite.c      |    7 +-
 lib/libcurses/printw.c         |   11 +-
 lib/libcurses/putchar.c        |    7 +-
 lib/libcurses/refresh.c        |   22 ++-
 lib/libcurses/scanw.c          |   11 +-
 lib/libcurses/scroll.c         |   25 ++-
 lib/libcurses/scrollok.c       |    6 +-
 lib/libcurses/setterm.c        |   10 +-
 lib/libcurses/standout.c       |   37 ++++-
 lib/libcurses/timeout.c        |   20 ++-
 lib/libcurses/toucholap.c      |    7 +-
 lib/libcurses/touchwin.c       |   19 +-
 lib/libcurses/tstp.c           |   19 +-
 lib/libcurses/tty.c            |   55 +++----
 lib/libcurses/underscore.c     |   33 ++++-
 58 files changed, 1020 insertions(+), 467 deletions(-)

diffs (truncated from 3126 to 300 lines):

diff -r 02c236085d28 -r 603839f97009 lib/libcurses/acs.c
--- a/lib/libcurses/acs.c       Sat Apr 15 06:29:25 2000 +0000
+++ b/lib/libcurses/acs.c       Sat Apr 15 13:17:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acs.c,v 1.5 2000/04/12 21:33:35 jdc Exp $      */
+/*     $NetBSD: acs.c,v 1.6 2000/04/15 13:17:02 blymn Exp $    */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  *     character pairs - ACS definition then terminal representation.
  */
 void
-__init_acs()
+__init_acs(void)
 {
        int             count;
        char            *aofac; /* Address of 'ac' */
diff -r 02c236085d28 -r 603839f97009 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Sat Apr 15 06:29:25 2000 +0000
+++ b/lib/libcurses/addbytes.c  Sat Apr 15 13:17:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addbytes.c,v 1.16 2000/04/12 21:47:50 jdc Exp $        */
+/*     $NetBSD: addbytes.c,v 1.17 2000/04/15 13:17:02 blymn Exp $      */
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.16 2000/04/12 21:47:50 jdc Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.17 2000/04/15 13:17:02 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -48,16 +48,59 @@
 #define        SYNCH_IN        {y = win->cury; x = win->curx;}
 #define        SYNCH_OUT       {win->cury = y; win->curx = x;}
 
+#ifndef _CURSES_USE_MACROS
+
+/*
+ * addbytes --
+ *      Add the character to the current position in stdscr.
+ */
+int
+addbytes(const char *bytes, int count)
+{
+       return __waddbytes(stdscr, bytes, count, 0);
+}
+
+/*
+ * waddbytes --
+ *      Add the character to the current position in the given window.
+ */
+int
+waddbytes(WINDOW *win, const char *bytes, int count)
+{
+       return __waddbytes(win, bytes, count, 0);
+}
+
+/*
+ * mvaddbytes --
+ *      Add the characters to stdscr at the location given.
+ */
+int
+mvaddbytes(int y, int x, const char *bytes, int count)
+{
+       return mvwaddbytes(stdscr, y, x, bytes, count);
+}
+
+/*
+ * mvwaddbytes --
+ *      Add the characters to the given window at the location given.
+ */
+int
+mvwaddbytes(WINDOW *win, int y, int x, const char *bytes, int count)
+{
+       if (wmove(win, y, x) == ERR)
+               return ERR;
+
+       return __waddbytes(win, bytes, count, 0);
+}
+
+#endif
+
 /*
  * waddbytes --
  *     Add the character to the current position in the given window.
  */
 int
-__waddbytes(win, bytes, count, attr)
-       WINDOW          *win;
-       const char      *bytes;
-       int              count;
-       attr_t           attr;
+__waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr)
 {
        static char      blanks[] = "        ";
        int              c, newx, x, y;
diff -r 02c236085d28 -r 603839f97009 lib/libcurses/addch.c
--- a/lib/libcurses/addch.c     Sat Apr 15 06:29:25 2000 +0000
+++ b/lib/libcurses/addch.c     Sat Apr 15 13:17:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addch.c,v 1.10 2000/04/11 13:57:08 blymn Exp $ */
+/*     $NetBSD: addch.c,v 1.11 2000/04/15 13:17:02 blymn Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -38,22 +38,58 @@
 #if 0
 static char sccsid[] = "@(#)addch.c    8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addch.c,v 1.10 2000/04/11 13:57:08 blymn Exp $");
+__RCSID("$NetBSD: addch.c,v 1.11 2000/04/15 13:17:02 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
 #include "curses.h"
 #include "curses_private.h"
 
+#ifndef _CURSES_USE_MACROS
+
+/*
+ * addch --
+ *     Add the character to the current position in stdscr.
+ *
+ */
+int
+addch(chtype ch)
+{
+       return waddch(stdscr, ch);
+}
+
+/*
+ * mvaddch --
+ *      Add the character to stdscr at the given location.
+ */
+int
+mvaddch(int y, int x, chtype ch)
+{
+       return mvwaddch(stdscr, y, x, ch);
+}
+
+/*
+ * mvwaddch --
+ *      Add the character to the given window at the given location.
+ */
+int
+mvwaddch(WINDOW *win, int y, int x, chtype ch)
+{
+       if (wmove(win, y, x) == ERR)
+               return ERR;
+
+       return waddch(win, ch);
+}
+
+#endif
+
 /*
  * waddch --
  *     Add the character to the current position in the given window.
  *
  */
 int
-waddch(win, ch)
-       WINDOW *win;
-       chtype   ch;
+waddch(WINDOW *win, chtype ch)
 {
        __LDATA buf;
 
@@ -66,9 +102,7 @@
 }
 
 int
-__waddch(win, dp)
-       WINDOW *win;
-       __LDATA *dp;
+__waddch(WINDOW *win, __LDATA *dp)
 {
        char    buf[2];
 
diff -r 02c236085d28 -r 603839f97009 lib/libcurses/addnstr.c
--- a/lib/libcurses/addnstr.c   Sat Apr 15 06:29:25 2000 +0000
+++ b/lib/libcurses/addnstr.c   Sat Apr 15 13:17:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addnstr.c,v 1.6 2000/04/11 13:57:08 blymn Exp $        */
+/*     $NetBSD: addnstr.c,v 1.7 2000/04/15 13:17:02 blymn Exp $        */
 
 /*
  * Copyright (c) 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)addnstr.c  8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addnstr.c,v 1.6 2000/04/11 13:57:08 blymn Exp $");
+__RCSID("$NetBSD: addnstr.c,v 1.7 2000/04/15 13:17:02 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -47,6 +47,77 @@
 #include "curses.h"
 #include "curses_private.h"
 
+#ifndef _CURSES_USE_MACROS
+
+/*
+ * addstr --
+ *      Add a string to stdscr starting at (_cury, _curx).
+ */
+int
+addstr(s)
+       const char *s;
+{
+       return waddnstr(stdscr, s, -1);
+}
+
+/*
+ * addnstr --
+ *      Add a string (at most n characters) to stdscr starting
+ *     at (_cury, _curx).  If n is negative, add the entire string.
+ */
+int
+addnstr(const char *str, int n)
+{
+       return waddnstr(stdscr, str, n);
+}
+
+/*
+ * mvaddstr --
+ *      Add a string to stdscr starting at (y, x)
+ */
+int
+mvaddstr(int y, int x, const char *str)
+{
+       return mvwaddnstr(stdscr, y, x, str, -1);
+}
+
+/*
+ * mvwaddstr --
+ *      Add a string to the given window starting at (y, x)
+ */
+int
+mvwaddstr(WINDOW *win, int y, int x, const char *str)
+{
+       return mvwaddnstr(win, y, x, str, -1);
+}
+
+/*
+ * mvaddnstr --
+ *      Add a string of at most n characters to stdscr
+ *      starting at (y, x).
+ */
+int
+mvaddnstr(int y, int x, const char *str, int count)
+{
+       return mvwaddnstr(stdscr, y, x, str, count);
+}
+
+/*
+ * mvwaddnstr --
+ *      Add a string of at most n characters to the given window
+ *      starting at (y, x).
+ */
+int
+mvwaddnstr(WINDOW *win, int y, int x, const char *str, int count)
+{
+       if (wmove(win, y, x) == ERR)
+               return ERR;
+
+       return waddnstr(win, str, count);
+}
+
+#endif
+
 /*
  * waddnstr --
  *     Add a string (at most n characters) to the given window
@@ -54,10 +125,7 @@
  *     entire string.
  */
 int
-waddnstr(win, s, n)
-       WINDOW *win;
-       const char *s;
-       int     n;
+waddnstr(WINDOW *win, const char *s, int n)
 {
        size_t  len;
        const char *p;
diff -r 02c236085d28 -r 603839f97009 lib/libcurses/attributes.c
--- a/lib/libcurses/attributes.c        Sat Apr 15 06:29:25 2000 +0000
+++ b/lib/libcurses/attributes.c        Sat Apr 15 13:17:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: attributes.c,v 1.3 2000/04/12 21:43:57 jdc Exp $       */
+/*     $NetBSD: attributes.c,v 1.4 2000/04/15 13:17:02 blymn Exp $     */
 
 /*-



Home | Main Index | Thread Index | Old Index