home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * co_test.c - console test program.
- *
- * Purpose: This program will test the ANSI console functions in
- * the blackstar C library.
- *
- * Blackstar C Function Library
- * (c) Copyright 1985 Sterling Castle Software
- *
- *******/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include "blackstr.h"
- #include "kb_head.h"
- #include "co_head.h"
- #include "sc_head.h"
-
- char buf[] = "now's the time for all good men ";
-
- void main(int argc, char *argv[])
- {
- int i,j;
- char *name = buf;
-
- /*******************************************************************
- FIRST INITIALIZE THE ANSI DRIVE FOR AN IBM CONSOLE AND
- OUTPUT CHARACTERS WITH ATTRIBUTES
- *******************************************************************/
- co_init(0); /* ibm console */
- co_mode(BW80,FWHITE,BBLACK);
- co_clr(); /* clear screen */
- co_curset(5,24);
- co_puts("\n\r Hit key for ansi driver test..");
- kb_getchar();
- co_clr();
- co_curset(6,24);
- co_puts("\n\r Attribute test 1");
- co_curset(5,1);
- co_puts("\n\rThis line in regular ");
- co_attr(AT_BOLD);
- co_puts("\n\rThis line in BOLD");
- co_attr(AT_US);
- co_puts("\n\rThis line Underscored (Mono only)");
- co_attr(AT_REV);
- co_puts("\n\rThis line Reverse Video");
- co_attr(AT_BLINK);
- co_puts("\n\rThis line Blinking");
- co_attr(AT_CANC);
- co_puts("\n\rThis line Invisible");
- co_attr(AT_REG);
- co_puts("\n\rThis line regular (above line invisible)");
- co_curset(5,24);
- co_puts("Strike any key to continue...");
- kb_tpause(500);
-
- /******************************************************************
- NOW CLEAR THE SCREEN AND PRINT BANDS OF COLORS FOR THE MONITOR
- ******************************************************************/
- co_clr();
- co_mode(CO80,FWHITE,BBLUE);
- co_curset(5,1);
- for(i=10 ; i<18; ++i) {
- for(j=0; j<8; ++j) {
- co_color(i,j);
- co_eeol();
- co_puts("\n\r Another color combination ");
- kb_tpause(25);
- }
- }
-
- /******************************************************************
- NOW DO THE PSUEDO PRINTF FUNCTIONS TEST
- ******************************************************************/
- co_mode(BW80,FWHITE,BBLACK);
- sc_init(2,0,7);
- sc_puts("Console test:\n\n");
- sc_puts("\nTest of printf and scanf...");
- sc_printf("\nprintf: %s %d,%d", argv[0], 2, 4);
- sc_printf("\nInput string for scanf...");
- echof_ = TRUE;
- kb_scanf("%s",name);
- sc_printf("\n\nScanned input string: %s ",name);
-
- sc_color(WHITE,BLUE);
- sc_setcur(0,22); sc_eeol();
- sc_puts("END OF TEST - Press any key to exit...");
-
- kb_getc();
- sc_color(WHITE,BLACK);
- sc_clr();
- }
-