home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c222 / 1.ddi / DEMOS / TX_TEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-17  |  2.6 KB  |  79 lines

  1. /*********************
  2.  *
  3.  *  tx_test.c - text test program.
  4.  *
  5.  *  Purpose: This file contains tests of the text functions.
  6.  *
  7.  *  Blackstar C Function Library
  8.  *  (c) Copyright 1985 Sterling Castle Software
  9.  *
  10.  *******/
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include "blackstr.h"
  15. #include "kb_head.h"
  16. #include "pr_head.h"
  17. #include "sc_head.h"
  18. #include "ut_head.h"
  19. #include "tx_head.h"
  20.  
  21. char *tbuffer = "We acknowledge that we are not self-made, but God-made.\
  22.   And we thank God for building into us the talents that made it \
  23. possible for us to create High C.  Yet all defects are attributable \
  24. to our imperfect, fallen human nature.  Praise God, from whom all \
  25. blessings flow.";
  26.  
  27. struct MESG tmesg;
  28.  
  29. void main() {
  30.     char *ptr;
  31.  
  32.     /***************************************************************
  33.      INITIALIZE THE SCREEN AND SAY HELLO
  34.     ***************************************************************/
  35.     sc_init(MO_CO80,BLUE,WHITE);      
  36.     sc_puts("Hello from tx_test.");
  37.     sc_windo(5,4,25,10);
  38.     sc_clr();
  39.     sc_setcur(0,0);
  40.  
  41.     /***********************************************************************
  42.      NOW PUT A LINE AT A TIME INTO THE WINDOW TO SEE WRAPPING,ETC.
  43.     ***********************************************************************/
  44.     tx_putl("High C was designed to facilitate serious professional");
  45.     tx_putl("programming, and it is available on numerous processors.");
  46.     tx_putl("High C supports the ANSI Standard");
  47.     tx_putl("(ANSI document X3.159-1989) and several extensions");
  48.     tx_putl("...strike key to continue");
  49.     kb_getc();
  50.  
  51.     /***********************************************************************
  52.      NOW USE THE TX_MESG FUNCTION AND ASSOCIATED STRUCTURE TO OUTPUT
  53.      THE WHOLE BUFFER AT A TIME TO THE WINDOW
  54.     ***********************************************************************/
  55.     tmesg.col1=tmesg.row1=5;
  56.     tmesg.col2=45;
  57.     tmesg.row2=9;
  58.     tmesg.text = tbuffer;
  59.  
  60.     /*******************************************
  61.      SAVE AND RESTORE A MENU WINDO   ON SCREEN
  62.     *******************************************/
  63.     ptr = sc_getwin(tmesg.col1-1,tmesg.row1-1,tmesg.col2+1,tmesg.row2+1);
  64.     tx_mesg(&tmesg);
  65.     sc_winfull();
  66.     sc_setcur(0,22);
  67.     tx_putl("Push key to restore text windo...");
  68.     kb_getc();
  69.     sc_putwin(ptr,tmesg.col1-1,tmesg.row1-1,tmesg.col2+1,tmesg.row2+1);
  70.     free(ptr);
  71.  
  72.     sc_color(WHITE,BLUE);
  73.     sc_setcur(0,22);  sc_eeol();
  74.     sc_puts("END OF TEST - Press any key to exit...");
  75.     kb_getc();
  76.     sc_color(WHITE,BLACK);
  77.     sc_scroll(-1,0,0,79,23);
  78.     }
  79.