home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
CMAPDECL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-03
|
3KB
|
73 lines
/*
cmapdecl.h 1/26/88
Character Map handling routines
by Joe DeSantis.
recreated by Ted Peck.
OWL 1.2
Copyright (c) 1988, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
3/18/88 ted made cmap a structure, not just a char **
5/09/89 ted Changed Alloc/Free terms to Open/Close.
3/28/90 jmd ansi-fied
5/03/90 ted Added cmap_Copy function.
5/05/90 ted Cleaned up; removed charattrbuf macro.
*/
/* -------------------------------------------------------------------------- */
/* character map structure */
typedef struct cmap_struct {
int ncols;
int nrows;
int bufsize;
char *charbuf;
byte *attrbuf;
} *cmap_type;
/* -------------------------------------------------------------------------- */
#define cmap_GetWidth(cmap) ((cmap)->ncols)
#define cmap_GetHeight(cmap) ((cmap)->nrows)
#define cmap_charbuf(cmap, row, col) \
(&((cmap)->charbuf[(row) * (cmap)->ncols + (col)]))
#define cmap_attrbuf(cmap, row, col) \
(&((cmap)->attrbuf[(row) * (cmap)->ncols + (col)]))
#define cmap_PutStringAttr(cmap, row, col, string, attr, slen) \
cmap_psa(cmap, row, col, string, attr, 0, slen)
#define cmap_PutString(cmap, row, col, string, color, slen) \
cmap_psa(cmap, row, col, string, NULL, color, slen)
#define cmap_PutChar(cmap, row, col, c, attr) \
cmap_psa(cmap, row, col, &(c), NULL, attr, 1)
/* -------------------------------------------------------------------------- */
/* CMAP.C */
extern cmap_type cmap_Open(int nrows, int ncols);
extern void cmap_Close(cmap_type cmap);
extern unsigned cmap_clipcbox(cmap_type cmap, ocbox *cboxp);
extern unsigned cmap_clippos(cmap_type cmap, int *rowp, int *colp);
/* CMAPPUT.C */
extern char *cmap_psa(cmap_type cmap, int row, int col, char *string, byte *attrbuf, byte attr, int slen);
extern void cmap_PutBox(cmap_type cmap, char *boxchar, ocbox *cboxp, byte attr);
extern void cmap_PutHzLine(cmap_type cmap, char *linechar, int row1, int col1, int length, byte attr);
extern void cmap_PutVtLine(cmap_type cmap, char *linechar, int row1, int col1, int length, byte attr);
extern void cmap_ClearBox(cmap_type cmap, ocbox *cboxp, byte attr);
extern void cmap_ScrollBoxVt(cmap_type cmap, ocbox *cboxp, int nlines);
extern void cmap_ScrollBoxHz(cmap_type cmap, ocbox *cboxp, int nlines);
/* CMAPCOPY.C */
extern void cmap_Copy(cmap_type dcmap, cmap_type scmap, byte attr);
/* cmwin.c - Included here because they use cmap_type */
#define cmwin_GetCmap(win) ((cmap_type) (cmwin_getxd(win)->cmap))
#define cmwin_SetCmap(win, cm) (cmwin_getxd(win)->cmap = (VOID *)(cm))
/* -------------------------------------------------------------------------- */