(no message)
authorKen Arnold <arnold@ucbvax.Berkeley.EDU>
Mon, 28 Mar 1983 06:09:50 +0000 (22:09 -0800)
committerKen Arnold <arnold@ucbvax.Berkeley.EDU>
Mon, 28 Mar 1983 06:09:50 +0000 (22:09 -0800)
SCCS-vsn: lib/libcurses/refresh.c 1.6
SCCS-vsn: lib/libcurses/cr_put.c 1.4
SCCS-vsn: lib/libcurses/Makefile 1.11
SCCS-vsn: lib/libcurses/newwin.c 1.5
SCCS-vsn: lib/libcurses/setterm.c 1.12
SCCS-vsn: lib/libcurses/overwrite.c 1.3
SCCS-vsn: lib/libcurses/delwin.c 1.2

usr/src/lib/libcurses/Makefile
usr/src/lib/libcurses/cr_put.c
usr/src/lib/libcurses/delwin.c
usr/src/lib/libcurses/newwin.c
usr/src/lib/libcurses/overwrite.c
usr/src/lib/libcurses/refresh.c
usr/src/lib/libcurses/setterm.c

index 0704636..82ad3dc 100644 (file)
@@ -3,7 +3,7 @@
 #
 # @(#)Makefile 1.11 (Berkeley) %G%
 #
 #
 # @(#)Makefile 1.11 (Berkeley) %G%
 #
-HEADERS=curses.h unctrl.h cr_ex.h curses.ext
+HEADERS=curses.h unctrl.h curses.ext
 CFILES=        box.c clear.c initscr.c endwin.c mvprintw.c mvscanw.c mvwin.c \
        newwin.c overlay.c overwrite.c printw.c scanw.c refresh.c \
        touchwin.c erase.c clrtobot.c clrtoeol.c cr_put.c cr_tty.c \
 CFILES=        box.c clear.c initscr.c endwin.c mvprintw.c mvscanw.c mvwin.c \
        newwin.c overlay.c overwrite.c printw.c scanw.c refresh.c \
        touchwin.c erase.c clrtobot.c clrtoeol.c cr_put.c cr_tty.c \
@@ -71,7 +71,7 @@ clean:
        rm ${OBJS} crlib
 
 ctags:
        rm ${OBJS} crlib
 
 ctags:
-       ${CTAGS} ${CFILES} curses.h cr_ex.h
+       ${CTAGS} ${CFILES} curses.h
 
 lint:
        ${LINT} -hxb ${CFL} ${CFILES} -lcurses > lint.out
 
 lint:
        ${LINT} -hxb ${CFL} ${CFILES} -lcurses > lint.out
@@ -92,45 +92,3 @@ llib-lcurses.ln: llib-lcurses
 install:
        install -c crlib ${DESTDIR}/usr/lib/libcurses.a
        ranlib ${DESTDIR}/usr/lib/libcurses.a
 install:
        install -c crlib ${DESTDIR}/usr/lib/libcurses.a
        ranlib ${DESTDIR}/usr/lib/libcurses.a
