home *** CD-ROM | disk | FTP | other *** search
- /*
- cmapcopy.c 5/03/90
-
- % Function that copies a cmap into another.
- By Ted.
-
- OWL 1.2
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "cmapdecl.h"
- /* -------------------------------------------------------------------------- */
-
- void cmap_Copy(cmap_type dcmap, cmap_type scmap, byte attr)
- /*
- Copy from source to destination cmap, filling in with blanks and attr
- if the destination cmap is not filled by the source cmap.
- */
- {
- int row, len, tlen;
- char *cbuf, *scbuf;
- byte *abuf, *sabuf;
-
- len = omin(scmap->ncols, dcmap->ncols);
- tlen = dcmap->ncols - len;
-
- cbuf = dcmap->charbuf;
- abuf = dcmap->attrbuf;
- scbuf = scmap->charbuf;
- sabuf = scmap->attrbuf;
-
- /* Copy stuff */
- for (row = 0; row < dcmap->nrows; row++) {
- /* Clear out bottom if we grew taller */
- if (row >= scmap->nrows) {
- memset((VOID *) cbuf, ' ', (dcmap->nrows - row) * dcmap->ncols);
- memset((VOID *) abuf, attr, (dcmap->nrows - row) * dcmap->ncols);
- break;
- }
- /* Copy line */
- memmove((VOID *) cbuf, (VOID *) scbuf, len);
- memmove((VOID *) abuf, (VOID *) sabuf, len);
-
- cbuf += len;
- abuf += len;
- scbuf += scmap->ncols;
- sabuf += scmap->ncols;
-
- /* Clear out ends if we grew wider */
- if (tlen > 0) {
- memset((VOID *) cbuf, ' ', tlen);
- memset((VOID *) abuf, attr, tlen);
- cbuf += tlen;
- abuf += tlen;
- }
- }
- }
- /* -------------------------------------------------------------------------- */
-
-