


                                                                      








                                TOOLS FOR C
                       Application Development Package
                                USERS MANUAL


                      Shareware Distribution Version 1.0







         This version of TOOLS FOR C and it's associated manuals and
         support files may be freely copied and distributed as long as
         it is distributed in it's entirety and no fees other than
         nominal handling fees are charged.  The routines in this
         library are NOT Public Domain.  This is copyrighted material. 
         The intent behind distributing this version of TOOLS FOR C is
         to allow you to use the package on a trial basis and determine
         if it meets your needs.  If you find yourself using this
         package, you MUST register by sending $45.00 to the address
         listed below.  Upon receipt of your registration fee we will
         send you an expanded manual, compiled libraries for all of the
         memory models available with your compiler, and the complete
         source code to the library. In NO EVENT may you use any of the
         routines in TOOLS FOR C for commercial purposes until you
         register your copy.  We feel that you will find the value of
         TOOLS FOR C far exceeds the registration fee and we at BP
         SOFTWARE SOLUTIONS, INC. thank you in advance for your
         support.





                        BP Software Solutions, Inc.
                        642 N. Commodore Drive
                        Plantation, Fl.  33325





                                          Copyright (C) 1987 
                                                BP Software Solutions Inc.
                                                       All Rights Reserved












                              Table of Contents





                INTRODUCTION . . . . . . . . . . . . . . .    3
                     The Manual. . . . . . . . . . . . . .    3
                     Concerning Compiling. . . . . . . . .    3

                VIDEO  . . . . . . . . . . . . . . . . . .    4
                     Video Routines  . . . . . . . . . . .    4
                     Video Attributes  . . . . . . . . . .    4
                     Cursor Control  . . . . . . . . . . .    5
                     Character Output  . . . . . . . . . .    5
                     String Output . . . . . . . . . . . .    6
                     Screen Scrolling  . . . . . . . . . .    6

                KEYBOARD . . . . . . . . . . . . . . . . .    7
                     Keyboard Routines . . . . . . . . . .    7
                     KEY.H . . . . . . . . . . . . . . . .    7

                WINDOWS  . . . . . . . . . . . . . . . . .    8
                     Creating windows  . . . . . . . . . .    8
                     Menugen.Exe . . . . . . . . . . . . .   10
                     Window Management . . . . . . . . . .   10
                     Closing Windows . . . . . . . . . . .   11

                MENUS  . . . . . . . . . . . . . . . . . .   13
                     Creating Menus  . . . . . . . . . . .   13
                     Menugen . . . . . . . . . . . . . . .   13
                     Menu Selections . . . . . . . . . . .   13
                     Error Handling  . . . . . . . . . . .   14
                     menu_text() . . . . . . . . . . . . .   14
                     Titling Menus . . . . . . . . . . . .   14
                     Menu Structures . . . . . . . . . . .   15

                GLOBAL VARIABLES . . . . . . . . . . . . .   16

                INDEX  . . . . . . . . . . . . . . . . . .   18




                                                                     page 3
                              INTRODUCTION


     Introduction

          TOOLS FOR C provides a comprehensive library of tested C and
          assembler functions to complement the standard library provided
          with your C compiler.  You will find routines for screen and
          keyboard I/O, window management, a menu system, string routines
          and more.  Included in the shareware distribution version are
          compiled libraries for linking with the small memory models
          of Microsoft C (R) v4.0,  Lattice C (R) v3.x, and Borland
          International's Turbo C (R) v 1.0.  Upon receipt of your
          registration fee, we will send you the libraries for the all of
          the memory models supported by your compiler and the complete C
          and assembler source code.  You will then be able to modify any
          of the routines which do not precisely meet your needs. 
          Furthermore, you will be able to recompile the library using
          different optimization flags, different function naming
          conventions, or for that matter, a different compiler
          altogether.

     The Manual

          The manual is organized into chapters, each dealing with one
          subgroup of routines.  The first chapter, video, describes the
          functions dealing with screen output.  Keyboard deals with the
          key() function and the macro keystroke definitions provided with
          the package.  The third and fourth chapters describe the many
          functions and capabilities of the window and menu management
          routines in TOOLS FOR C.  A detailed explanation of each control
          structure is given.

          The large reference section details each function, giving
          specific calling requirements and examples.  The function
          reference section is a comprehensive description of each Turbo
          Library routine.  Each routine is listed with it's function
          name, synopsis, a detailed description, and return values if any.

     Concerning Compiling

          When we developed TOOLS FOR C we chose long, descriptive names
          for the functions.  This avoids the cryptographer's delight that
          results from trying to name too many functions with too few
          characters. Therefore, when compiling programs to be linked with
          TOOLS FOR C you must be sure to use the compiler option
          activating long identifier names.  In Lattice C (R) this is the
          -n flag, in Microsoft C (R) and Turbo C (R) long names are the
          default.  The header file TOOLS4C.H should be included in all
          source code which uses TOOLS FOR C.  MENU.H is necessary in any
          code which references the menu() function.  KEY.H can be included
          as an aid in defining the codes returned by key(), but it's use
          is not required.  The library does not replace any of the
          standard library functions, so link order is not important.


                                                                     page 4
                                  VIDEO

      
     Video Routines

          The video routines provided in the library allow direct hardware
          control of Color Graphic Adapters and Monochrome Adapters,
          bypassing most of the DOS and BIOS routines.  This allows for
          much greater display speed and far more flexibility.  Direct
          hardware control requires that the routines be informed of which
          adapter is installed.  This is accomplished by calling the
          function "vid_type()" which sets a couple of global integer
          variables (_vid_buf and _vid_type).  A hardware dependent
          routine can check these to tell which type of adapter is
          presently being used.  This function must be called at least
          once before any of the video routines are called.  If it is not,
          a monochrome adapter will be assumed. While direct hardware
          control is required for acceptable performance, it also
          unfortunately requires a high degree of hardware compatibility
          with IBM's CGA or Monochrome Adapter. Most PC compatible video
          boards do closely match one of these adapters so running
          applications developed using TOOLS FOR C on IBM compatible
          computers should present no problems.  If you do experience
          difficulties, minor changes to the library, using the supplied
          source code, will probably solve your problem.  

          As explained below, control of the video attributes is left
          entirely to you. In order to allow selection of monochrome or
          color attributes at run time, vid_type() sets a global variable
          "_color" to TRUE if the current video mode is 3 (80x25 color
          text).  If the current video mode is 2 (80x25 B/W text) or 7
          (Mono) then "_color" defaults to FALSE.  If the current video
          mode is not set to one of these values, vid_type() returns ERROR
          (-1) instead of OK (0).  The return value should be checked as
          the TOOLS FOR C video routines are designed to operate only
          with the video mode set to one of the eighty column text modes
          (CO80, BW80 or MONO).  If there is any question as to which mode
          the display is in, routines in the library allow you change it
          and then return it to the old value before exiting.

       
     Video Attributes

          Many of the routines require you to specify a video attribute. 
          One of the basic decisions made during the design phase of the
          library was to not implement video attributes as global variables,
          but instead to require that they be passed each time as a
          parameter.  Any additional work on the part of the programmer that
          this approach requires will certainly be repaid in program
          maintenance hours.  Two global variables are provided which are
          set by the vid_type() routine which will allow you to determine
          which type of video adapter is installed and whether or not the
          color mode is set on a CGA in the event that you want to use
          attributes which are not compatible across all modes.



     Cursor Control                                                  page 5

          Two different sets of cursor control routines are included which
          provide essentially the same services but require or return
          different parameters.  One set, curs() and get_curs(), specifies
          the cursor location as an encoded integer where the high eight
          bits defines the cursor row and the low eight bits defines the
          cursor column.  The other set, cursor() and get_cursor(),
          requires two separate integer variables, one each for the row
          and column.  To set the cursor location, these are passed as
          parameters, but since it is possible to return only one variable
          from a C routine, to determine the cursor location it is
          necessary to provide the address of two integer variables to
          get_cursor().  get_cursor() then stuffs these variables with the
          appropriate values.  

          If it is only necessary to save and restore the cursor location,
          then get_curs() and curs() are much easier to use, but if you need
          to determine the row or column, or set the cursor to a specific
          location, then get_cursor() or cursor() will save some masking and
          bit-shuffling.  

          Throughout the library, screen locations are defined in terms of
          (column, row) with the upper left corner of the screen defined as
          location (0,0). Columns are numbered from the left most column  0
          to the right most column 79 and rows are numbered from the top 0
          to the bottom 24.  The lower right screen location is (79,24).

          Programming note:  One way to remove the blinking cursor from
          the screen, is to call cursor() with a set of screen coordinates
          somewhere off the screen, such as cursor( 1, 25 ).  The blinking
          hardware cursor will be hidden until another call is made to
          cursor() with parameters within the visible area of the screen. 
          Take care, however, that you do not use any write to screen
          routines which write characters at the current cursor position
          while the cursor is not visible for obvious reasons.

          There are three cursor shape control functions. The first,
          cursor_type(), allows you to change the cursor to one of eight
          different sizes or to blank it entirely depending on the
          parameter passed to it. The other two, normal_cursor() and
          block_cursor() set the cursor to the two most commonly used
          shapes without the need to specify a parameter.


     Character Output

          Numerous routines are provided for writing characters to the
          screen. 

          write_tty(), write_a(), and write_ac() write to the current
          cursor position.  write_tty() uses the bios write_as_tty
          function and recognizes special characters like bell and
          backspace.  write_ac() writes to the cursor position along with
          a video attribute and advances the cursor.  write_a() does the
          same without advancing the cursor.  


								     page 6

          write_am() writes multiple copies of the same character along with
          a video attribute.

          write_al() writes a character and attribute to a specified screen
          location without regard for the current cursor location.
 
     String Output

          Like the character output routines, there are several string
          output routines available which allow writing strings to the
          screen beginning at either the current cursor position or a
          specified location.

          write_str() writes a string to screen beginning at the location
          specified, without regard for the cursor, using the supplied
          attribute.  No special characters are supported however, this is
          the quickest routine.

          print_string() writes a string and attribute beginning at the
          current cursor position and supports the special characters '\n'
          '\t' and '\r'.  This routine is somewhat slower than write_str()
          but much quicker than aprintf().

          aprintf() writes a formatted string to the screen using the
          specified attribute.  All the printf() formatting codes and
          control characters are supported.  In fact, because the
          sprintf() or vprintf() function in the standard library is
          called to do the formatting the only thing not supported is
          output redirection.  Total string length is limited to 255
          characters, however.

     Screen Scrolling

          scroll() provides an easy way to scroll any part of the screen
          up or down. You supply the boundaries of the area to scroll, the
          direction to scroll, the number of lines to scroll, and the
          video attribute to use in filling the newly cleared area of the
          screen.  Passing the routine a zero for the number of lines to
          scroll will result in the entire area being blanked and filled
          with the specified video attribute.



                                                                     page 7

                               KEYBOARD



     Keyboard Routines

          The library's keyboard I/O routines are designed to allow you to
          easily interface a program to a computer that uses the IBM
          PC/XT/AT Extended Ascii format.  A single call to key() is all
          that is required to get the next keystroke and uniquely identify
          it.  This is possible because key() returns and integer value
          instead of a char value. Any returned value less than 256 (0x0100)
          is a normal keyboard character, control character or a value
          returned by using the ALT key in combination with the numeric
          keypad.  If the returned value is 256 (0x0100) or higher, then one
          of the function or special keys has been pressed and it's extended
          code is in the upper two bytes.  In most cases you need not be
          concerned with all of this as the return codes for most of the
          special keys are defined in the include file KEY.h.  To determine
          if a particular key has been pressed, just compare the returned
          value with it's definition.


     Listing of KEY.H

        #define TAB       0x0009                #define SFTTAB    0x0f00
        #define RETURN    0x000d                #define ALT_F4    0x6b00
        #define SPACE     0x0020                #define ALT_F5    0x6c00
        #define UP        0x4800                #define ALT_F6    0x6d00
        #define DOWN      0x5000                #define ALT_F7    0x6e00
        #define LEFT      0x4b00                #define ALT_F8    0x6f00
        #define RIGHT     0x4d00                #define ALT_F9    0x7000
        #define HOME      0x4700                #define ALT_F10   0x7100
        #define END       0x4f00                #define CNT_F1    0x5e00
        #define PGUP      0x4900                #define CNT_F2    0x5f00
        #define PGDN      0x5100                #define CNT_F3    0x6000
        #define F1        0x3b00                #define CNT_F4    0x6100
        #define F2        0x3c00                #define CNT_F5    0x6200
        #define F3        0x3d00                #define CNT_F6    0x6300
        #define F4        0x3e00                #define CNT_F7    0x6400
        #define F5        0x3f00                #define CNT_F8    0x6500
        #define F6        0x4000                #define CNT_F9    0x6600
        #define F7        0x4100                #define CNT_F10   0x6700
        #define F8        0x4200                #define SFT_F1    0x5400
        #define F9        0x4300                #define SFT_F2    0x5500
        #define F10       0x4400                #define SFT_F3    0x5600
        #define ESC       0x001b                #define SFT_F4    0x5700
        #define BKSP      0x0008                #define SFT_F5    0x5800
        #define INS       0x5200                #define SFT_F6    0x5900
        #define DEL       0x5300                #define SFT_F7    0x5a00
        #define ALT_F1    0x6800                #define SFT_F8    0x5b00
        #define ALT_F2    0x6900                #define SFT_F9    0x5c00
        #define ALT_F3    0x6a00                #define SFT_F10   0x5d00



                                                                     page 8

                                   WINDOWS



     Turbo Library Windows 

          The functions in TOOLS FOR C allow you to quickly create
          pop-up, overlapping windows for your own programs.  The contents
          of the screen under each window is automatically saved when the
          window is opened and restored when it is closed.  Windows can be
          moved around the screen.  Overlaid windows can be brought to the
          front or closed.  The routines will keep track of the saved video
          so that when the last window is closed, the original screen will
          be intact.  Video attributes of the border and the center fill
          area can be specified.  Cursor or text in a window can be made
          relative to the window position so that if you open a window in a
          new position any text written to the window will remain in the
          same place within the window.  You can select any characters you
          like for the border.  Any character can be specified to fill the
          area inside the window's borders.  

     Creating windows

          All of the parameters necessary to open a window are found in a
          structure defined in TOOLS4C.H as a typedef "WNDW".  Below is the
          listing as it appears in TOOLS4C.H with comments added.  

          typedef struct WNDW {
               int  left_col_line_char;      /*   The next eight lines    */
               int  upper_row_line_char;     /*   specify the characters  */
               int  right_col_line_char;     /*   to be used for lines    */
               int  lower_row_line_char;     /*   and corners of the      */
               int  ulcorner_char;           /*   border                  */
               int  urcorner_char;
               int  llcorner_char;
               int  lrcorner_char;
               int  fill_char;     /* this char, normally a space, fills  */
                                   /* the center of the window            */
               int  line_attr;     /* this is the border video attribute  */
               int  fill_attr;     /* this is the fill area video attrib. */
               int  upper_row;     /* The next four lines define the      */
               int  left_col;      /* boundary of the window. These are  */
               int  lower_row;     /* the columns and rows where the      */
               int  right_col;     /* border will be placed               */
               int  curr_row;      /* an area to store the cursor         */
               int  curr_col;      /* position for your own use, they are */
                                   /* not used by the window functions    */
                 /* The remaining structure members are filled in by   */
                 /* the window management functions. You should define */
                 /* them as zeros or NULLs, as appropriate.            */
               int  buf_size;           /* size of the video buffer area  */
               struct WNDW *prev_wndw;  /* pointer to previous window     */
               struct WNDW *next_wndw;  /* pointer to next window         */
               char      *image;        /* pointer to video buffer        */
               } WNDW ; 


                                                                     page 9

          To create a window, you need only to define a structure of type
          WNDW initialized to the window's desired parameters.  You then
          call open_window() or open_ex_window() with the address of this
          window structure as an argument. See the example below.


               struct WNDW head1 ={' ',' ',' ',' ',' ',' ',' ',' ',
                         ' ',0xF,0x70,15,1,79,10,0,0,0,NULL,NULL,NULL};

               /*   The structure above defines a window with the upper left
                    corner at 15,1 and the lower right corner at 79,10. The
                    characters on the top line, just after the opening brace
                    are the various border and corner characters.  The 
                    blank space defined at the beginning of the first line
                    is the character which will fill the interior of the
                    window.   0xF is the border's video attribute.  0x70 is
                    the window interior's video attribute.  The next four
                    integers define the window's location on the screen. 
                    The first two zeros are unused integer variables that
                    are available for your use.  The final zero integer and
                    three NULLs must be defined as shown.  These locations
                    are filled in and manipulated by various window
                    functions and should not be modified in any other way.  
                         */

               int ret_code;

                    ret_code = open_window( &head1 );

                    if(ret_code == ERROR)
                         printf("Error opening Window\n");


          Alternatively, a pointer of type WNDW can be set equal to the
          address  of the window structure.  This pointer can then be used
          to call any of the window management functions which require the
          structure address.


               struct WNDW head1 ={' ',' ',' ',' ',' ',' ',' ',' ',
                         ' ',0xF,0x70,15,1,79,10,0,0,0,NULL,NULL,NULL};

               int ret_code;
               WNDW *wind3;

                    wind3 = &head1; 
                    ret_code = open_ex_window( wind3 );

                    if(ret_code == ERROR)
                         printf("Error opening Window\n");

          After attempting to open a window, the return code should be



                                                                     page 10


          checked to see if the window was successfully opened. OK, defined
          as zero in TOOLS4C.H is returned if successful, and ERROR, defined
          as -1 is returned if the routine was not able to allocate memory
          for the video buffer.  The only limit on the number of windows
          which can be open is the memory available.  No checking is done
          for bogus arguments in the structure definition.  

     Menugen.Exe

          Included in the TOOLS FOR C package is a program - MENUGEN.EXE -
          which simplifies the definition of a window.  The program allows
          you to "point and shoot" the borders of a window, then a series of
          menus allow you to select various border and fill characters and
          attributes and display them on the screen.  When you are satisfied
          with the window, an output file is written which can be included
          in your program.  A pointer to this window structure is also
          defined in the file, so all that is necessary is to call the open
          window routines with this pointer as an argument, and the same
          window which was displayed in MENUGEN will be opened.  The window
          can be modified simply by changing any of the parameters in the
          include file structure.

     Window Management

          Once a window is open, it can be manipulated by the window
          management functions:

                    clear_window()                fill_window()
                    activate()                    move_window()
                    scroll_window()               clear_wndw_title()
                    title_window()

          and all of the window printing and cursor control functions.  A
          short synopsis of most of the functions follows.

          clear_window()

               This function is simply a clear_screen for the currently
               active window.  All the area inside the borders is changed to
               blank characters using the current fill attribute for the
               window.

          activate()

               All of the open windows are managed by a doubly linked list,
               with the currently active window being the last one in the
               chain.  A window can be made the active window by calling
               activate() with the address of it's window structure as an
               argument.  The window routines will bring that window to the
               top on the screen if any other windows are covering any part
               of it, and the linked list will be updated to show that
               window as being at the end of the list. A global WNDW



                                                                     page 11

               pointer, "last_wndw" will be updated to point to the new
               active window. 

          title_window()

               Allows you to easily insert a title string into the border
               area of a window using any video attribute you like.  It will
               automatically right or left justify or center the string in
               either the top or bottom border, depending on the
               justification code that you supply.

          clear_wndw_title()

               Removes any titles in either the top or bottom border of a
               window and restores the border characters and attributes as
               defined in the window structure.

          fill_window()

               fill_window() quickly redraws the interior of a window using
               the default fill character and attribute as defined in the
               window structure.  This function provides an efficient means
               of clearing a window when something other than a space
               character is the fill character.

          move_window()

               Provides an easy way to move a window's position on the
               screen.  Each call will move the window either left, up,
               right, or down the number of screen character positions
               supplied.  The window will not, however, move past the point
               where one of the borders meets the edge of the screen.

          scroll_window()

               scrolls the area within the borders of the window either up
               or down, a specified number of lines.  The area cleared by
               the scroll is filled with the current window fill attribute
               defined in the window structure.

     Closing Windows

          An open window can be closed at any time with a call to
          close_window() using the window structure address or a pointer to
          this address as an argument.  In the example below assume
          that head1 is a structure of type WNDW.


                                                                     page 12

               int ret_code;
               WNDW *wind3;

                    wind3 = &head1;
                    ret_code = open_window( wind3 );
                    if(ret_code)
                         printf("\nError opening window\n");

                    close_window( wind3 );


          If the window is not the active window, it is activated to bring
          it to the top of the list. The screen is restored and all the
          links  binding the window to the list are deleted. Finally, the
          memory allocated to the video buffer is freed.



                                                                     page 13
                                  MENUS


     Creating Menus

          Menus, like windows, can easily be added to your programs simply
          by defining three structures and making a call to the menu
          executive function menu().  All of the information needed by
          menu() is in these three structures.  The first is the WNDW
          structure that the menu will occupy. This is a standard window
          structure as described above in the section on windows and
          defines the video area and attributes of the menu.  All screen
          references in the menu are relative to this window, so after a
          menu is defined, it can be moved around the screen simply by
          changing the window position.  This structure is pointed to by
          the menu structure typedef MENU.  MENU describes the cursor type
          and it's default video attributes, the menu title, the number of
          selections in the menu, pointers to default help and error
          functions, the help and exit hot keys, pointers to the menu
          window structure and an array of structures of typedef SEL. 
          Struct SEL defines an individual menu selection.  It contains a
          pointer to the selection text line. The starting column and row
          relative to the menu window where this text will be displayed.
          Video attributes for the selection, if something other than the
          default attributes are to be used.  A pair of activate keys are
          defined which will call the selection without having to use the
          cursor.  A pointer to a help function which you supply can be
          included to provide context sensitive help. Either a pointer to
          the function to be called or a text string to a program name to
          be executed must be provided. The other is set to a NULL. 
          Finally an int value determines if the menu should be exited to
          it's caller after the called function returns or if another
          selection from the menu will be made available.

     Menugen 

          As you may have deduced from the paragraph above, setting up a
          menu requires entering a lot of information into several complex
          structures.  This would be a tedious task indeed were it not for
          the program MENUGEN.  MENUGEN automates the process of setting
          up a menu, allowing you to interactively build the menu on
          screen, and when completed, it writes a header file containing
          all the necessary structures.  Complete information on the
          running MENUGEN is included in the appendix.

     Menu Selections

          Selections can be made from the menu either by using the
          activate keys defined for each item in the SEL list or by using
          a bounce bar pseudo cursor.  This cursor highlights the
          selection text with a different video attribute than the non
          selected text.  The cursor is moved from item to item using the
          cursor keys.  The next closest menu item in the direction indicated
          by the cursor arrow is selected.  When the desired item is
          highlighted, pressing the return key runs it's function or
          program.  If the operation to be performed when an item is 


                                                                     page 14

          selected is a function, then the function call is made with the
          index of that item in the array of SEL structures as an
          argument.  This way one function can be used to service several
          similar items, using the argument to determine which selection
          was made.  Three types of pseudo cursors are supported.  One
          highlights the area exactly as long as the selected item. 
          Another highlights an area as long as the longest item in the
          SEL list.  The last highlights the full length of the menu
          window.  The int value pcursor_type in MENU determines which
          type is used and is decoded as follows:

                                     0 == String length
                                     1 == Max string length
                                     2 == Full window length


     Error Handling

          All functions called by the menu routine must return an error
          code.  If the call returns without error then a zero should be
          returned.  If any other value is returned, then the error
          function pointed to in the MENU structure is called with that
          error code as an argument.  You can then decode this value and
          take appropriate action.  Pressing an undefined key while in the
          menu calls the error function with an error code of zero.  This
          is usually handled simply by beeping the console speaker and
          returning.


     menu_text()

          A place is provided in the MENU structure for a pointer to a
          function which is called after the menu window is opened, and
          before the selections are written to the screen.  This function
          can be used write descriptive text or otherwise embellish the
          menu's screen.

     Titling Menus

          A menu title can be defined which will written in the border of
          the menu's window.  Any video attribute can be defined for the
          title and it can be either centered, left justified, or right
          justified in the top or bottom border.  If the length of the
          title string is longer than width of the window, the text is
          truncated to fit.  Positioning of the title is determined by the
          int value title_format in MENU as follows:

                                     1 == Upper Left
                                     2 == Upper Center
                                     3 == Upper Right
                                     4 == Lower Left
                                     5 == Lower Center
                                     6 == Lower Right 

 
                                                                     page 15


     Menu Structures

        Below is a listing of the structures defined in the header menu.h
               
     typedef struct MENU { 
        struct WNDW *menu_window;    /* Pointer to the menu window structure */
        int   default_non_select_att;/* Usually the same as window fill attr */    
        int   default_cursor_att;    /* Attribute of items when selected     */ 
        int   title_format;          /* Position of menu title on border(1-6)*/
        int   window_title_att;      /* Video attribute of menu title        */
        char  *window_title_text;    /* Pointer to menu title text string    */
        int   pcursor_type;          /* Type of selection cursor (0-2)       */
        int   exit_key;              /* Hot key to exit menu, Usually ESC    */
        int   help_key;              /* Hot key to call help function, if any*/
        int   (*menu_text)();        /* Ptr to function to write text to scrn*/
        int   (*error_fn)();         /* Ptr to user supplied error handler   */
        struct SEL *sel_list;        /* Ptr to the first in array of SELs    */ 
        int   num_sel;               /* Number of menu selections             */   
        }    MENU; 
 

    
     typedef struct SEL{ 
        char *text;               /* Pointer to item selection text string  */
        int  start_col;           /* Starting col in window for text string */
        int  start_row;           /* Starting row in window for text string */
        int  sel_att;             /* Item sel video attr, Zero for default  */ 
        int  unsel_att;           /* Item unselected video attribute or Zero*/ 
        int  activate_key_1;      /* First Activate hot key                 */
        int  activate_key_2;      /* Second Activate hot key                */
        int  (*do_function)();    /* Ptr to selected function or NULL       */ 
        char *exe_call;           /* Ptr to program name string or NULL     */ 
        int  (*help_function)();  /* Ptr to optional help fctn or NULL      */ 
        int  exit;                /* exit menu after command, Zero if no    */ 
        } SEL; 
  



                                                                     page 16
                   GLOBAL VARIABLES DEFINED IN TOOLS4C.LIB



          char  *_vid_buf     Is set by vid_type() to point to the segment
                              of the video display buffer.  It is
                              initialized to point to the segment of a
                              monochrome card.  If the current video mode is
                              something other than seven, this is changed to
                              the segment of a color-graphics card.  This
                              value is used by a large number of the screen
                              I/O routines.

          int  _vid_type      Is set by vid_type() to reflect what type of
                              video card is being used.  The current video
                              mode is checked and if the mode is seven,
                              _vid_type is set to zero. If any other mode is
                              set, a color/graphics card is assumed and
                              _vid_type is set to 1.  

          int  _color         Is set by vid_type() to 1 if the current video
                              mode is set to CO80.  It is set to 0 if the 
                              mode is set to BW80 or MONO.  This variable is
                              used to select between color and monochrome
                              video attributes.

          int  _retrace       Is also set by vid_type() to 1 if a
                              color/graphics video board is being used to
                              enable checking for retrace blanking.  Many of
                              the video routines will run much quicker if
                              this is set to zero and you have a video card
                              which allows accessing video memory without
                              generating snow.

          char temp_str[256]  This is a global data buffer used by many of
                              the string handling routines.  You can use
                              this area as a temporary data buffer in your
                              own routines as long as you do not make any
                              calls to turbo.lib functions before you are
                              finished with any data that you have stored
                              there.

          int   insert_flag   This flag is toggled by the insert key when in
                              get_field to switch between insert
                              (insert_flag == 1) and over_write (insert_flag
                              == 0) modes.

          WNDW  *first_wndw   Is a pointer to the first window structure in
                              the linked list of open windows. If there are
                              no windows open it is set to NULL.

          WNDW  *last_wndw    Is a pointer to the last window structure in
                              the linked list of open windows. If there are
                              no windows open it is set to NULL, otherwise
                              it always points to the active window.

 
                                                                    page 17








                             WARRANTY AND DISCLAIMER



               Before registration, there is no warranty whatsoever. 

               After you register your copy of TOOLS FOR C, we offer
               you the same limited warranty most software developers
               offer.  That is to say, with the exception of the
               physical media upon which you receive your software,
               there is no warranty ( within 90 days, we will replace
               any bad disks).  We have done our best to provide a
               useful library of C functions, we let you try before
               you buy, and we give you the source code to the
               library.  The complete responsibility for determining 
               whether this library meets your needs, and ensuring
               that any programs developed using any of it's
               functions are bug free and will run as intended rests
               with you, the application programmer. 

               That's it, That's all, There ain't no more.


 
                                                                    page 18







                                   INDEX



         activate() . . . . . (10)         Move_window()  . . . (11)         
         Character Output . . ( 5)         Open_ex_window() . . ( 9)       
         clear_window() . . . (10)         Open_window()  . . . ( 9)          
         close_window() . . . (11)         Pseudo cursor()  . . (13)
         Closing Windows  . . (11)         Screen Scrolling . . ( 9)
         Creating Menus . . . (13)         scroll() . . . . . . ( 6)
         Creating Windows . . ( 8)         String Output  . . . ( 9)
         Curs() . . . . . . . ( 5)         struct WNDW  . . . . ( 8)
         Cursor() . . . . . . ( 5)         struct MENU  . . . . (15)
         Cursor Control . . . ( 5)         struct SEL . . . . . (15)
         first_wndw . . . . . (16)         Titling menus  . . . (14)
         Get_cursor() . . . . ( 5)         temp_str . . . . . . (16)
         GLOBAL VARIABLES . . (16)         vid_type() . . . ( 4)(16)
         Identifier Length  . ( 3)         VIDEO  . . . . . . . ( 4)
         insert_flag  . . . . (16)         Video Attributes . . ( 4)
         INTRODUCTION . . . . ( 3)         Video Routines . . . ( 4)
         Key()  . . . . . . . ( 7)         WINDOWS  . . . . . . ( 8)
         KEYBOARD . . . . . . ( 7)         Window Management  . (10)
         KEY.H  . . . . . . . ( 7)         _color . . . . . . . (16)
         last_wndw  . . . . . (16)         _retrace . . . . . . (16)
         Menu() . . . . . . . (13)         _vid_buf . . . . . . (16)
         Menugen.Exe  . . (10)(13)         _vid_type  . . . ( 4)(16)
         MENUS  . . . . . . . (13)                        
        