-
-source: ${HEADERS} ${CFILES}
-
-addch.c: SCCS/s.addch.c ; sccs get addch.c
-addstr.c: SCCS/s.addstr.c ; sccs get addstr.c
-box.c: SCCS/s.box.c ; sccs get box.c
-clear.c: SCCS/s.clear.c ; sccs get clear.c
-clrtobot.c: SCCS/s.clrtobot.c ; sccs get clrtobot.c
-clrtoeol.c: SCCS/s.clrtoeol.c ; sccs get clrtoeol.c
-cr_ex.h: SCCS/s.cr_ex.h ; sccs get cr_ex.h
-cr_put.c: SCCS/s.cr_put.c ; sccs get cr_put.c
-cr_tty.c: SCCS/s.cr_tty.c ; sccs get cr_tty.c
-curses.c: SCCS/s.curses.c ; sccs get curses.c
-curses.h: SCCS/s.curses.h ; sccs get curses.h
-delch.c: SCCS/s.delch.c ; sccs get delch.c
-deleteln.c: SCCS/s.deleteln.c ; sccs get deleteln.c
-delwin.c: SCCS/s.delwin.c ; sccs get delwin.c
-endwin.c: SCCS/s.endwin.c ; sccs get endwin.c
-erase.c: SCCS/s.erase.c ; sccs get erase.c
-getch.c: SCCS/s.getch.c ; sccs get getch.c
-getstr.c: SCCS/s.getstr.c ; sccs get getstr.c
-initscr.c: SCCS/s.initscr.c ; sccs get initscr.c
-insch.c: SCCS/s.insch.c ; sccs get insch.c
-insertln.c: SCCS/s.insertln.c ; sccs get insertln.c
-llib-lcurses: SCCS/s.llib-lcurses ; sccs get llib-lcurses
-longname.c: SCCS/s.longname.c ; sccs get longname.c
-move.c: SCCS/s.move.c ; sccs get move.c
-mvprintw.c: SCCS/s.mvprintw.c ; sccs get mvprintw.c
-mvscanw.c: SCCS/s.mvscanw.c ; sccs get mvscanw.c
-mvwin.c: SCCS/s.mvwin.c ; sccs get mvwin.c
-newwin.c: SCCS/s.newwin.c ; sccs get newwin.c
-overlay.c: SCCS/s.overlay.c ; sccs get overlay.c
-overwrite.c: SCCS/s.overwrite.c ; sccs get overwrite.c
-printw.c: SCCS/s.printw.c ; sccs get printw.c
-refresh.c: SCCS/s.refresh.c ; sccs get refresh.c
-scanw.c: SCCS/s.scanw.c ; sccs get scanw.c
-scroll.c: SCCS/s.scroll.c ; sccs get scroll.c
-standout.c: SCCS/s.standout.c ; sccs get standout.c
-touchwin.c: SCCS/s.touchwin.c ; sccs get touchwin.c
-tstp.c: SCCS/s.tstp.c ; sccs get tstp.c
-unctrl.c: SCCS/s.unctrl.c ; sccs get unctrl.c
-unctrl.h: SCCS/s.unctrl.h ; sccs get unctrl.h
index 158fee9..911bb57 100644 (file)
@@ -11,7 +11,7 @@ int           plodput();
  * as formatting of lines (printing of control characters,
  * line numbering and the like).
  *
  * as formatting of lines (printing of control characters,
  * line numbering and the like).
  *
