home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / bbs_mail / bsrc_250.arj / SB_FILL.C < prev    next >
C/C++ Source or Header  |  1991-09-15  |  6KB  |  133 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                Box Filling subroutines for BinkleyTerm                   */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.250.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  24. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  25. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  26. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  27. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /* You can contact Bit Bucket Software Co. at any one of the following      */
  31. /* addresses:                                                               */
  32. /*                                                                          */
  33. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  34. /* P.O. Box 460398                AlterNet 7:491/0                          */
  35. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  36. /*                                Internet f491.n343.z1.fidonet.org         */
  37. /*                                                                          */
  38. /* Please feel free to contact us at any time to share your comments about  */
  39. /* our software and/or licensing policies.                                  */
  40. /*                                                                          */
  41. /*                                                                          */
  42. /*   This module is derived from code developed by Augie Hansen in his      */
  43. /*   book "Proficient C" published by Microsoft Press.  Mr. Hansen was      */
  44. /*   kind enough to give us verbal permission to use his routines, and      */
  45. /*   Bob, Vince and Alan (and all our full screen users) are grateful.      */
  46. /*   If you decide to use this code in some package you are doing, give     */
  47. /*   some thought to going out and buying the book. He deserves that.       */
  48. /*                                                                          */
  49. /*--------------------------------------------------------------------------*/
  50.  
  51. /* Include this file before any other includes or defines! */
  52.  
  53. #include "includes.h"
  54.  
  55. extern BUFFER Sbuf;
  56. extern CELLP Scrnbuf;
  57.  
  58. void sb_fill (REGIONP win, int ch, int attr)
  59. {
  60.    register int i, j;
  61.    unsigned int ca;
  62.  
  63.    ca = ((unsigned) attr << 8) | (unsigned) ch;
  64.  
  65.    for (i = win->sr0; i <= win->sr1; i++)
  66.       {
  67.       for (j = win->sc0; j <= win->sc1; j++)
  68.          {
  69.          (Scrnbuf + i * SB_COLS + j)->cap = ca;
  70.          }
  71.       if (win->sc0 < Sbuf.lcol[i])
  72.          {
  73.          Sbuf.lcol[i] = win->sc0;
  74.          }
  75.       if (win->sc1 > Sbuf.rcol[i])
  76.          {
  77.          Sbuf.rcol[i] = win->sc1;
  78.          }
  79.       }
  80.  
  81.    Sbuf.flags |= SB_DELTA;
  82.    return;
  83. }
  84.  
  85. void sb_fillc (REGIONP win, int ch)
  86. {
  87.    register int i, j;
  88.  
  89.    for (i = win->sr0; i <= win->sr1; i++)
  90.       {
  91.       for (j = win->sc0; j <= win->sc1; j++)
  92.          {
  93.          (Scrnbuf + i * SB_COLS + j)->b.ch = (unsigned char) ch;
  94.          }
  95.       if (win->sc0 < Sbuf.lcol[i])
  96.          {
  97.          Sbuf.lcol[i] = win->sc0;
  98.          }
  99.       if (win->sc1 > Sbuf.rcol[i])
  100.          {
  101.          Sbuf.rcol[i] = win->sc1;
  102.          }
  103.       }
  104.  
  105.    Sbuf.flags |= SB_DELTA;
  106.    return;
  107. }
  108.  
  109. void sb_filla (REGIONP win, int attr)
  110. {
  111.    register int i, j;
  112.  
  113.    for (i = win->sr0; i <= win->sr1; i++)
  114.       {
  115.       for (j = win->sc0; j <= win->sc1; j++)
  116.          {
  117.          (Scrnbuf + i * SB_COLS + j)->b.attr = (unsigned char) attr;
  118.          }
  119.       if (win->sc0 < Sbuf.lcol[i])
  120.          {
  121.          Sbuf.lcol[i] = win->sc0;
  122.          }
  123.       if (win->sc1 > Sbuf.rcol[i])
  124.          {
  125.          Sbuf.rcol[i] = win->sc1;
  126.          }
  127.       }
  128.  
  129.    Sbuf.flags |= SB_DELTA;
  130.    return;
  131. }
  132.  
  133.