home *** CD-ROM | disk | FTP | other *** search
- /*
- * putcinc.c
- * contains: putcinc()
- *
- */
-
- #include <stdio.h>
- #include "gfuncts.h"
-
- /*
- * void
- * putcinc(chr,color,page)
- *
- * ARGUMENT
- * (char) chr - character to write
- * (int) color - color or monochrome attribute
- * (int) page - video page to write
- *
- * DESCRIPTION
- * Output one character to Color Display and Increment Cursor to Next
- * Logical Position. If in last column of a row, increment to next row.
- * Use pch to display character and attribute. Translate newlines to
- * CR LF sequences. Determine cursor position at each newline.
- *
- * AUTHOR
- * Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- *
- * MODIFICATIONS
- * "" Tue 08-Nov-1988 11:28:31
- * not handling tabs correctly in column 0 (SAR #0043).
- */
- void GF_CONV putcinc(c,color,page)
- char c;
- int page, color;
- {
- int x,y,width;
- unsigned where;
- struct GFREGS out;
-
- where=getcur(page);
- x=(int)where&0xFF;
- y=((int)where&0xFF00)>>8;
- vstate(&out);
- width=out.bx;
- switch (c) {
- case 0x0A:
- if(y<gmaxrow-1)
- ++y;
- curset(y,0,page);
- break;
- case 0x0D:
- curset(y,0,page);
- break;
- case '\t':
- if(!x) {
- x=8;
- curset(y,x,page);
- } else
- while(x % 8)
- if(++x<width)
- curset(y,x,page);
- break;
- default:
- pch(c,color,page);
- if(x>=(width-1)) {
- if(y<gmaxrow-1)
- ++y;
- curset(y,0,page);
- } else
- curset( y,++x,page );
- }
- }
-