- * %G% (Berkeley) @(#)cr_put.c 1.3
+ * %G% (Berkeley) @(#)cr_put.c 1.4
  */
 
 /*
  */
 
 /*
@@ -223,11 +223,10 @@ plod(cnt)
        }
        else
        /*
        }
        else
        /*
-        * No home and no up means it's impossible, so we return an
-        * incredibly big number to make cursor motion win out.
+        * No home and no up means it's impossible.
         */
                if (!UP && destline < outline)
         */
                if (!UP && destline < outline)
-                       return (500);
+                       return -1;
        if (GT)
                i = destcol % HARDTABS + destcol / HARDTABS;
        else
        if (GT)
                i = destcol % HARDTABS + destcol / HARDTABS;
        else
@@ -350,7 +349,7 @@ dontcr:
                        if (plodflg)    /* avoid a complex calculation */
                                plodcnt--;
                        else {
                        if (plodflg)    /* avoid a complex calculation */
                                plodcnt--;
                        else {
-                               i = _win->_y[outline-_win->_begy][outcol-_win->_begx];
+                               i = curscr->_y[outline][outcol];
                                if ((i&_STANDOUT) == (curscr->_flags&_STANDOUT))
                                        putchar(i);
                                else
                                if ((i&_STANDOUT) == (curscr->_flags&_STANDOUT))
                                        putchar(i);
                                else
index c9d9b18..aa1313e 100644 (file)
@@ -3,7 +3,7 @@
 /*
  *     This routine deletes a window and releases it back to the system.
  *
 /*
  *     This routine deletes a window and releases it back to the system.
  *
- * %G% (Berkeley) @(#)delwin.c 1.1
+ * %G% (Berkeley) @(#)delwin.c 1.2
  */
 delwin(win)
 reg WINDOW     *win; {
  */
 delwin(win)
 reg WINDOW     *win; {
@@ -14,5 +14,7 @@ reg WINDOW    *win; {
                for (i = 0; i < win->_maxy && win->_y[i]; i++)
                        cfree(win->_y[i]);
        cfree(win->_y);
                for (i = 0; i < win->_maxy && win->_y[i]; i++)
                        cfree(win->_y[i]);
        cfree(win->_y);
+       cfree(win->_firstch);
+       cfree(win->_lastch);
        cfree(win);
 }
        cfree(win);
 }
index c182d73..234e242 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * allocate space for and set up defaults for a new window
  *
 /*
  * allocate space for and set up defaults for a new window
  *
- * %G% (Berkeley) %W
+ * %G% (Berkeley) @(#)newwin.c 1.5
  */
 
 # include      "curses.ext"
  */
 
 # include      "curses.ext"
@@ -73,14 +73,18 @@ int         num_lines, num_cols, begy, begx; {
 # endif
        if (by < orig->_begy || bx < orig->_begx
            || by + nl > orig->_maxy + orig->_begy
 # endif
        if (by < orig->_begy || bx < orig->_begx
            || by + nl > orig->_maxy + orig->_begy
-           || bx + nc > orig->_maxx + orig->_begx)
+           || bx + nc > orig->_maxx + orig->_begx) {
+               fprintf(stderr, "returning ERR (1)\n");
                return ERR;
                return ERR;
+       }
        if (nl == 0)
                nl = orig->_maxy + orig->_begy - by;
        if (nc == 0)
                nc = orig->_maxx + orig->_begx - bx;
        if (nl == 0)
                nl = orig->_maxy + orig->_begy - by;
        if (nc == 0)
                nc = orig->_maxx + orig->_begx - bx;
-       if ((win = makenew(nl, nc, by, bx)) == NULL)
+       if ((win = makenew(nl, nc, by, bx)) == NULL) {
+               fprintf(stderr, "returning ERR (2)\n");
                return ERR;
                return ERR;
+       }
        j = by - orig->_begy;
        k = bx - orig->_begx;
        for (i = 0; i < nl; i++)
        j = by - orig->_begy;
        k = bx - orig->_begx;
        for (i = 0; i < nl; i++)
index 9ff1730..dbd29f4 100644 (file)
@@ -10,7 +10,7 @@
 overwrite(win1, win2)
 reg WINDOW     *win1, *win2; {
 
 overwrite(win1, win2)
 reg WINDOW     *win1, *win2; {
 
-       reg int         x, y, minx, miny, starty;
+       reg int         x, y, minx, miny, startx, starty;
 
 # ifdef DEBUG
        fprintf(outf, "OVERWRITE(0%o, 0%o);\n", win1, win2);
 
 # ifdef DEBUG
        fprintf(outf, "OVERWRITE(0%o, 0%o);\n", win1, win2);
@@ -21,8 +21,11 @@ reg WINDOW   *win1, *win2; {
        fprintf(outf, "OVERWRITE:\tminx = %d,  miny = %d\n", minx, miny);
 # endif
        starty = win1->_begy - win2->_begy;
        fprintf(outf, "OVERWRITE:\tminx = %d,  miny = %d\n", minx, miny);
 # endif
        starty = win1->_begy - win2->_begy;
+       startx = win1->_begx - win2->_begx;
+       if (startx < 0)
+               startx = 0;
        for (y = 0; y < miny; y++)
        for (y = 0; y < miny; y++)
-               if (wmove(win2, y + starty, 0) != ERR)
+               if (wmove(win2, y + starty, startx) != ERR)
                        for (x = 0; x < minx; x++)
                                waddch(win2, win1->_y[y][x]);
 }
                        for (x = 0; x < minx; x++)
                                waddch(win2, win1->_y[y][x]);
 }
index e20b2b1..fa11bd7 100644 (file)
@@ -2,7 +2,7 @@
  * make the current screen look like "win" over the area coverd by
  * win.
  *
  * make the current screen look like "win" over the area coverd by
  * win.
  *
- * %G% (Berkeley) @(#)refresh.c        1.5
+ * %G% (Berkeley) @(#)refresh.c        1.6
  */
 
 # include      "curses.ext"
  */
 
 # include      "curses.ext"
@@ -88,7 +88,7 @@ reg WINDOW    *win;
                        win->_cury = win->_curx = 0;
        }
        else {
                        win->_cury = win->_curx = 0;
        }
        else {
-               mvcur(ly, lx, win->_cury + win->_begy, win->_curx + win->_begx);
+               domvcur(ly, lx, win->_cury+win->_begy, win->_curx+win->_begx);
                curscr->_cury = win->_cury + win->_begy;
                curscr->_curx = win->_curx + win->_begx;
        }
                curscr->_cury = win->_cury + win->_begy;
                curscr->_curx = win->_curx + win->_begx;
        }
@@ -131,7 +131,7 @@ short               wy;
                ce = NULL;
        while (wx <= lch) {
                if (*nsp != *csp) {
                ce = NULL;
        while (wx <= lch) {
                if (*nsp != *csp) {
-                       mvcur(ly, lx, y, wx + win->_begx);
+                       domvcur(ly, lx, y, wx + win->_begx);
 # ifdef DEBUG
                        fprintf(outf, "MAKECH: 1: wx = %d, lx = %d\n", wx, lx);
 # endif        
 # ifdef DEBUG
                        fprintf(outf, "MAKECH: 1: wx = %d, lx = %d\n", wx, lx);
 # endif        
@@ -179,11 +179,12 @@ short             wy;
                                wx++;
                                if (wx >= win->_maxx && wy == win->_maxy - 1)
                                        if (win->_scroll) {
                                wx++;
                                if (wx >= win->_maxx && wy == win->_maxy - 1)
                                        if (win->_scroll) {
-                                           if ((win->_flags&(_ENDLINE|_STANDOUT)) == (_ENDLINE|_STANDOUT))
-                                               if (!MS) {
-                                                   _puts(SE);
-                                                   win->_flags &= ~_STANDOUT;
-                                               }
+                                           if ((curscr->_flags&_STANDOUT) &&
+                                               (win->_flags & _ENDLINE))
+                                                   if (!MS) {
+                                                       _puts(SE);
+                                                       curscr->_flags &= ~_STANDOUT;
+                                                   }
                                            if (!curwin)
                                                putchar((*csp = *nsp) & 0177);
                                            else
                                            if (!curwin)
                                                putchar((*csp = *nsp) & 0177);
                                            else
@@ -209,10 +210,6 @@ short              wy;
                                }
                                nsp++;
                        }
                                }
                                nsp++;
                        }
-                       if (!MS && (*nsp & _STANDOUT)  && (*csp & _STANDOUT)) {
-                               _puts(SE);
-                               win->_flags &= ~_STANDOUT;
-                       }
 # ifdef DEBUG
                        fprintf(outf, "MAKECH: 2: wx = %d, lx = %d\n", wx, lx);
 # endif        
 # ifdef DEBUG
                        fprintf(outf, "MAKECH: 2: wx = %d, lx = %d\n", wx, lx);
 # endif        
@@ -234,9 +231,19 @@ short              wy;
 # endif        
        }
 ret:
 # endif        
        }
 ret:
-       if ((win->_flags & _STANDOUT) && !MS) {
+       return OK;
+}
+
+/*
+ * perform a mvcur, leaving standout mode if necessary
+ */
+static
+domvcur(oy, ox, ny, nx)
+int    oy, ox, ny, nx; {
+
+       if (curscr->_flags & _STANDOUT && !MS) {
                _puts(SE);
                _puts(SE);
-               win->_flags &= ~_STANDOUT;
+               curscr->_flags &= ~_STANDOUT;
        }
        }
-       return OK;
+       mvcur(oy, ox, ny, nx);
 }
 }
index 1dd96c4..1dd8bd2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Terminal initialization routines.
  *
 /*
  * Terminal initialization routines.
  *
- * %G% (Berkeley) @(#)setterm.c        1.11
+ * %G% (Berkeley) @(#)setterm.c        1.12
  */
 
 # include      "curses.ext"
  */
 
 # include      "curses.ext"
@@ -57,8 +57,8 @@ gettmode() {
 setterm(type)
 reg char       *type; {
 
 setterm(type)
 reg char       *type; {
 
-       reg int unknown;
-       char    genbuf[1024];
+       reg int         unknown;
+       static char     genbuf[1024];
 
 # ifdef DEBUG
        fprintf(outf, "SETTERM(\"%s\")\n", type);
 
 # ifdef DEBUG
        fprintf(outf, "SETTERM(\"%s\")\n", type);