home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / PRINT / BOX.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-28  |  2.7 KB  |  95 lines

  1. /***( box.c )*******************************************************************
  2. *                                                                              *
  3. *  Written: Brent Faulkner - June 15, 1989                                     *
  4. *  Updated: Brent Faulkner - June 15, 1989                                     *
  5. *                                                                              *
  6. ********************************************************************************
  7. *                                                                              *
  8. * Contents:       box_p() - draw a box in the page buffer                      *
  9. *             underln_p() - horizontal line with T'ed ends                     *
  10. *             upperln_p() - vertical line with T'ed ends                       *
  11. *                                                                              *
  12. *******************************************************************************/
  13. /* include files */
  14. #include <stdio.h>
  15. #include <bench.h>
  16. #include "prt.h"
  17.  
  18. int boxset_p;
  19.  
  20. /*
  21.  * draw a box in the page buffer
  22. */
  23. void box_p(line, col, attr, height, width)
  24. int line;
  25. int col;
  26. int attr;
  27. int height;
  28. int width;
  29. {
  30.     int lline = line + height - 1;
  31.     int lcol = col + width - 1;
  32.  
  33.     attr |= P_BOX;
  34.  
  35.     poke_p(line, col, attr, BOX_TOP_LFT(boxset_p));
  36.     rephoriz_p(line, col + 1, attr, width - 2, BOX_HORIZ(boxset_p));
  37.     poke_p(line, lcol, attr, BOX_TOP_RT(boxset_p));
  38.  
  39.     poke_p(lline, col, attr, BOX_BOT_LFT(boxset_p));
  40.     rephoriz_p(lline, col + 1, attr, width - 2, BOX_HORIZ(boxset_p));
  41.     poke_p(lline, lcol, attr, BOX_BOT_RT(boxset_p));
  42.  
  43.     repvert_p(line + 1, col, attr, height - 2, BOX_VERT(boxset_p));
  44.     repvert_p(line + 1, lcol, attr, height - 2, BOX_VERT(boxset_p));
  45. }
  46.  
  47. /*
  48.  * horizontal line with T'ed ends
  49. */
  50. void underln_p(line, col, attr, width)
  51. int line;
  52. int col;
  53. int attr;
  54. int width;
  55. {
  56.     attr |= P_BOX;
  57.  
  58.     poke_p(line, col, attr, BOX_LFT_TEE(boxset_p));
  59.     rephoriz_p(line, col + 1, attr, width - 2, BOX_HORIZ(boxset_p));
  60.     poke_p(line, col + width - 1, attr, BOX_RT_TEE(boxset_p));
  61. }
  62.  
  63. /*
  64.  * vertical line with T'ed ends
  65. */
  66. void upperln_p(line, col, attr, height)
  67. int line;
  68. int col;
  69. int attr;
  70. int height;
  71. {
  72.     attr |= P_BOX;
  73.  
  74.     poke_p(line, col, attr, BOX_TOP_TEE(boxset_p));
  75.     repvert_p(line + 1, col, attr, height - 2, BOX_VERT(boxset_p));
  76.     poke_p(line + height - 1, col, attr, BOX_BOT_TEE(boxset_p));
  77. }
  78.  
  79. /*
  80.  * fill in an area 
  81. */
  82. void fill_p(line, col, attr, height, width, fill_ch)
  83. int line;
  84. int col;
  85. int attr;
  86. int height;
  87. int width;
  88. int fill_ch;
  89. {
  90.     int row;
  91.     for (row = 0; row < height; row++)
  92.         rephoriz_p(row + line, col, attr, width, fill_ch);
  93. }
  94.  
  95.