home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
- *
- * Redistribution and use in source and binary forms are permitted for
- * non-commercial use, provided that the above copyright notice and this
- * paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED
- * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- /*bdoc
- * Function "ADDLIN"
- *
- * Written: Dave Fritsche
- * Date: January, 1991
- *
- * SYNTAX:
- * addlin(bx, y, ex, type)
- * where "bx" is the beginning column number to start the line, "y" is
- * the line number on which to draw the line, and "ex" is the ending
- * column number for the line.
- * Type one is a wide, solid line type. Type
- * two is dual thin lines, type three is a single thin line, type
- * four is composed of standard ascii characters: '+', '-', and '|', and
- * type five writes spaces (to clear a line).
- edoc*/
-
- #include <stdio.h>
-
- #define BIOS
-
- #ifdef BIOS
- extern char attrib;
- #endif
-
- addlin(bx, y, ex, type)
- int bx, y, ex, type;
- {
- int left, right, line;
- int n;
- #ifdef BIOS
- int attr;
- #endif
-
- switch (type)
- {
- case 1:
- left = 0xdd;
- right = 0xde;
- line = 0xdb;
- break;
- case 2:
- left = 0xcc;
- right = 0xb9;
- line = 0xcd;
- break;
- case 3:
- left = 0xc3;
- right = 0xb4;
- line = 0xc4;
- break;
- case 5:
- left = right = line = ' ';
- break;
- case 4:
- default:
- left = '+';
- right = '+';
- line = '-';
- break;
- }
-
- if (bx > 80) bx = 80;
- if (y > 25) y = 25;
- if (bx < 1 ) bx = 1;
- if (y < 1 ) y = 1;
- if (ex > 80) ex = 80;
- if (ex < 1 ) ex = 1;
-
- #ifndef BIOS
- #ifdef CPRINTF
- cprintf("%c[%d;%dH%c", 27, y, bx, left);
- cprintf("%c[%d;%dH%c", 27, y, ex, right);
- for (n = bx+1; n < ex; n++)
- cprintf("%c", line);
- #else
- printf("%c[%d;%dH%c", 27, y, bx, left);
- printf("%c[%d;%dH%c", 27, y, ex, right);
- for (n = bx+1; n < ex; n++)
- printf("%c", line);
- #endif
- #else
- attr = 7;
- if ((attrib & 0x01) != 0) /* Bold */
- attr |= 0x08;
- if ((attrib & 0x18) != 0) /* Blink */
- attr |= 0x80;
- if ((attrib & 0x20) != 0) /* Reverse video */
- {
- attr &= 0xf8;
- attr |= 0x70;
- }
-
- wrbiosch(y-1, bx-1, left, 1, attr); /* left side */
- wrbiosch(y-1, ex-1, right, 1, attr); /* right side */
- wrbiosch(y-1, bx, line, ex-bx-1, attr); /* line */
- #endif
- }
-