home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CURSES.LZH / WINERASE.C < prev    next >
C/C++ Source or Header  |  1980-01-01  |  2KB  |  59 lines

  1. /****************************************************************/
  2. /*                                */
  3. /* Erase() routines of the PCcurses package            */
  4. /*                                */
  5. /****************************************************************/
  6. /* This version of curses is based on ncurses, a curses version    */
  7. /* originally written by Pavel Curtis at Cornell University.    */
  8. /* I have made substantial changes to make it run on IBM PC's,    */
  9. /* and therefore consider myself free to make it public domain.    */
  10. /*        Bjorn Larsson (...mcvax!enea!infovax!bl)    */
  11. /****************************************************************/
  12. /* 1.0:    Release:                    870515    */
  13. /* 1.2:    Max limits off by 1. Fixed thanks to S. Creps:    881002    */
  14. /* 1.3:    MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  15. /****************************************************************/
  16.  
  17. #include <curses.h>
  18. #include <curspriv.h>
  19.  
  20. char _curses_winerase_rcsid[] = "@(#)winerase.c v1.3 - 881005";
  21.  
  22. /****************************************************************/
  23. /* Werase() fills all lines of window 'win' with blanks and po-    */
  24. /* sitions the cursor at home in the scroll region.        */
  25. /****************************************************************/
  26.  
  27. void    werase(win)
  28.   WINDOW    *win;
  29.   {
  30.   int        *end;
  31.   int        *start;
  32.   short         y;
  33.   static   int     blank;
  34.   
  35.   blank = ' ' | (win->_attrs & ATR_MSK);
  36.  
  37.   for (y = win->_regtop; y <= win->_regbottom; y++)    /* clear all lines */
  38.     {
  39.     start = win->_line[y];
  40.     end = &start[win->_maxx - 1];
  41.     while (start <= end)                /* clear all line */
  42.       *start++ = blank;
  43.     win->_minchng[y] = 0;
  44.     win->_maxchng[y] = win->_maxx - 1;
  45.     }
  46.   win->_cury = win->_regtop;                /* cursor home */
  47.   win->_curx = 0;
  48.   } /* werase */
  49.  
  50. /****************************************************************/
  51. /* Erase() fills all lines of stdscr with blanks and positions    */
  52. /* the cursor at home in the scroll region.            */
  53. /****************************************************************/
  54.  
  55. void erase()
  56.   {
  57.   werase(stdscr);
  58.   } /* erase */
  59.