home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c222 / 1.ddi / DEMOS / CO_TEST.C next >
Encoding:
C/C++ Source or Header  |  1990-05-22  |  2.8 KB  |  94 lines

  1. /*********************
  2.  *
  3.  *  co_test.c - console test program.
  4.  *
  5.  *  Purpose: This program will test the ANSI console functions in
  6.  *           the blackstar C library.
  7.  *
  8.  *  Blackstar C Function Library
  9.  *  (c) Copyright 1985 Sterling Castle Software
  10.  *
  11.  *******/
  12.  
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include "blackstr.h"
  16. #include "kb_head.h"
  17. #include "co_head.h"
  18. #include "sc_head.h"
  19.  
  20. char buf[] = "now's the time for all good men      ";
  21.  
  22. void main(int argc, char *argv[])
  23. {
  24.     int i,j;
  25.     char *name = buf;
  26.  
  27.     /*******************************************************************
  28.      FIRST INITIALIZE THE ANSI DRIVE FOR AN IBM CONSOLE AND
  29.      OUTPUT CHARACTERS WITH ATTRIBUTES
  30.     *******************************************************************/
  31.     co_init(0);             /* ibm console */
  32.     co_mode(BW80,FWHITE,BBLACK);
  33.     co_clr();               /* clear screen */
  34.     co_curset(5,24);
  35.     co_puts("\n\r Hit key for ansi driver test..");
  36.     kb_getchar();
  37.     co_clr();
  38.     co_curset(6,24);
  39.     co_puts("\n\r Attribute test 1");
  40.     co_curset(5,1);
  41.     co_puts("\n\rThis line in regular ");
  42.     co_attr(AT_BOLD);
  43.     co_puts("\n\rThis line in BOLD");
  44.     co_attr(AT_US);
  45.     co_puts("\n\rThis line Underscored (Mono only)");
  46.     co_attr(AT_REV);
  47.     co_puts("\n\rThis line Reverse Video");
  48.     co_attr(AT_BLINK);
  49.     co_puts("\n\rThis line Blinking");
  50.     co_attr(AT_CANC);
  51.     co_puts("\n\rThis line Invisible");
  52.     co_attr(AT_REG);
  53.     co_puts("\n\rThis line regular (above line invisible)");
  54.     co_curset(5,24);
  55.     co_puts("Strike any key to continue...");
  56.     kb_tpause(500);
  57.  
  58.     /******************************************************************
  59.      NOW CLEAR THE SCREEN AND PRINT BANDS OF COLORS FOR THE MONITOR
  60.     ******************************************************************/
  61.     co_clr();
  62.     co_mode(CO80,FWHITE,BBLUE);
  63.     co_curset(5,1);
  64.     for(i=10 ; i<18; ++i) {
  65.     for(j=0; j<8; ++j) {
  66.         co_color(i,j);
  67.         co_eeol();
  68.         co_puts("\n\r Another color combination ");
  69.         kb_tpause(25);
  70.     }
  71.     }
  72.  
  73.     /******************************************************************
  74.      NOW DO THE PSUEDO PRINTF FUNCTIONS TEST
  75.     ******************************************************************/
  76.     co_mode(BW80,FWHITE,BBLACK);
  77.     sc_init(2,0,7);
  78.     sc_puts("Console test:\n\n");
  79.     sc_puts("\nTest of printf and scanf...");
  80.     sc_printf("\nprintf: %s %d,%d", argv[0], 2, 4);
  81.     sc_printf("\nInput string for scanf...");
  82.     echof_ = TRUE;
  83.     kb_scanf("%s",name);
  84.     sc_printf("\n\nScanned input string: %s ",name);
  85.  
  86.     sc_color(WHITE,BLUE);
  87.     sc_setcur(0,22);  sc_eeol();
  88.     sc_puts("END OF TEST - Press any key to exit...");
  89.  
  90.     kb_getc();
  91.     sc_color(WHITE,BLACK);
  92.     sc_clr();
  93.     }
  94.