home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 332_02 / winerase.c < prev    next >
C/C++ Source or Header  |  1990-01-06  |  2KB  |  61 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 (bl@infovox.se)    */
  11. /****************************************************************/
  12. /* 1.4:  Use of short wherever possible. Portability        */
  13. /*     improvements:                    900114    */
  14. /* 1.3:     MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  15. /* 1.2:     Max limits off by 1. Fixed thanks to S. Creps:    881002    */
  16. /* 1.0:     Release:                    870515    */
  17. /****************************************************************/
  18.  
  19. #include <curses.h>
  20. #include <curspriv.h>
  21.  
  22. char _curses_winerase_rcsid[] = "@(#)winerase.c   v.1.4  - 900114";
  23.  
  24. /****************************************************************/
  25. /* Werase() fills all lines of window 'win' with blanks and po-    */
  26. /* sitions the cursor at home in the scroll region.        */
  27. /****************************************************************/
  28.  
  29. void    werase(win)
  30.   WINDOW    *win;
  31.   {
  32.   short        *end;
  33.   short        *start;
  34.   short         y;
  35.   static short     blank;
  36.   
  37.   blank = ' ' | (win->_attrs & ATR_MSK);
  38.  
  39.   for (y = win->_regtop; y <= win->_regbottom; y++)    /* clear all lines */
  40.     {
  41.     start = win->_line[y];
  42.     end = &start[win->_maxx - 1];
  43.     while (start <= end)                /* clear all line */
  44.       *start++ = blank;
  45.     win->_minchng[y] = 0;
  46.     win->_maxchng[y] = win->_maxx - 1;
  47.     }
  48.   win->_cury = win->_regtop;                /* cursor home */
  49.   win->_curx = 0;
  50.   } /* werase */
  51.  
  52. /****************************************************************/
  53. /* Erase() fills all lines of stdscr with blanks and positions    */
  54. /* the cursor at home in the scroll region.            */
  55. /****************************************************************/
  56.  
  57. void erase()
  58.   {
  59.   werase(stdscr);
  60.   } /* erase */
  61.