home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BTMTSRC3.ZIP / SB_WRITE.C < prev    next >
C/C++ Source or Header  |  1990-05-14  |  6KB  |  147 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-90, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*         Routines for writing stuff to windows within 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.240.    */
  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:132/491, 1:141/491  */
  34. /* P.O. Box 460398                AlterNet 7:491/0                          */
  35. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  36. /*                                Internet f491.n132.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.  
  52. #include <stdio.h>
  53.  
  54. #include "sbuf.h"
  55. #include "com.h"
  56. #include "xfer.h"
  57. #include "zmodem.h"
  58. #include "keybd.h"
  59. #include "sched.h"
  60. #include "externs.h"
  61. #include "prototyp.h"
  62.  
  63.  
  64. extern BUFFER Sbuf;
  65. extern CELLP Scrnbuf;
  66.  
  67. void sb_wa (win, attr, n)
  68. REGIONP win;
  69. int attr;
  70. int n;
  71. {
  72.    int i;
  73.    int row;
  74.    int col;
  75.  
  76.    i = n;
  77.    row = win->r0 + win->row;
  78.    col = win->c0 + win->col;
  79.    while (i--)
  80.       (Scrnbuf + row * SB_COLS + col + i)->b.attr = (unsigned char) attr;
  81.  
  82.    /* marked the changed region */
  83.    if (col < Sbuf.lcol[row])
  84.       Sbuf.lcol[row] = col;
  85.    if (col + n > Sbuf.rcol[row])
  86.       Sbuf.rcol[row] = col + n;
  87.  
  88.    Sbuf.flags |= SB_DELTA;
  89.  
  90.    return; /* ((i == 0) ? SB_OK : SB_ERR); */
  91. }
  92.  
  93. void sb_wc (win, ch, n)
  94. REGIONP win;
  95. int ch;
  96. int n;
  97. {
  98.    int i;
  99.    int row;
  100.    int col;
  101.  
  102.    i = n;
  103.    row = win->r0 + win->row;
  104.    col = win->c0 + win->col;
  105.    while (i--)
  106.       (Scrnbuf + row * SB_COLS + col + i)->b.ch = (unsigned char) ch;
  107.  
  108.    /* marked the changed region */
  109.    if (col < Sbuf.lcol[row])
  110.       Sbuf.lcol[row] = col;
  111.    if (col + n > Sbuf.rcol[row])
  112.       Sbuf.rcol[row] = col + n;
  113.  
  114.    Sbuf.flags |= SB_DELTA;
  115.  
  116.    return; /* ((i == 0) ? SB_OK : SB_ERR); */
  117. }
  118.  
  119. void sb_wca (win, ch, attr, n)
  120. REGIONP win;
  121. int ch;
  122. int attr;
  123. int n;
  124. {
  125.    int i;
  126.    int row;
  127.    int col;
  128.    unsigned int ca;
  129.  
  130.    i = n;
  131.    ca = (((unsigned) attr) << 8) | (unsigned) ch;
  132.    row = win->r0 + win->row;
  133.    col = win->c0 + win->col;
  134.    while (i--)
  135.       (Scrnbuf + row * SB_COLS + col + i)->cap = ca;
  136.  
  137.    /* marked the changed region */
  138.    if (col < Sbuf.lcol[row])
  139.       Sbuf.lcol[row] = col;
  140.    if (col + n > Sbuf.rcol[row])
  141.       Sbuf.rcol[row] = col + n;
  142.  
  143.    Sbuf.flags |= SB_DELTA;
  144.  
  145.    return; /* ((i == 0) ? SB_OK : SB_ERR); */
  146. }
  147.