home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * sc_test2.c - screen functions test program.
- *
- * Purpose: This file contains functions to test the screen
- * functions. See also sc_test1.c .
- *
- * Blackstar C Function Library
- * (c) Copyright 1985 Sterling Castle Software
- *
- *******/
-
- #include <stdio.h>
- #include "blackstr.h"
- #include "sc_head.h"
-
- void main()
-
- {
- int i;
- long l;
-
- /********************************************
- INITIALIZE AND TELL WHAT'S TESTED
- ********************************************/
- kb_init(NULL,NULL,NULL);
- sc_init(MO_CO80,BLUE,WHITE); /* init screen to: Color */
- /* 80x25 */
- /* foreground = blue */
- /* background = white */
-
- sc_setcur(0,0); sc_eeol();
- sc_setcur(28,0);
- sc_puts("Hello from screen test 2");
-
- sc_setcur(0,2); sc_eeol();
- sc_setcur(0,2);
- sc_puts("Phase 1 - Functions tested: sc_setcur(), sc_movcur(), sc_cursor(), sc_putsv()");
-
- sc_setcur(10,7);
-
- /********************************
- TURN CURSOR OFF AND ON
- ********************************/
- sc_puts("Turn cursor off and on");
- sc_movcur(2,0);
- for (i = 0; i < 4; i++) {
- if ((i%2) == 0) {
- sc_setcur(34,7);
- sc_puts(" [ ] ON ");
- sc_setcur(36,7);
- sc_cursor(1); /* Turn cursor on */
- }
- else {
- sc_setcur(34,7);
- sc_puts(" [ ] OFF");
- sc_setcur(36,7);
- sc_cursor(0); /* Turn cursor off */
- }
- for (l = 0; l < 30000; l++); /* Kill a little time */
- }
- sc_cursor(1); /* Turn cursor on again */
-
- sc_setcur(60,7);
- sc_putsv("Vertical chars");
-
- sc_setcur(0,23);
- sc_puts("Press any key to continue...");
- kb_getc();
-
- /**********************************
- CLEAR AND TEST PUT FUNCTIONS
- **********************************/
- sc_clr();
- sc_color(WHITE,BLUE);
- sc_setcur(0,0); sc_eeol();
- sc_setcur(0,0);
- sc_puts("Phase 2 - Functions tested: sc_putl(), sc_putc() with TABs");
-
- sc_setcur(0,5);
- sc_putl("This is a line with an embedded <CR>\r - ignore it\n");
- sc_setcur(0,7);
- sc_puts(" 1 2 3 4 5 6");
- sc_setcur(0,8);
- sc_puts("0123456789012345678901234567890123456789012345678901234567890");
- sc_setcur(0,9);
- sc_puts("This line has 4 embedded TABs\t#1\t#2\t#3\t#4");
-
- sc_setcur(0,23);
- sc_puts("Press any key to continue...");
- kb_getc();
-
- /**************************************
- NOW TEST GETCH AND PRINTF ALIAS
- ***************************************/
- sc_clr();
- sc_color(WHITE,BLUE);
- sc_setcur(0,0); sc_eeol();
- sc_setcur(0,0);
- sc_puts("Phase 3 - Functions tested: sc_getch(), sc_printf()");
-
- sc_setcur(10,5);
- sc_puts("Test line 1");
- sc_setcur(30,7);
- sc_puts("Test line 2");
-
- sc_setcur(0,9);
- sc_printf("Col Row Char Hex\n\r--- --- ---- ----\n\r");
- i = sc_getch(11,5);
- sc_printf(" 11 5 %c [%02x]\n\r", i, i);
- i = sc_getch(20,5);
- sc_printf(" 20 5 %c [%02x]\n\r", i, i);
- i = sc_getch(33,7);
- sc_printf(" 33 7 %c [%02x]\n\r", i, i);
- i = sc_getch(40,7);
- sc_printf(" 40 7 %c [%02x]\n\r", i, i);
-
- sc_setcur(0,23);
- sc_puts("Press any key to continue...");
- kb_getc();
-
- /***************************
- SHOW PUTS OPTIONS
- ****************************/
- sc_clr();
- sc_color(WHITE,BLUE);
- sc_setcur(0,0); sc_eeol();
- sc_setcur(0,0);
- sc_puts("Phase 4 - Functions tested: sc_puts()");
-
- sc_box(29,4,61,16);
- sc_windo(30,5,60,15);
- sc_setcur(30,15);
- sc_puts("Line of text written using sc_puts() with wrap and scroll ON");
-
- sc_windo(0,0,sc_cols_-1,sc_rows_-1);
- sc_color(WHITE,BLUE);
- sc_setcur(0,22); sc_eeol();
- sc_puts("END OF TEST - Press any key to exit...");
- sc_color(WHITE,BLACK);
- kb_getc();
- sc_clr();
- }
-