home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / cursesp.zip / WINERASE.C < prev    next >
C/C++ Source or Header  |  1991-12-02  |  2KB  |  58 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(WINDOW *win)
  28.   {
  29.   int           *end;
  30.   int           *start;
  31.   short          y;
  32.   static   int   blank;
  33.   
  34.   blank = ' ' | (win->_attrs & ATR_MSK);
  35.  
  36.   for (y = win->_regtop; y <= win->_regbottom; y++)     /* clear all lines */
  37.     {
  38.     start = win->_line[y];
  39.     end = &start[win->_maxx - 1];
  40.     while (start <= end)                                /* clear all line */
  41.       *start++ = blank;
  42.     win->_minchng[y] = 0;
  43.     win->_maxchng[y] = win->_maxx - 1;
  44.     }
  45.   win->_cury = win->_regtop;                            /* cursor home */
  46.   win->_curx = 0;
  47.   } /* werase */
  48.  
  49. /****************************************************************/
  50. /* Erase() fills all lines of stdscr with blanks and positions  */
  51. /* the cursor at home in the scroll region.                     */
  52. /****************************************************************/
  53.  
  54. void erase()
  55.   {
  56.   werase(stdscr);
  57.   } /* erase */
  58.