home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 324_01 / wgconio.doc < prev    next >
Text File  |  1990-07-17  |  57KB  |  1,651 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. /*
  8.    HEADER:          ;
  9.    TITLE:           Documentation for WGCONIO;
  10.    DATE:            07/17/1990;
  11.    FILENAME:        WGCONIO.DOC;
  12.    SEE-ALSO:        wgconio.c,wgconio.lib,wgconio.h;
  13.    AUTHORS:         Bill Giel;
  14. */
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                                                         1
  71.  
  72.  
  73.                                           
  74.                                       WGCONIO
  75.                               A Text Windowing System
  76.                                           
  77.                                           
  78.                                     by Bill Giel
  79.                                  40 Briarwood Lane
  80.                              Milford, Connecticut 06460
  81.                                    (203) 877-9438
  82.                                           
  83.                                           
  84.                                           
  85.                                 General Information
  86.             
  87.             WGCONIO was  designed to  emulate the Turbo C v2.0 (TC) text
  88.             window functions  for PC  compatible computers under the MS-
  89.             DOS operating  system.  Most major functions are duplicated,
  90.             and a few have been added.
  91.             
  92.             WGCONIO grew  out  of  the  author's  experiments  with  TSR
  93.             programs.    Rather  than  adopt  an  entirely  new  set  of
  94.             unfamiliar  windowing   functions,  these   functions   were
  95.             developed to  be called  the same  way as  the  standard  TC
  96.             functions.     They  have   the  same   names  as  their  TC
  97.             counterparts, with  the exception  that the  prefix "wg" has
  98.             been added.
  99.             
  100.             In addition to anyone trying to develop TSR's using Turbo C,
  101.             these functions  should be  useful if compiling code written
  102.             for TC  on a  compiler that  does not  support the  TC  text
  103.             window functions.
  104.             
  105.             For those  who wish  to modify  and recompile  WGCONIO.C, be
  106.             advised that  a  number  of  functions  call  int86().  This
  107.             function is  available with  TC and Microsoft C, but may not
  108.             have the  same name  with other  compilers.  In  this  case,
  109.             replace 'int86'  with the  name of the function supported on
  110.             the particular compiler.
  111.             
  112.             While the  WGCONIO functions  are not intended to comprise a
  113.             complete window  tool kit,  they could  provide the building
  114.             blocks for such a system.
  115.             
  116.             
  117.                                    WGCONIO Files
  118.             
  119.             WGCONIO.H  is   an  "include"   file,  that  prototypes  the
  120.             functions of  the WGCONIO system, declares needed structures
  121.             and  defines   symbolic  constants  for  screen  colors  and
  122.             scrolling directions.
  123.             
  124.             WGCONIO.LIB is  a small  model library  file of  the WGCONIO
  125.             functions, which  was created using TLIB. It should be named
  126.             when linking  a program  that uses the WGCONIO functions, or
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                                                         2
  137.  
  138.  
  139.             made a  part of  a project  file if  using the TC integrated
  140.             development environment, or similar system.
  141.             
  142.             WGCONIO.C is  the source  code from  which  WGCONIO.LIB  was
  143.             created.
  144.             
  145.             SAMPLE.EXE is  a short  program that  demonstrates  how  the
  146.             window functions  are used,  by creating six pop-up windows,
  147.             and then removing them, one by one.
  148.             
  149.             SAMPLE.C is the source code for the SAMPLE.EXE program.
  150.             
  151.             In the  listing of SAMPLE.C, please note that when compiling
  152.             files that  include WGCONIO.H,  a  symbolic  constant  named
  153.             MAIN_MODULE must  be  defined  in  the  first  source  file.
  154.             MAIN_MODULE should not be defined in subsequent modules.
  155.             
  156.             Also note  that the  function  initiallize_WGW()  is  called
  157.             early in  main(), to  ensure that  the windowing  system  is
  158.             initiallized.
  159.             
  160.             
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                                         3
  203.  
  204.  
  205.                            THE WGCONIO LIBRARY FUNCTIONS
  206.             ------------------------------------------------------------
  207.             box
  208.             
  209.             Name         box - prints a double-line box on the screen.
  210.             
  211.             Usage        void box(int width, int height);
  212.             
  213.             Related
  214.             Functions    void box2(int width, int height);
  215.             
  216.             Description  box places  a double-line  border  width  units
  217.                          wide and  height units  down from  the  current
  218.                          cursor position.
  219.             
  220.                          box2 performs the same function, only a single-
  221.                          line border is displayed, rather than a double-
  222.                          line.
  223.             
  224.             
  225.             
  226.             ------------------------------------------------------------
  227.             box2
  228.             
  229.             Name         box2 - prints a single-line box on the screen.
  230.             
  231.             Usage        void box2(int width, int height);
  232.             
  233.             Related
  234.             Functions    void box(int width, int height);
  235.             
  236.             Description  See box.
  237.             
  238.             
  239.             
  240.             ------------------------------------------------------------
  241.             cursor_off
  242.             
  243.             Name         cursor_off - hides the cursor.
  244.             
  245.             Usage        void cursor_off(void);
  246.             
  247.             Description  Turns the cursor off.
  248.             
  249.             See also     size_cursor().
  250.             
  251.             
  252.             
  253.             ------------------------------------------------------------
  254.             get_attrib
  255.             
  256.             Name         get_attrib  -   gets  the   current  attribute,
  257.                          forground color and background color.
  258.             
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                                                         4
  269.  
  270.  
  271.             Usage        void  get_attribute(unsigned  char  *attribute,
  272.                          unsigned  char   *foreground,   unsigned   char
  273.                          *background);
  274.             
  275.             Description  This function  assigns the  current  attribute,
  276.                          foreground color  and background  color to  the
  277.                          variables pointed  to by  attribute, foreground
  278.                          and background.
  279.             
  280.             
  281.             
  282.             ------------------------------------------------------------
  283.             get_cursor_pos
  284.             
  285.             Name         get_cursor_pos -  gets current  screen-relative
  286.                          cursor position.
  287.             
  288.             Usage        void get_cursor_pos(unsigned  char  *x,unsigned
  289.                          char *y);
  290.             
  291.             Description  This  function   assigns  the  current  screen-
  292.                          relative  cursor   position  to  the  variables
  293.                          pointed to by x and y.
  294.             
  295.                          wgwherex and  wgwherey find the window relative
  296.                          coordinates  of   the  current   cursor.   This
  297.                          function is  similar, only it finds the screen-
  298.                          relative coordinates.
  299.             
  300.             
  301.             
  302.             ------------------------------------------------------------
  303.             get_cursor_size
  304.             
  305.             Name         get_cursor_size  -   gets  the  current  cursor
  306.                          configuration.
  307.             
  308.             Usage        void   get_cursor_size(unsigned    char    *ch,
  309.                          unsigned char *cl);
  310.             
  311.             Description  get_cursor_size  assigns   the  current  cursor
  312.                          starting  and   ending  scan   lines  into  the
  313.                          variables   pointed    to   by   ch   and   cl,
  314.                          respectively.
  315.             
  316.             See also     cursor_off(), size_cursor();
  317.             
  318.             
  319.             
  320.             ------------------------------------------------------------
  321.             get_keycode
  322.             
  323.             Name         get_keycode - returns the 16-bit scan code of a
  324.                          key.
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                                         5
  335.  
  336.  
  337.             
  338.             Usage        int get_keycode(void);
  339.             
  340.             Description  This function  waits for a keypress and returns
  341.                          the 16-bit scan code of the key.
  342.             
  343.             See also     wggetch(),wggetche().
  344.             
  345.             
  346.             
  347.             ------------------------------------------------------------
  348.             get_video_mode
  349.             
  350.             Name         get_video_mode  -  returns  the  current  video
  351.                          mode.
  352.             
  353.             Usage        int get_video_mode(void);
  354.             
  355.             Description  This function returns the current video mode of
  356.                          the display  adapter. The following table lists
  357.                          screen modes available for various adapters.
  358.             
  359.                     Mode   Type                Dimensions     Adapter
  360.                     ----   ----                ----------     -------
  361.                     0      text,b/w            40x25          CGA,EGA
  362.                     1      text,16 colors      40x25          CGA,EGA
  363.                     2      text,b/w            80x25          CGA,EGA
  364.                     3      text,16 colors      80x25          CGA,EGA
  365.                     4      graphics,4 colors   320x200        CGA,EGA
  366.                     5      graphics,4 grays    320x200        CGA,EGA
  367.                     6      graphics.b/w        640x200        CGA,EGA
  368.                     7      text.b/w            80x25          monochrome
  369.                     8      graphics,16 colors  160x200        PCjr
  370.                     9      graphics,16 colors  320x200        PCjr
  371.                     10     graphics,4 colors   640x200        PCjr
  372.                            graphics,16 colors  640x200        EGA
  373.                     13     graphics,16 colors  320x200        EGA
  374.                     14     graphics,16 colors  640x200        EGA
  375.                     15     graphics,4 colors   640x350        EGA
  376.             
  377.             Return
  378.             Value        Returns an  integer  that  corresponds  to  the
  379.                          current video mode.
  380.             
  381.             
  382.             
  383.             ------------------------------------------------------------
  384.             initiallize_WGW
  385.             
  386.             Name         initiallize_WGW - initiallizes window system.
  387.             
  388.             Usage        void initiallize_WGW(void);
  389.             
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                                                         6
  401.  
  402.  
  403.             Description  This function  must be called before using this
  404.                          alternative text  windowing system.  It  places
  405.                          the initial  values used by the system into the
  406.                          global  structure   WGW  of   type  wgtext_info
  407.                          (defined in WGCONIO.H)
  408.             
  409.                          struct wgtext_info{
  410.                                 unsigned char winleft;
  411.                                 unsigned char wintop;
  412.                                 unsigned char winright;
  413.                                 unsigned char winbottom;
  414.                                 unsigned char attribute;
  415.                                 unsigned char currmode;
  416.                                 unsigned char screenheight;
  417.                                 unsigned char screenwidth;
  418.                                 unsigned char curx;
  419.                                 unsigned char cury;
  420.                                 unsigned char foreground;
  421.                                 unsigned char background;
  422.                          }WGW;
  423.                          
  424.                          wgtext_info is  slightly different  from its TC
  425.                          counterpart   (text_info).   winleft,   wintop,
  426.                          winright  and winbottom are the screen relative
  427.                          limits of the current text window. attribute is
  428.                          the current  text attribute.  currmode  is  the
  429.                          current text mode. screenheight and screenwidth
  430.                          define the  size of the current screen, i.e. 25
  431.                          and 80.  curx and  cury are the current window-
  432.                          relative coordinates  of the cursor. foreground
  433.                          and background  are the  current foreground and
  434.                          background text colors.
  435.             
  436.                          When initiallized, the default text window is a
  437.                          full screen (1,1,80,25 for 80-column modes, and
  438.                          1,1,40,25 for 40-column modes).
  439.             
  440.                          In  addition  to  filling  in  the  wgtext_info
  441.                          structure, a  second global  structure  WGV  is
  442.                          initiallized which  is primarily  used  by  the
  443.                          system.   This   is   a   structure   of   type
  444.                          wgvid_parameters.
  445.             
  446.                          struct wgvid_parameters{
  447.                                 unsigned char textline;
  448.                                 unsigned char textbytes;
  449.                                 char far *vid_mem;
  450.                          }WGV;
  451.             
  452.                          textline is  the number of bytes needed to save
  453.                          a  full  line  of  text  (  2  bytes  for  each
  454.                          character, or  160 bytes in an 80-column mode).
  455.                          textchar is  the number of bytes needed to save
  456.                          a character (typically 1 byte for the character
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                                                         7
  467.  
  468.  
  469.                          and 1  byte for  the attribute).  vid_mem is  a
  470.                          pointer  to   the  starting  address  of  video
  471.                          memory.
  472.             
  473.                          The function  will determine  the beginning  of
  474.                          video memory,  depending on  the text mode when
  475.                          initiallized.
  476.             
  477.                          By default,  output goes  directly to the video
  478.                          hardware. However,  output can also be directed
  479.                          through the  BIOS by  changing the value of the
  480.                          global  variable  wg_directvideo  (declared  in
  481.                          WGCONIO.H) to 0. By default, the value is 1 for
  482.                          direct video  output. Using BIOS output results
  483.                          in considerably slower response.
  484.             
  485.             
  486.             
  487.             ------------------------------------------------------------
  488.             make_window
  489.             
  490.             Name         make_window - makes a bordered, titled window.
  491.             
  492.             Usage        char *make_window(char *title, struct wgwind w,
  493.                          struct wgtext_info *t, int shadow_flag);
  494.             
  495.             Related
  496.             Function     void  restore_screen(struct   wgwind  w,   char
  497.                          *text_buf,   struct    wgtext_info    t,    int
  498.                          shadow_flag);
  499.             
  500.             Description  make_window creates  a window  with an optional
  501.                          centered title, border and shadow.
  502.             
  503.                          The window  colors and size are passed in w, of
  504.                          type struct wgwind (defined in WGCONIO.H).
  505.             
  506.                  struct wgwind{
  507.                          unsigned char foreborder;/*border foreground*/
  508.                          unsigned char backborder;/*border background*/
  509.                          unsigned char foretitle;/*title foreground*/
  510.                          unsigned char backtitle;/*title background*/
  511.                          unsigned char foreground;/*text foreground*/
  512.                          unsigned char background;/*text background*/
  513.                          unsigned char leftlim;/*left boundary*/
  514.                          unsigned char toplim;/*top boundary*/
  515.                          unsigned char rightlim;/*right boundary*/
  516.                          unsigned char bottomlim;/*bottom boundary*/
  517.                  };
  518.             
  519.                          The function  will save  the underlying portion
  520.                          of  the   screen  to  a  dynamically  allocated
  521.                          portion of memory.
  522.             
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                                                         8
  533.  
  534.  
  535.                          The previous  status of the text screen will be
  536.                          assigned to  a structure  of  type  wgtext_info
  537.                          (defined in WGCONIO.H) pointed to by t.
  538.             
  539.                  struct wgtext_info{
  540.                          unsigned char winleft;
  541.                          unsigned char wintop;
  542.                          unsigned char winright;
  543.                          unsigned char winbottom;
  544.                          unsigned char attribute;
  545.                          unsigned char currmode;
  546.                          unsigned char screenheight;
  547.                          unsigned char screenwidth;
  548.                          unsigned char curx;
  549.                          unsigned char cury;
  550.                          unsigned char foreground;
  551.                          unsigned char background;
  552.                  };
  553.             
  554.                          The title  can be  bypassed by  sending a  null
  555.                          string for *title.
  556.             
  557.                          Shadows can  be turned  on or  off  by  passing
  558.                          SHADOW or  NO_SHADOW (defined in WGCONIO.H) for
  559.                          shadow_flag.
  560.             
  561.                          restore_screen removes  the window,  frees  the
  562.                          allocated  memory,   restores  the   underlying
  563.                          portion  of   the  screen   to   its   previous
  564.                          condition, and resets the status of the current
  565.                          window to  what  it  was  before  the  call  to
  566.                          make_window. If  a  shadowed  window  is  being
  567.                          cleared,  then   the  appropriate   value   for
  568.                          shadow_flag must be passed (the same value used
  569.                          when the window was created).
  570.             
  571.             
  572.             Return
  573.             Value        If successful, make_window returns a pointer to
  574.                          the portion  of  memory  where  the  underlying
  575.                          portion of the screen is saved. If unsuccessful
  576.                          (invalid coordinates,  allocation failure)  the
  577.                          function returns 0.
  578.             
  579.             Example      #include"wgconio.h"
  580.                          
  581.                          main()
  582.                          {
  583.                            struct wgwind w0= {YELLOW, BLUE, WHITE,       
  584.                                                BLUE, LIGHTGRAY, BLUE, 5,
  585.                                               5,75, 20};
  586.                            char *p0;
  587.                            struct wgtext_info t0;
  588.             
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                                                         9
  599.  
  600.  
  601.                            initiallize_WGW();
  602.             
  603.                            p0=make_window("TEST WINDOW",w0,&t0,SHADOW);
  604.             
  605.                            if(!p0){
  606.                               printf("\nError creating window\n");
  607.                               exit(1);
  608.                            }
  609.             
  610.                            /* ... */
  611.             
  612.                            restore_screen(w0,p0,t0,SHADOW);
  613.                          }
  614.             
  615.             
  616.             
  617.             ------------------------------------------------------------
  618.             make_shadow
  619.             
  620.             Name         make_shadow - created a shaded area on the text
  621.                          screen.
  622.             
  623.             Usage        int make_shadow(int  left, int  top, int right,
  624.                          int bottom);
  625.             
  626.             Description  make_shadow creates  a shaded  portion  of  the
  627.                          screen,  defined   by  an   upper  left  corner
  628.                          (left,top)  and   lower  right  corner  (right,
  629.                          bottom).
  630.             
  631.                          left, top, right and bottom are screen-relative
  632.                          coordinates.
  633.             
  634.             See also     make_window().
  635.             
  636.             
  637.             
  638.             ------------------------------------------------------------
  639.             make_tsr_window
  640.             
  641.             Name         make_tsr_window  -  makes  a  bordered,  titled
  642.                          window.
  643.             
  644.             Usage        char *make_window(char *title, struct wgwind w,
  645.                          struct wgtext_info *t,char *buf);
  646.             
  647.             Related
  648.             Function     void restore_tsr_screen(struct  wgwind w,  char
  649.                          *text_buf, struct wgtext_info t);
  650.             
  651.             Description  make_tsr_window  creates   a  window   with  an
  652.                          optional centered title and border.
  653.             
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                                                         10
  665.  
  666.  
  667.                          Unlike  make_window,  this  function  does  not
  668.                          invoke malloc().  The contents  of  the  screen
  669.                          underlying the window are saved to a statically
  670.                          declared text buffer buf.
  671.             
  672.                          The window  colors and size are passed in w, of
  673.                          type struct wgwind (defined in WGCONIO.H).
  674.             
  675.                  struct wgwind{
  676.                          unsigned char foreborder;/*border foreground*/
  677.                          unsigned char backborder;/*border background*/
  678.                          unsigned char foretitle;/*title foreground*/
  679.                          unsigned char backtitle;/*title background*/
  680.                          unsigned char foreground;/*text foreground*/
  681.                          unsigned char background;/*text background*/
  682.                          unsigned char leftlim;/*left boundary*/
  683.                          unsigned char toplim;/*top boundary*/
  684.                          unsigned char rightlim;/*right boundary*/
  685.                          unsigned char bottomlim;/*bottom boundary*/
  686.                  };
  687.             
  688.                          The function  will save  the underlying portion
  689.                          of the  screen to  buf. This should be declared
  690.                          with a  sufficient size to hold the contents of
  691.                          the screen underlying the window.
  692.             
  693.                          The previous  status of the text screen will be
  694.                          assigned to  a structure  of  type  wgtext_info
  695.                          (defined in WGCONIO.H) pointed to by t.
  696.             
  697.                  struct wgtext_info{
  698.                          unsigned char winleft;
  699.                          unsigned char wintop;
  700.                          unsigned char winright;
  701.                          unsigned char winbottom;
  702.                          unsigned char attribute;
  703.                          unsigned char currmode;
  704.                          unsigned char screenheight;
  705.                          unsigned char screenwidth;
  706.                          unsigned char curx;
  707.                          unsigned char cury;
  708.                          unsigned char foreground;
  709.                          unsigned char background;
  710.                  };
  711.             
  712.                          The title  can be  bypassed by  sending a  null
  713.                          string for *title.
  714.             
  715.                          restore_tsr_screen removes the window, restores
  716.                          the underlying  portion of  the screen  to  its
  717.                          previous condition,  and resets  the status  of
  718.                          the current  window to  what it  was before the
  719.                          call to make_tsr_window.
  720.             
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                                                         11
  731.  
  732.  
  733.             
  734.             Return
  735.             Value        If  successful,   make_tsr_window   returns   a
  736.                          pointer  to   buf.  If   unsuccessful  (invalid
  737.                          coordinates) the function returns 0.
  738.             
  739.             Example      #include"wgconio.h"
  740.                          
  741.                          main()
  742.                          {
  743.                            struct wgwind w0= {YELLOW, BLUE, WHITE,       
  744.                                 BLUE, LIGHTGRAY, BLUE, 5, 5,
  745.                                 75, 20};
  746.                            char buf[2272];
  747.                            struct wgtext_info t0;
  748.             
  749.                            initiallize_WGW();
  750.             
  751.                            make_tsr_window("TEST WINDOW",w0,&t0,buf);
  752.             
  753.                            /* ... */
  754.             
  755.                            restore_tsr_screen(w0,p0,t0);
  756.                          }
  757.             
  758.             
  759.             
  760.             ------------------------------------------------------------
  761.             restore_screen
  762.             
  763.             Name         restore_screen - restores underlying screen and
  764.                          window status after a call to make_window.
  765.             
  766.             Usage        void  restore_screen(struct   wgwind  w,   char
  767.                          *text_buf,     struct     wgtext_info     t,int
  768.                          shadow_flag);
  769.             
  770.             Related
  771.             Functions    char *make_window(char *title, struct wgwind w,
  772.                          struct wgtext_info *t);
  773.             
  774.             Description  See make_window.
  775.             
  776.             
  777.             
  778.             ------------------------------------------------------------
  779.             restore_tsr_screen
  780.             
  781.             Name         restore_tsr_screen - restores underlying screen
  782.                          and   window    status   after    a   call   to
  783.                          make_tsr_window.
  784.             
  785.             Usage        void restore_tsr_screen(struct  wgwind w,  char
  786.                          *text_buf, struct wgtext_info t);
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                                                                         12
  797.  
  798.  
  799.             
  800.             Related
  801.             Functions    char   *make_tsr_window(char   *title,   struct
  802.                          wgwind w, struct wgtext_info *t,char *buf);
  803.             
  804.             Description  See make_tsr_window.
  805.             
  806.             
  807.             
  808.             ------------------------------------------------------------
  809.             scroll_window
  810.             
  811.             Name         scroll_window - scrolls a portion of the screen
  812.                          up or down.
  813.             
  814.             Usage        void   scroll_window(unsigned    char   direct,
  815.                          unsigned  char   lines,  unsigned   char   top,
  816.                          unsigned  char   left,  unsigned  char  bottom,
  817.                          unsigned char right, unsigned char attribute);
  818.             
  819.             Description  scroll_window will  scroll  a  portion  of  the
  820.                          screen, defined by corner coordinates top, left
  821.                          and bottom, right in the direction specified by
  822.                          direct (use  UP or DOWN, defined in WGCONIO.H).
  823.                          The number  of lines  to scroll is specified in
  824.                          lines.  The   attribute  of   blank  lines   is
  825.                          specified by attribute.
  826.             
  827.                          The corner coordinates are screen-relative.
  828.             
  829.             See also     movetext(), wg_scroll().
  830.             
  831.             
  832.             
  833.             ------------------------------------------------------------
  834.             size_cursor
  835.             
  836.             Name         size_cursor - changes the cursor size.
  837.             
  838.             Usage        void size_cursor(unsigned  char  start,unsigned
  839.                          char end);
  840.             
  841.             Description  size_cursor   changes    the   current   cursor
  842.                          configuration. On  color systems,  calling  the
  843.                          function with  arguments of  7 and 8 (for start
  844.                          and end)  will produce  the default  cursor. On
  845.                          monochrome systems  (IBM video  mode 7), 12 and
  846.                          13 produce the default cursor.
  847.             
  848.             See also     cursor_off()
  849.             
  850.             
  851.             
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                                                                         13
  863.  
  864.  
  865.             ------------------------------------------------------------
  866.             wgclreol
  867.             
  868.             Name         wgclreol -  clears text from the current cursor
  869.                          position to  the end of the current line within
  870.                          the active text window.
  871.             
  872.             Usage        void wgclreol(void);
  873.             
  874.             Description  This function  clears  text  from  the  current
  875.                          cursor position  to the  end of the line in the
  876.                          active text window. The current cursor position
  877.                          remains where  it was  prior  to  the  call  to
  878.                          wgclreol.
  879.             
  880.             Turbo C
  881.             Equivalent   clreol.
  882.             
  883.             
  884.             
  885.             ------------------------------------------------------------
  886.             wgclrscr
  887.             
  888.             Name         wgclrscr - clears all text from the active text
  889.                          window.
  890.             
  891.             Usage        void wgclrscr(void);
  892.             
  893.             Description  This function  clears all  text from the active
  894.                          window, and  positions the  cursor at the upper
  895.                          left corner (1,1).
  896.             
  897.             Turbo C
  898.             Equivalent   clrscr.
  899.             
  900.             
  901.             
  902.             ------------------------------------------------------------
  903.             wgcprintf
  904.             
  905.             Name         wgcprintf - displays formatted output.
  906.             
  907.             Usage        int wgcprintf(char *format[,argument,...]);
  908.             
  909.             Description  This function  displays formatted output in the
  910.                          current text  window.  '\r'  (carriage  return)
  911.                          will position  the cursor  at the  beginning of
  912.                          the current  line. '\n' (newline) positions the
  913.                          cursor at  the  beginning  of  the  next  line,
  914.                          scrolling up  if necessary. Output will wrap to
  915.                          the next line if the window limit is exceeded.
  916.             
  917.             Turbo C
  918.             Equivalent   cprintf.
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                                                         14
  929.  
  930.  
  931.             
  932.             
  933.             
  934.             ------------------------------------------------------------
  935.             wgcputs
  936.             
  937.             Name         wgcputs -  outputs a text string to the current
  938.                          text window.
  939.             
  940.             Usage        int wgcputs(char *string);
  941.             
  942.             Description  This function is used to write a string of text
  943.                          to the current text window.
  944.             
  945.                          Output begins  at the  current cursor position.
  946.                          If the  text length  exceeds the line length of
  947.                          the window,  the text  will wrap  to  the  next
  948.                          line. The  text in the window will scroll up if
  949.                          the function attempts to wrap beyond the bottom
  950.                          of the window.
  951.             
  952.                          The cursor  advances one  position  after  each
  953.                          character that is written to the window.
  954.             
  955.                          The   '\r'    (carriage    return)    character
  956.                          repositions the  cursor at the beginning of the
  957.                          current line (with no linefeed).
  958.             
  959.                          The '\n'  (newline)  character  repostions  the
  960.                          cursor at  the  beginning  of  the  next  line,
  961.                          scrolling the text in the window up one line if
  962.                          necessary.
  963.             
  964.             Return
  965.             Value        The function returns the last character printed
  966.                          (which might be '\r' or '\n').
  967.             
  968.             Turbo C
  969.             Equivalent   cputs.
  970.             
  971.             
  972.             
  973.             ------------------------------------------------------------
  974.             wgdelline
  975.             
  976.             Name         wgdelline -  deletes the  current line  in  the
  977.                          current text window.
  978.             
  979.             Usage        void wgdelline(void);
  980.             
  981.             Description  This function  deletes the  line containing the
  982.                          cursor (within  the current text window). Lines
  983.                          below scroll up one line.
  984.             
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                                                                         15
  995.  
  996.  
  997.             See also     wgclreol(),wginsline().
  998.             
  999.             Turbo C
  1000.             Equivalent   delline.
  1001.             
  1002.             
  1003.             
  1004.             ------------------------------------------------------------
  1005.             wggetch
  1006.             
  1007.             Name         wggetch -  gets a  character from  the keyboard
  1008.                          (and does not echo to the screen).
  1009.             
  1010.             Usage        int wggetch(void);
  1011.             
  1012.             Related
  1013.             Functions    int wggetche(void);
  1014.             
  1015.             Description  wggetch  waits  until  a  key  is  pressed  and
  1016.                          returns the  character, without  echoing to the
  1017.                          screen.
  1018.             
  1019.                          wggetche waits  until a key is pressed, returns
  1020.                          a character,  and echoes  the character  in the
  1021.                          current text window.
  1022.             
  1023.                          In the  case of extended key codes, wggetch and
  1024.                          wggetche return 0. A second call to wggetch and
  1025.                          wggetche will  return the  second byte  of  the
  1026.                          two-byte code.
  1027.             
  1028.             Turbo C
  1029.             Equivalent   getch.
  1030.             
  1031.             
  1032.             
  1033.             ------------------------------------------------------------
  1034.             wggetche
  1035.             
  1036.             Name         wggetche -  gets a  character from the keyboard
  1037.                          and echoes to the current text window.
  1038.             
  1039.             Usage        int wggetche(void);
  1040.             
  1041.             Related
  1042.             Functions    int wggetch(void);
  1043.             
  1044.             Description  See wggetch.
  1045.             
  1046.             Turbo C
  1047.             Equivalent   getche.
  1048.             
  1049.             
  1050.             
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                                                                         16
  1061.  
  1062.  
  1063.             ------------------------------------------------------------
  1064.             wggettext
  1065.             
  1066.             Name         wggettext -  saves a portion of the text screen
  1067.                          to memory.
  1068.             
  1069.             Usage        int wggettext(int  left,int  top,int  right,int
  1070.                          bottom, char *buf);
  1071.             
  1072.             Related
  1073.             Functions    int wgputtext(int  left,int  top,int  right,int
  1074.                          bottom, char *buf);
  1075.             
  1076.             Description  wggettext copies  a portion  of the text screen
  1077.                          to an area of memory pointed to by buf.
  1078.             
  1079.                          wgputtext restores a portion of the text screen
  1080.                          from an area of memory pointed to by buf.
  1081.             
  1082.                          The arguments  left, top,  right and bottom are
  1083.                          the screen-relative coordinates that define the
  1084.                          upper left  and  lower  right  corners  of  the
  1085.                          rectangular area  to be  saved or  restored (as
  1086.                          opposed to window-relative coordinates).
  1087.             
  1088.                          Each text character requires 2 bytes of memory.
  1089.                          The first  byte stores  the character,  and the
  1090.                          second byte stores the charcter's attribute.
  1091.             
  1092.                          The memory  required to  store a  rectangle  of
  1093.                          text can be calculated from
  1094.             
  1095.                          bytes needed = rows x columns x 2
  1096.                                           
  1097.                          For  example,  the  entire  screen  (1,1,80,25)
  1098.                          requires 80*25*2,  or 4000  bytes of  memory. A
  1099.                          smaller area, say (5,5,75,20) requires 71*16*2,
  1100.                          or 2272 bytes.
  1101.             
  1102.                          Passing invalid  screen coordinates  will cause
  1103.                          the call  to either  function to  fail (and  be
  1104.                          ignored).
  1105.             
  1106.             Return
  1107.             Value        Both of these functions return 1 if successful,
  1108.                          or 0 upon failure.
  1109.             
  1110.             Example      /*declare buffer of sufficient size*/
  1111.                          char screen_buf[2272];
  1112.                          
  1113.                          /*save text*/
  1114.                          wggettext(5,5,75,20,screen_buf);
  1115.             
  1116.                          /*...*/
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                                                                         17
  1127.  
  1128.  
  1129.             
  1130.                          /*restore text*/
  1131.                          wgputtext(5,5,75,20,screen_buf);
  1132.             
  1133.             Turbo C
  1134.             Equivalent   gettext.
  1135.             
  1136.             
  1137.             
  1138.             ------------------------------------------------------------
  1139.             wggettextinfo
  1140.             
  1141.             Name         wggettextinfo  -   saves  current  text  window
  1142.                          status in stucture of type wgtext_info.
  1143.             
  1144.             Usage        void wgtextinfo(struct wgtext_info *inforec);
  1145.             
  1146.             Description  This function  saves the  status of the current
  1147.                          text  window   into   a   structure   of   type
  1148.                          wgtext_info (defined in WGCONIO.H).
  1149.             
  1150.                  struct wgtext_info{
  1151.                          unsigned char winleft;
  1152.                          unsigned char wintop;
  1153.                          unsigned char winright;
  1154.                          unsigned char winbottom;
  1155.                          unsigned char attribute;
  1156.                          unsigned char currmode;
  1157.                          unsigned char screenheight;
  1158.                          unsigned char screenwidth;
  1159.                          unsigned char curx;
  1160.                          unsigned char cury;
  1161.                          unsigned char foreground;
  1162.                          unsigned char background;
  1163.                  };
  1164.             
  1165.             See also     initiallize_WGW()
  1166.             
  1167.             Turbo C
  1168.             Equivalent   gettextinfo.
  1169.             
  1170.             ------------------------------------------------------------
  1171.             wggotoxy
  1172.             
  1173.             Name         wggotoxy -  sets  cursor  position  in  current
  1174.                          active text window.
  1175.             
  1176.             Usage        void wggotoxy(int x, int y);
  1177.             
  1178.             Description  This function  permits setting  the cursor to a
  1179.                          specific  position   within  the   active  text
  1180.                          window.  The  arguments  x  and  y  are  window
  1181.                          relative  coordinates  (as  opposed  to  screen
  1182.                          relative). For  example, the  upper left corner
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                                                                         18
  1193.  
  1194.  
  1195.                          of the  current window  is (1,1), regardless of
  1196.                          where this window appears on the screen.
  1197.             
  1198.                          If invalid  coordinates are  passed,  then  the
  1199.                          call to this function is ignored.
  1200.             
  1201.             Turbo C
  1202.             Equivalent   gotoxy.
  1203.             
  1204.             
  1205.             
  1206.             ------------------------------------------------------------
  1207.             wginsline
  1208.             
  1209.             Name         wginsline -  inserts a line in the current text
  1210.                          window.
  1211.             
  1212.             Usage        void wginsline(void);
  1213.             
  1214.             Description  This function  inserts a blank line at the line
  1215.                          containing the  cursor. Original  lines  scroll
  1216.                          down one line.
  1217.             
  1218.             See also     wgdelline().
  1219.             
  1220.             Turbo C
  1221.             Equivalent   insline.
  1222.             
  1223.             
  1224.             
  1225.             ------------------------------------------------------------
  1226.             wgmovetext
  1227.             
  1228.             Name         wgmovetext -  copies a portion of the screen to
  1229.                          a different location on the screen.
  1230.             
  1231.             Usage        int wgmovetext(int  left, int  top, int  right,
  1232.                          int bottom, int newleft, int newtop);
  1233.             
  1234.             Description  wgmovetext will  copy a  portion  of  the  text
  1235.                          screen,   defined    by   upper   left   corner
  1236.                          coordinates left,  top and  lower right  corner
  1237.                          coordinates right,  bottom to  a  new  location
  1238.                          defined  by   upper  left   corner  coordinates
  1239.                          newleft, newtop.
  1240.             
  1241.                          left, top,  right, bottom,  newleft and  newtop
  1242.                          are screen-relative coordinates.
  1243.             
  1244.                          The new  location must  be situated so that the
  1245.                          entire rectangle  of text  can be moved without
  1246.                          requiring clipping.
  1247.             
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                                                                         19
  1259.  
  1260.  
  1261.             Return
  1262.             Value        The function  returns 1 if successful, and 0 if
  1263.                          unsuccessful (invalid  coordinates, not  enough
  1264.                          room for rectangle at new location).
  1265.             
  1266.             See also     wg_scroll(), scroll_window().
  1267.             
  1268.             Turbo C
  1269.             Equivalent   movetext.
  1270.             
  1271.             
  1272.             
  1273.             ------------------------------------------------------------
  1274.             wgputch
  1275.             
  1276.             Name         wgputch -  outputs a  character in  the current
  1277.                          text window.
  1278.             
  1279.             Usage        int wgputch(int c);
  1280.             
  1281.             Description  This function  writes  a  character  c  at  the
  1282.                          current cursor  position in  the  current  text
  1283.                          window.
  1284.             
  1285.                          If the  character is '\r' (carriage return) the
  1286.                          cursor is  positioned at  the beginning  of the
  1287.                          current line.
  1288.             
  1289.                          If the  character is  '\n' (newline) the cursor
  1290.                          is positioned  at the  beginning  of  the  next
  1291.                          line. Text  in the  window will  scroll  up  if
  1292.                          necessary.
  1293.             
  1294.             Return
  1295.             Value        The function  returns the  character  that  was
  1296.                          printed to the screen.
  1297.             
  1298.             Turbo C
  1299.             Equivalent   putch.
  1300.             
  1301.             
  1302.             
  1303.             ------------------------------------------------------------
  1304.             wgputtext
  1305.             
  1306.             Name         wgputtext -  restores a  portion  of  the  text
  1307.                          screen from memory.
  1308.             
  1309.             Usage        int wgputtext(int  left,int  top,int  right,int
  1310.                          bottom, char *buf);
  1311.             
  1312.             Related
  1313.             Functions    int wggettext(int  left,int  top,int  right,int
  1314.                          bottom, char *buf);
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                                                         20
  1325.  
  1326.  
  1327.             
  1328.             Description  See wggettext.
  1329.             
  1330.             Turbo C
  1331.             Equivalent   puttext.
  1332.             
  1333.             
  1334.             
  1335.             ------------------------------------------------------------
  1336.             wg_scroll
  1337.             
  1338.             Name         wg_scroll - scrolls the current text window one
  1339.                          line.
  1340.             
  1341.             Usage        void wg_scroll(unsigned char direct);
  1342.             
  1343.             Description  wg_scroll will  scroll the  current text window
  1344.                          one line  in the  direction specified by direct
  1345.                          (use UP or DOWN, defined in WGCONIO.H).
  1346.             
  1347.                          Blank lines  are inserted at the top (scrolling
  1348.                          DOWN)  or   bottom  (scrolling  UP)  using  the
  1349.                          current attribute.
  1350.             
  1351.             See also     movetext(),scroll_window().
  1352.             
  1353.             
  1354.             
  1355.             ------------------------------------------------------------
  1356.             wgtextattr
  1357.             
  1358.             Name         wgtextattr   -   changes   the   current   text
  1359.                          attribute.
  1360.             
  1361.             Usage        void wgtextattr(int attribute);
  1362.             
  1363.             Related
  1364.             Functions    void textcolor(int color);
  1365.                          void textbackground(int color);
  1366.             
  1367.             Description  wgtextattr permits changing both foreground and
  1368.                          background text  colors  with  a  single  call.
  1369.                          Characters already displayed on the screen will
  1370.                          not  be   affected.  But   any  new  characters
  1371.                          displayed using the console output functions in
  1372.                          wgconio.lib will  be displayed  using  the  new
  1373.                          attribute.
  1374.             
  1375.                          Attribute is an 8 bit parameter of the form
  1376.             
  1377.                                       Bbbbffff
  1378.                                           
  1379.                          B (bit 7) is the blink-enable bit.
  1380.                          bbb (bits 4-6) is the 3 bit background color.
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                                                                         21
  1391.  
  1392.  
  1393.                          ffff(bits -3) is the 4-bit foreground color.
  1394.             
  1395.                          If the symbolic constants for screen colors are
  1396.                          being used  to  form  an  attribute,  then  the
  1397.                          background color must be shifted left 4 bits so
  1398.                          that it occupies the correct bit positions.
  1399.             
  1400.             Example      wgtextattr(YELLOW + (BLUE<<4));
  1401.                          /* Display yellow text on a blue background*/
  1402.             
  1403.                          wgtextattr(WHITE + (RED + (WHITE<<4) + BLINK);
  1404.                          /*Display blinking white on a red background*/
  1405.             
  1406.             Turbo C
  1407.             Equivalent   textattr.
  1408.             
  1409.             
  1410.             
  1411.             ------------------------------------------------------------
  1412.             wgtextbackground
  1413.             
  1414.             Name         wgtextbackground -  sets the current background
  1415.                          text color.
  1416.             
  1417.             Usage        void wgtextbackground(int color);
  1418.             
  1419.             Related
  1420.             Functions    void wgtextcolor(int color);
  1421.             
  1422.             Description  See wgtextcolor.
  1423.             
  1424.             Turbo C
  1425.             Equivalent   textbackground.
  1426.             
  1427.             
  1428.             
  1429.             ------------------------------------------------------------
  1430.             wgtextcolor
  1431.             
  1432.             Name         wgtextcolor -  sets the current foreground text
  1433.                          color.
  1434.             
  1435.             Usage        void wgtextcolor(int color);
  1436.             
  1437.             Related
  1438.             Functions    void wgtextbackground(int color);
  1439.                          
  1440.             Description  wgtextcolor   and    wgtextbackground    permit
  1441.                          changing the  foreground and  background colors
  1442.                          for text.  Characters already  displayed on the
  1443.                          screen are not affected. But any new characters
  1444.                          that are  displayed using  the  console  output
  1445.                          functions in wgconio.lib will be displayed with
  1446.                          the new colors.
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                                                                         22
  1457.  
  1458.  
  1459.             
  1460.                          color is any integer from 0 to 7 for background
  1461.                          colors, or from 0 to 15 for foreground colors.
  1462.             
  1463.                          Characters can  be made  to blink by adding 128
  1464.                          to the foreground color.
  1465.             
  1466.                          If  a   high-intensity  color  is  accidentally
  1467.                          chosen for background (8 through 15) it will be
  1468.                          corrected to its low-intensity equivalent.
  1469.             
  1470.                          The following symbolic constants are defined in
  1471.                          WGCONIO.H, which  can be used to set foreground
  1472.                          and background colors.
  1473.             
  1474.                          BLACK            0
  1475.                          BLUE             1
  1476.                          GREEN            2
  1477.                          CYAN             3
  1478.                          RED              4
  1479.                          MAGENTA          5
  1480.                          BROWN            6
  1481.                          LIGHTGRAY        7
  1482.                          DARKGRAY         8
  1483.                          LIGHTBLUE        9
  1484.                          LIGHTGREEN       10
  1485.                          LGHTCYAN         11
  1486.                          LIGHTRED         12
  1487.                          LIGHTMAGENTA     13
  1488.                          YELLOW           14
  1489.                          WHITE            15
  1490.                          BLINK            128
  1491.             
  1492.             Example      textcolor(YELLOW);
  1493.                          /*Sets current foreground color to yellow*/
  1494.             
  1495.                          textcolor(WHITE + BLINK);
  1496.                          /*Sets current foreground to blinking white*/
  1497.             
  1498.             Turbo C
  1499.             Equivalent   textcolor.
  1500.             
  1501.             
  1502.             
  1503.             ------------------------------------------------------------
  1504.             wgwherex
  1505.             
  1506.             Name         wgwherex -  gets the current column position of
  1507.                          the cursor.
  1508.             
  1509.             Usage        int wgwherex(void);
  1510.             
  1511.             Related
  1512.             Functions    int wgwherey(void);
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                                                                         23
  1523.  
  1524.  
  1525.             
  1526.             Description  These  functions  return  the  current  window-
  1527.                          relative  position   of  the  cursor.  wgwherex
  1528.                          returns the column position, and wherey returns
  1529.                          the row position. Note that the upper left cell
  1530.                          of any window is row 1, column 1 (1,1).
  1531.             
  1532.             Return
  1533.             Value        wgwherex returns an integer from 1 through 80.
  1534.                          wgwherey returns an integer from 1 through 25.
  1535.             
  1536.             Turbo C
  1537.             Equivalent   wherex.
  1538.             
  1539.             
  1540.             
  1541.             ------------------------------------------------------------
  1542.             wgwherey
  1543.             
  1544.             Name         wgwherey - gets the current row position of the
  1545.                          cursor.
  1546.             
  1547.             Usage        int wgwherey(void);
  1548.             
  1549.             Related
  1550.             Functions    int wgwherex(void);
  1551.             
  1552.             Description  See wgwherex.
  1553.             
  1554.             Turbo C
  1555.             Equivalent   wherey.
  1556.             
  1557.             
  1558.             
  1559.             ------------------------------------------------------------
  1560.             wgwindow
  1561.             
  1562.             Name         wgwindow - creates a text window.
  1563.             
  1564.             Usage        void wgwindow(int  left,int  top,int  right,int
  1565.                          bottom);
  1566.             
  1567.             Description  wgwindow creates  an active  text window on the
  1568.                          screen. The window is defined by the upper left
  1569.                          corner coordinates  (left,top) and  lower right
  1570.                          corner coordinates (right,bottom).
  1571.             
  1572.                          The initial  default  window  is  defined  with
  1573.                          initiallze_WGW() for a full screen. The minimum
  1574.                          window is one character cell.
  1575.             
  1576.                          The call  to this  function will  be ignored if
  1577.                          invalid coordinates are passed.
  1578.             
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                                                         24
  1589.  
  1590.  
  1591.             Return Value None
  1592.             
  1593.             Turbo C
  1594.             Equivalent   window.
  1595.             
  1596.             
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.