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

  1. /***( pokep.c )*****************************************************************
  2. *                                                                              *
  3. *  Written: Brent Faulkner - June 15, 1989                                     *
  4. *  Updated: Brent Faulkner - June 15, 1989                                     *
  5. *                                                                              *
  6. ********************************************************************************
  7. *                                                                              *
  8. * Contents:      poke_p() - put a character and attribute into the buffers     *
  9. *            rephoriz_p() - repeat a character and attribute horizontally      *
  10. *             repvert_p() - repeat a character and attribute vertically        *
  11. *                                                                              *
  12. *******************************************************************************/
  13. /* include files */
  14. #include <stdio.h>
  15. #include <bench.h>
  16. #include "prt.h"
  17.  
  18. /*
  19.  * put a character and attribute into the page buffer
  20. */
  21. void poke_p(line, col, attr, ch)
  22. int line;
  23. int col;
  24. int attr;
  25. int ch;
  26. {
  27. /* return if the character is off the page */
  28.     if (line < 1 || col < 1 || line > (unsigned char)*prtdef[NUM_LINES] || col > (unsigned char)*prtdef[NUM_COLS])
  29.     {
  30. #ifdef PDEBUG
  31.         fprintf(stderr,
  32.             "POKE_P(%d, %d, %4X, %2X) on page with %d lines and %d columns.\n",
  33.             line, col, attr, ch, *prtdef[NUM_LINES], *prtdef[NUM_COLS]);
  34. #endif
  35.         return;
  36.     }
  37.  
  38. /* put the character and it's attribute into the page buffers */
  39.     pagebuff[line - 1][col - 1] = (char) ch;
  40.     attrbuff[line - 1][col - 1] = attr;
  41. }
  42.  
  43. /*
  44.  * Repeatedly poke_p a character and attribute horizontally into the buffers
  45. */
  46. void rephoriz_p(line, col, attr, len, ch)
  47. int line;
  48. register int col;
  49. int attr;
  50. register int len;
  51. int ch;
  52. {
  53.     while(len--)
  54.         poke_p(line, col++, attr, ch);
  55. }
  56.  
  57. /*
  58.  * Repeatedly poke_p a character and attribute vertically into the buffers
  59. */
  60. void repvert_p(line, col, attr, len, ch)
  61. register int line;
  62. int col;
  63. int attr;
  64. register int len;
  65. int ch;
  66. {
  67.     while(len--)
  68.         poke_p(line++, col, attr, ch);
  69. }
  70.