home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / CMAPDECL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  2.7 KB  |  75 lines

  1. /*
  2.     cmapdecl.h    1/26/88
  3.  
  4.     Character Map handling routines
  5.     by Joe DeSantis.
  6.     recreated by Ted Peck.
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      3/18/88 ted    made cmap a structure, not just a char **
  15.      5/09/89 ted    Changed Alloc/Free terms to Open/Close.
  16. */
  17.  
  18. /* -------------------------------------------------------------------------- */
  19. /* character map structure */
  20.  
  21. typedef struct cmap_struct {
  22.     int     ncols;
  23.     int        nrows;
  24.     int     bufsize;
  25.     char   *charbuf;
  26.     byte   *attrbuf;
  27. } *cmap_type;
  28.  
  29. /* -------------------------------------------------------------------------- */
  30. #define cmap_GetWidth(cmap)                ((cmap)->ncols)
  31. #define cmap_GetHeight(cmap)            ((cmap)->nrows)
  32.  
  33. #define cmap_charbuf(cmap, row, col)    \
  34.             (&((cmap)->charbuf[(row) * (cmap)->ncols + (col)]))
  35.  
  36. #define cmap_attrbuf(cmap, row, col)    \
  37.             ((byte *)(cmap_charbuf(cmap) + (cmap)->bufsize))
  38.  
  39. #define cmap_charattrbuf(cmap, charbuf)    \
  40.             ((byte *)((charbuf) + (cmap)->bufsize))
  41.  
  42. #define cmap_PutStringAttr(cmap, row, col, string, attr, slen)    \
  43.             cmap_psa(cmap, row, col, string, attr, 0, slen)
  44.  
  45. #define cmap_PutString(cmap, row, col, string, color, slen)     \
  46.             cmap_psa(cmap, row, col, string, NULL, color, slen)
  47.  
  48. #define cmap_PutChar(cmap, row, col, c, attr)                    \
  49.             cmap_psa(cmap, row, col, &(c), NULL, attr, 1)
  50.  
  51. /* -------------------------------------------------------------------------- */
  52. /* cmap.c */
  53. extern cmap_type     cmap_Open(_arg2(int nrows, int ncols));
  54. extern void         cmap_Close(_arg1(cmap_type cmap));
  55. extern unsigned     cmap_clipcbox(_arg2(cmap_type cmap, ocbox *cboxp));
  56. extern unsigned     cmap_clippos(_arg3(cmap_type cmap, int *rowp, int *colp));
  57.  
  58. /* cmapput.c */
  59. extern char *cmap_psa(_arg7(cmap_type cmap, int row, int col, char *string,
  60.                             byte *attrbuf, byte attr, int slen));
  61.  
  62. extern void cmap_PutBox(_arg4(cmap_type cmap, char *boxchar, ocbox *cboxp, byte attr));
  63.  
  64. extern void cmap_PutHzLine(_arg6(cmap_type cmap, char *linechar, int row1, int col1, int length, byte attr));
  65. extern void cmap_PutVtLine(_arg6(cmap_type cmap, char *linechar, int row1, int col1, int length, byte attr));
  66. extern void cmap_ClearBox(_arg3(cmap_type cmap, ocbox *cboxp, byte attr));
  67. extern void cmap_ScrollBoxVt(_arg3(cmap_type cmap, ocbox *cboxp, int nlines));
  68. extern void cmap_ScrollBoxHz(_arg3(cmap_type cmap, ocbox *cboxp, int nlines));
  69.  
  70. /* cmwin.c - Included here because they use cmap_type */
  71. #define cmwin_GetCmap(win)            ((cmap_type) (cmwin_getxd(win)->cmap))
  72. #define cmwin_SetCmap(win, cm)        (cmwin_getxd(win)->cmap = (VOID *)(cm))
  73. /* -------------------------------------------------------------------------- */
  74.  
  75.