home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / tcu_32.zip / TCU32_DB.ZIP / TCU.DOC < prev    next >
Text File  |  1991-08-01  |  103KB  |  2,380 lines

  1.  
  2.                         ===========================
  3.                         Turbo-C Utilities - TCU 3.2
  4.                         ===========================
  5.                              + Database Option
  6.                         ===========================
  7.  
  8.  
  9. Foreword
  10. --------
  11.  
  12. Further information, support and product registration should be addressed to
  13. the address given below.
  14.  
  15.        Karl Keyte
  16.        Gross-Gerauer Strasse 10
  17.        D-6108 Weiterstadt
  18.        Germany
  19.  
  20.        Voice  :     +(49) 6150 2499
  21.  
  22. All memory models other than TINY (which is not supported) are supplied with
  23. this version.  Compilations with ALL memory models MUST use the WORD ALIGN
  24. option or else the programs WILL NOT WORK.
  25.  
  26.  
  27. If you use this product, please be sure to register by writing to the address
  28. given above.
  29.  
  30.  
  31.  
  32. Disclaimer
  33. ----------
  34.  
  35. No responsibility taken for anything which may result from using the TCU
  36. package. If anything unusual does result, please contact me on the above
  37. e-Mail address with full details.
  38.  
  39.  
  40. Introduction
  41. ------------
  42.  
  43. TCU is a library for Turbo-C v2.0 or Turbo/Borland C++ to provide a number of
  44. services relating to menus, prompt and notice windows, form entry and
  45. databases. This document offers a full description of each of the services,
  46. their syntax and operation. The following text describes each section briefly.
  47. It for the user to write full test and application programs to demonstrate
  48. fully the use of each.
  49.  
  50.  
  51.    Menus
  52.    -----
  53.  
  54.    The TCU menu system offers pop-up menus and pulldown menus. Pulldown menus
  55.    utilise normal pop-up menus for each of the choices. A pop-up menu is
  56.    defined with the 'tcu_define_menu' service and may be displayed on the
  57.    screen with 'tcu_display_menu'. A choice from the menu is read with
  58.    'tcu_read_menu_selection'. The menu is removed from the screen with the
  59.    'tcu_remove_menu' service. Each menu should be declared in the calling
  60.    program as type TCU_MENU before being defined.
  61.  
  62.    A pulldown menu is a set of title options, and each option may have an
  63.    associated pop-up menu which will be displayed beneath the pulldown option
  64.    when selected.
  65.  
  66.    Items in pop-up menus may be set as 'unavailable', making that option non
  67.    selectable.  This option may be toggled on and off.
  68.  
  69.  
  70.    Prompts and Notices
  71.    -------------------
  72.  
  73.    A notice is a set of lines of text which is displayed in a notice window.
  74.    The notice must be cleared from the screen by the user pressing the RETURN
  75.    key or the ESCAPE key. A notice is initiated (though not displayed) with
  76.    the 'tcu_prepare_notice' service, and each line of text is added to the
  77.    notice using 'tcu_notice_text'. When the notice has been fully built it may
  78.    be displayed with 'tcu_display_notice'. When it is no longer needed it
  79.    should be cleared with the 'tcu_clear_notice' service.
  80.  
  81.    A prompt is simply a notice with a single input field. The input field is
  82.    defined (in colour and size) with the 'tcu_prompt_input' service. As soon
  83.    as a call to 'tcu_prompt_input' is made, the notice becomes a prompt. This
  84.    call must be made prior to the call to 'tcu_display_notice'. A prompt is
  85.    completed by the user entering the prompt field and pressing the RETURN
  86.    key.
  87.  
  88.  
  89.    Forms
  90.    -----
  91.  
  92.    The forms package is a complete form entry system allowing fixed text and
  93.    variable input areas to be defined in a form. The attributes of the form
  94.    are written in a CUF ('C' Utilities Form) file and compiled into an object
  95.    form (CFO - 'C' Form Object) or a relocatable object file using the
  96.    provided Forms Compiler. The compiler checks the syntax and validity of
  97.  
  98.  
  99.    each of the entries in the form source file, and if no errors are found the
  100.    object is generated. This object may then be loaded by an application using
  101.    the 'tcu_load_form' or 'tcu_load_image_form' service. This former gives the
  102.    application the flexibility not to depend on the exact form content which
  103.    may be modified without having to recompile or link any code (unless major
  104.    changes are made to the form structure).
  105.  
  106.    Full details of the form source syntax are available in the Forms Compiler
  107.    documentation.
  108.  
  109.    Each field in a form is addressed by its 'form id' number, which is not
  110.    specified in the form source, but is assigned at run-time. In order to
  111.    allow applications to refer to known fields, fields may be given a name
  112.    which may be used with the 'tcu_get_field_id' service to obtain the
  113.    applicable form id.
  114.  
  115.    Fields may be one of 7 types, or 6 basic types:
  116.  
  117.       Numeric   - 2 types, 1 integer and 1 floating point.
  118.       String    - Character strings
  119.       Date      - Dates in US or European format
  120.       Logical   - True/False, Yes/No, etc.
  121.       Choice    - Enumerated selection types
  122.       Button    - Selection buttons
  123.  
  124.    Fixed text within a form is declared as TEXT rather than FIELD.
  125.  
  126.    Each field or text item may be assigned a colour attribute, defining its
  127.    foreground and background colours. The COLOUR and INPUT keywords may be
  128.    used to assign default colour attributes for items not having a specific
  129.    colour attribute; this is the normal case.
  130.  
  131.    Many operations exist with the services provided to change attributes and
  132.    behaviour of the fields. These are described fully in the following text.
  133.  
  134.    Note that in the interest of retaining as much available dynamic memory as
  135.    possible for the application, forms should be unloaded after use with the
  136.    'tcu_unload_form' option. If a form is used repeatedly it is probably not
  137.    worth unloading it until the program is to terminate.
  138.  
  139.  
  140.    Databases
  141.    ---------
  142.  
  143.    The TCU database system is closely integrated with TCU forms. It is meant
  144.    to allow forms to be used to specify a record format conveniently and to
  145.    supplement this by allowing form records to be stored in a database with
  146.    keyed access. This offers the advantage that forms may be designed in the
  147.    traditional way, displayed and edited as usual, and saved and recalled by
  148.    using the TCU database services.
  149.  
  150.    Normally the forms will be displayed, but it is also possible to use the
  151.    form services to simply define record structures on which the database
  152.    services will operate. This implies that a 'tcu_load_form' call will be
  153.    made but no 'tcu_display_form'.
  154.  
  155.    The indexing strategy in TCU uses a fast, cached b-tree+ method to allow
  156.  
  157.  
  158.    rapid access to records of the database. The database may have up to 16
  159.    keys (which must be named fields of the form), with the first key acting
  160.    as the primary key. Searches are performed on the primary key, but the
  161.    full set of keys is used in ordering the records in the database. Note
  162.    that buttons, for obvious reasons, cannot be used as index keys. Keys
  163.    may additionally be specified to take ascending or descending sort order.
  164.  
  165.    The form must always be loaded when performing database functions. The
  166.    usual sequence of calls will be:
  167.  
  168.        stat = tcu_load_form (&my_form, "testform");
  169.        stat = tcu_db_open (&my_db, &my_form, "testdb", 1);
  170.          :          :          :          :          :
  171.        stat = tcu_db_close (&my_db);
  172.        stat = tcu_unload_form (&my_form);
  173.  
  174.    The database system maintains a concept of 'current location' which defines
  175.    which record is currently referenced. For example, calling 'tcu_db_read'
  176.    will read the 'current' record into the form structure (which in turn will
  177.    be displayed directly if the form is present on the screen). There are
  178.    services to move the pointer around the database and to move to a record
  179.    under search.
  180.  
  181.    A TCU database file is specified by a filepath without extension. Two
  182.    files will be generated when 'tcu_db_create' is called, one index with the
  183.    filetype '.cix' and one main database file with the filetype '.cdb'.
  184.  
  185.  
  186. Services
  187. --------
  188.  
  189. The following services should provide enough flexibility for you to define
  190. and use some nice little menus, prompts, notices and forms in some of your
  191. applications. If you get stuck and need an example, send me details and I'll
  192. try to help with the problem.
  193.  
  194.   Database Services
  195.   -----------------
  196.  
  197.     tcu_db_close                     Close the database files
  198.     tcu_db_create                    Create a new indexed database
  199.     tcu_db_delete                    Delete the current record
  200.     tcu_db_find                      Search for record with matching key
  201.     tcu_db_first                     Move DB pointer to first record
  202.     tcu_db_last                      Move DB pointer to last record
  203.     tcu_db_next                      Move DB pointer to next record
  204.     tcu_db_open                      Open an existing database
  205.     tcu_db_previous                  Move DB pointer to previous record
  206.     tcu_db_read                      Read the current record into form
  207.     tcu_read_index_field             Reads an index of the current record
  208.     tcu_db_remove                    Remove a database completely from disc
  209.     tcu_db_rewrite                   Rewrite an existing record to the DB
  210.     tcu_db_save                      Flush vital buffers to disc for safety
  211.     tcu_db_search                    Search for record with next highest key
  212.     tcu_db_set_search_mode           Change the mode for indexed searches
  213.     tcu_db_write                     Write a new record to the database
  214.  
  215.  
  216.   Menu Services
  217.   -------------
  218.  
  219.     tcu_change_menu_attribs          Changes colour attributes of menu
  220.     tcu_change_menu_escapes          Change valid menu escape keys
  221.     tcu_clear_menu_in_pulldown       Remove submenu of pulldown menu
  222.     tcu_define_menu                  Define a menu format
  223.     tcu_define_pulldown              Define a pulldown menu
  224.     tcu_display_pulldown_header      Display header line of pulldown
  225.     tcu_display_menu                 Display menu on screen
  226.     tcu_escape_fkey                  Find last used function key number
  227.     tcu_new_pulldown_cover           Reload screen memory under pulldown
  228.     tcu_read_menu_selection          Get user's menu choice
  229.     tcu_read_pulldown_selection      Get choice from pulldown menus
  230.     tcu_remove_menu                  Remove menu from screen
  231.     tcu_remove_pulldown              Remove pulldown menu & submenus
  232.     tcu_set_menu_help                Define help function for pulldown
  233.     tcu_set_menu_option              Enable or disable menu options
  234.     tcu_set_pulldown_help            Define help function for pulldown
  235.  
  236.  
  237.   Prompt Services
  238.   ---------------
  239.  
  240.     tcu_clear_notice                 Clear a prepared notice
  241.     tcu_display_notice               Display notice on screen
  242.     tcu_get_confirm                  Get user confirmation/rejection
  243.     tcu_notice_text                  Add line of text to prepared notice
  244.     tcu_prepare_notice               Initialise notice creation
  245.     tcu_prompt_input                 Enter an input area in a notice
  246.  
  247.   Form Services
  248.   -------------
  249.  
  250.     tcu_display_form                 Display defined form on screen
  251.     tcu_edit_form                    Interactive form edit
  252.     tcu_form_record_size             Returns the size of a form record
  253.     tcu_get_field                    Obtain field value from form
  254.     tcu_get_field_choice_string      Return the text of a Choice field
  255.     tcu_get_field_id                 Obtain numeric field ID from name
  256.     tcu_get_field_info               Obtains field information block
  257.     tcu_get_form_info                Obtains form infomation block
  258.     tcu_load_form                    Load form from .CFO form object
  259.     tcu_load_image_form              Load form from linked-in module
  260.     tcu_put_field                    Put value into form field
  261.     tcu_read_formrec                 Reads a form record from a buffer
  262.     tcu_remove_form                  Remove displayed form from screen
  263.     tcu_select_field                 Selects a field from a form
  264.     tcu_set_button_fn                Defines a form button field handler
  265.  
  266.  
  267.     tcu_set_field_attrib             Set colour attributes of field
  268.     tcu_set_field_mode               Set field characteristics
  269.     tcu_set_field_verify             Define field verification function
  270.     tcu_set_form_fnkey_fn            Establish fn. key handler for form
  271.     tcu_set_form_help                Define help function for form
  272.     tcu_set_form_mode                Set form characteristics
  273.     tcu_unload_form                  Unload form from memory
  274.     tcu_write_formrec                Writes a form record to a buffer
  275.  
  276.  
  277.   Window Services
  278.   ---------------
  279.  
  280.     tcu_change_colour                Change colours for subsequent I/O
  281.     tcu_clear_window                 Clear window and home cursor
  282.     tcu_close_window                 Remove window from screen
  283.     tcu_open_window                  Display window on screen
  284.     tcu_position_cursor              Set cursor position in window
  285.     tcu_wprintf                      Formatted window output
  286.     tcu_wgets                        Editable window input
  287.  
  288.   Miscellaneous Services
  289.   ----------------------
  290.  
  291.     tcu_colour_attrib                Get colour code for b/f colours
  292.     tcu_date_string                  Returns string form of a date type
  293.     tcu_date_value                   Returns date type of string form
  294.     tcu_get_user_keypress            Returns the last user defined key used
  295.     tcu_hash_value                   Return a hash-code for a string
  296.     tcu_restore_environment          Restores screen environment
  297.     tcu_save_environment             Saves screen environment
  298.     tcu_set_idle_loop                Establishes an idle loop handler
  299.     tcu_set_mouse_mode               Enables and disables mouse support
  300.     tcu_set_user_key_handler         Establishes an Escape/Accept key handler
  301.     tcu_warnbeep                     Produce standard TCU warning beep
  302.     _TCU_version                     Constant defining the version of TCU
  303.  
  304.  
  305.  
  306.  
  307. Mouse Support
  308. -------------
  309.  
  310. The presence of a mouse driver is detected automatically by TCU and used by
  311. default. The 'tcu_set_mouse_mode' service may be used to enable and disable
  312. the mouse.  The mouse may be used for menu option selection and form field
  313. selection. The mouse mode may be interactively toggled on and off by using
  314. the ALT-M key.
  315.  
  316.                        |     Left Button               Right Button
  317.    --------------------+----------------------------------------------------
  318.    Pulldown Menu Bar   |     Option Select             No Action
  319.    Pop-Up menu         |     Option Select             Menu Dismiss
  320.    Notices             |     Clears Notice             Clears Notice
  321.    Form Edit           |     Move to selected field.   Move to first field
  322.                        |     If button, selects it.
  323.    Field Select        |     Select Field              Move to first field
  324.    Confirmation Box    |     Confirm                   Reject
  325.  
  326.  
  327. tcu_change_colour
  328. -----------------
  329.  
  330. Function      Changes the background and foreground colours for window I/O
  331.  
  332. Syntax        #include <usr\tcu.h>
  333.               int tcu_change_colour (TCU_WINDOW *window,
  334.                                      unsigned char attribute)
  335.  
  336. Remarks       'window' defines the window to be affected. 'attribute' is the
  337.               colour attribute and may be obtained with the 'colour_attrib'
  338.               service.
  339.  
  340. Return Value  Returns TCU_OK on success, TCU_ERROR on error.
  341.  
  342.  
  343. tcu_change_menu_attribs
  344. -----------------------
  345.  
  346. Function      Changes a colour attribute of a menu. The menu must be defined
  347.               but need not be displayed.
  348.  
  349. Syntax        #include <usr\tcu.h>
  350.               int tcu_change_menu_attribs (TCU_MENU *menu,
  351.                                            int item,
  352.                                            unsigned char attribute)
  353.  
  354. Remarks       'item' identifies the attribute to change and must be one of
  355.               the following defined in 'TCU.H':
  356.  
  357.                     TCU_MENU_TITLE        Title of the menu
  358.                     TCU_MENU_BOX          Surrounding box of the menu
  359.                     TCU_MENU_OPTION       Option lines
  360.                     TCU_MENU_SELECT       Currently selected option line
  361.                     TCU_MENU_UNAVAIL      Unavailable option lines
  362.  
  363.               'attribute' describes the new colour attribute to be used for
  364.               the selected item. It may be formed by using the 'menu_attrib'
  365.               function.
  366.  
  367.               If the menu is currently displayed, the attribute will take
  368.               effect on the screen immediately.
  369.  
  370. Return Value  Returns TCU_OK if the attribute change was successful and
  371.               TCU_ERROR if an error was encountered. An error is likely to
  372.               be due to a bad item specification or an undefined menu.
  373.  
  374.  
  375. tcu_change_menu_escapes
  376. -----------------------
  377.  
  378. Function      Changes the valid escape keys for a menu.
  379.  
  380. Syntax        #include <usr\tcu.h>
  381.               int tcu_change_menu_escapes (TCU_MENU *menu,
  382.                                            unsigned char escape_keys)
  383.  
  384. Remarks       The escape keys define which keys are allowed to terminate the
  385.               interactive menu selection called with 'tcu_read_menu_selection'.
  386.               'escape_keys' is formed by logically ORing the following:
  387.  
  388.                     TCU_ESC_ESC         ESC key
  389.                     TCU_ESC_PGUP        PgUp (Page Up) key
  390.                     TCU_ESC_PGDN        PgDn (Page Down) key
  391.                     TCU_ESC_CLEFT       Left arrow key
  392.                     TCU_ESC_CRIGHT      Right arrow key
  393.                     TCU_ESC_FUNC        Function key (F2 - F12) or User Key
  394.                     TCU_ESC_CNTL_C      CNTL/C key (ASCII 3)
  395.  
  396.               The RETURN key is always a valid escape key, selecting the
  397.               currently selected menu option.
  398.  
  399.               Note that F1 is reserved for help activation.
  400.  
  401.               The TCU_ESC_FUNC mask allows either function keys or user
  402.               defined escape/accept keys to exit the menu select.
  403.  
  404. Return Value  If the escape key change was successful, TCU_OK is returned,
  405.               otherwise TCU_ERROR is returned.
  406.  
  407.  
  408. tcu_clear_menu_in_pulldown
  409. --------------------------
  410.  
  411. Function      Removes a menu which is displayed under control of a pulldown
  412.               menu line.
  413.  
  414. Syntax        #include <usr\tcu.h>
  415.               int tcu_clear_menu_in_pulldown (TCU_PULLDOWN *pmenu);
  416.  
  417. Remarks       This service should be used when a pop-up menu displayed under
  418.               control of a pulldown menu is to be removed from the screen.
  419.               Do not try to call 'tcu_remove_menu' directly as the pulldown
  420.               menu will become inconsistent with what is on the screen.
  421.  
  422. Return Value  TCU_OK if the call was successful, otherwise TCU_ERROR.
  423.  
  424.  
  425. tcu_clear_notice
  426. ----------------
  427.  
  428. Function      Removes a notice/prompt definition from memory.
  429.  
  430. Syntax        #include <usr\tcu.h>
  431.               int tcu_clear_notice (TCU_NOTICE *notice)
  432.  
  433. Remarks       The definition of a notice or prompt is removed with the
  434.               call to 'tcu_clear notice'. An intervening 'tcu_prepare_notice'
  435.               call is required before using 'tcu_display_notice'.
  436.  
  437. Return Value  Returns TCU_OK if the service was executed successfully,
  438.               otherwise TCU_ERROR is returned.
  439.  
  440.  
  441. tcu_clear_window
  442. ----------------
  443.  
  444. Function      Clears the window and homes the cursor.
  445.  
  446. Syntax        #include <usr\tcu.h>
  447.               int tcu_clear_window (TCU_WINDOW *window)
  448.  
  449. Remarks       The window is cleared with the currently active background
  450.               colour. The cursor is relocated to (1,1) relative to the
  451.               window.
  452.  
  453. Return Value  Returns TCU_OK on success, TCU_ERROR on error.
  454.  
  455.  
  456. tcu_close_window
  457. ----------------
  458.  
  459. Function      Close and remove a window from the screen.
  460.  
  461. Syntax        #include <usr\tcu.h>
  462.               int tcu_close_window (TCU_WINDOW *window)
  463.  
  464. Remarks       The window is removed from the screen, the old screen contents
  465.               restored and the window memory is released to the system.
  466.  
  467. Return Value  Returns TCU_OK on success, TCU_ERROR on error.
  468.  
  469.  
  470. tcu_colour_attrib
  471. -----------------
  472.  
  473. Function      Forms a colour attribute from the foreground and background
  474.               colour attributes.
  475.  
  476. Syntax        #include <usr\tcu.h>
  477.               unsigned char tcu_colour_attrib (int foreground,
  478.                                                int background)
  479.  
  480. Remarks       'tcu_colour_attrib' may be used to form the colour attribute
  481.               required by other menu and notice services. 'background' and
  482.               'foreground' represent the foreground colour and background
  483.               background colour respectively. Any colour defined in 'conio.h'
  484.               may be used if it is valid with the hardware being used.
  485.  
  486.               The standard symbol BLINK may be added to the foreground colour
  487.               to obtain a blinking foreground.
  488.  
  489. Return Value  Returns a compound colour attribute code.
  490.  
  491.  
  492. tcu_date_string
  493. ---------------
  494.  
  495. Function      Obtains the character string representation of a date value.
  496.  
  497. Syntax        #include <usr\tcu.h>
  498.               char *tcu_date_string (unsigned short date,
  499.                                      unsigned char presentation);
  500.  
  501. Remarks       Returns a pointer to a static string buffer of 8 characters
  502.               which is overwritten with each call. 'date' specifies the
  503.               date value, i.e. val.v_date of TCU_FIELD_VALUE. 'presentation'
  504.               specifies either TCU_FLD_DAYFIRST or TCU_FLD_MONTHFIRST.
  505.  
  506. Return Value  Returns a pointer to the static date string data.
  507.  
  508.  
  509. tcu_date_value
  510. --------------
  511.  
  512. Function      Returns a date type of a character date string.
  513.  
  514. Syntax        #include <usr\tcu.h>
  515.               unsigned short tcu_date_value (char *date,
  516.                                              unsigned char presentation);
  517.  
  518. Remarks       Returns the date value of type val.v_date of TCU_FIELD_VALUE for
  519.               the specified string 'date'. 'presentation' specifies either
  520.               TCU_FLD_DAYFIRST or TCU_FLD_MONTHFIRST.
  521.  
  522. Return Value  Returns the date type.
  523.  
  524.  
  525. tcu_db_close
  526. ------------
  527.  
  528. Function      Closes an open TCU database.
  529.  
  530. Syntax        #include <usr\tcu.h>
  531.               int tcu_db_close (TCU_DB *db)
  532.  
  533. Remarks       The database file and its associated index are closed.
  534.  
  535. Return Value  TCU_OK if successful, TCU_ERROR is an error is encountered.
  536.  
  537.  
  538. tcu_db_create
  539. -------------
  540.  
  541. Function      Creates a new TCU database or overwrites an existing one.
  542.  
  543. Syntax        #include <usr\tcu.h>
  544.               int tcu_db_create (TCU_DB *db,
  545.                                  TCU_FORM *form,
  546.                                  char *dbname,
  547.                                  int duplicates,
  548.                                  char *idx_name_1,
  549.                                 [char *idx_name_2,]
  550.                                 [...,]
  551.                                  NULL)
  552.  
  553. Remarks       This service creates the index file and main database file
  554.               associated with the specified 'form'. The user declared 'db'
  555.               structure is initialised. The database name, 'dbname' is used
  556.               to create the index (filetype .cix) and the database (.cdb).
  557.               'duplicates' should be set to 0 to disable records with
  558.               duplicate primary keys and 1 to allow duplicates.
  559.  
  560.               One or more form field names must be specified as key fields
  561.               terminated with NULL. The specified names must match the names
  562.               given in the form definition file.  The first key is the prime
  563.               key which is used for search operations.  Records are sorted in
  564.               the database according to all indices specified.  Up to 16
  565.               indices may be specified in the call.  The default index order
  566.               is for ascendng keys.  If an index should be ordered as a
  567.               descending key, the '^' character should be added to the form
  568.               field name as a suffix.  For example, if the prime key is to
  569.               be a date field defined in the form file as 'ORD_DATE' and it
  570.               is to be keyed as a descending key, it should be specified as
  571.               "ORD_DATE^" in the call to 'tcu_db_create'.
  572.  
  573.               Following the creation of the database, it remains open until a
  574.               call to 'tcu_db_close' is made.
  575.  
  576. Return Value  TCU_OK indicates successful creation.  TCU_ERROR indicates an
  577.               error condition.  The most likely error cases are:
  578.  
  579.                    o   Form specified is not open (loaded);
  580.                    o   One or more of the specified indices has a name
  581.                        which is either invalid or not part of the form;
  582.                    o   Too few (<1) or too many (>16) indices specified;
  583.                    o   The total key size exceeds the maximum key size;
  584.                    o   Filing error, write-protect, disc full, etc.
  585.  
  586.  
  587. tcu_db_delete
  588. -------------
  589.  
  590. Function      Deletes the current record from the database.
  591.  
  592. Syntax        #include <usr\tcu.h>
  593.               int tcu_db_delete (TCU_DB *db)
  594.  
  595. Remarks       Removes the current record from 'db'.  If no current record is
  596.               defined service will fail.
  597.  
  598.               After deletion, the current record pointer will point to the
  599.               record after that which was deleted.  If the deleted record was
  600.               at the end of the database, the current record pointer becomes
  601.               undefined.
  602.  
  603. Return Value  TCU_OK if successful deletion, TCU_ERROR if an error occurred,
  604.               most likely from an attempt to make a deletion when the current
  605.               record pointer was undefined.
  606.  
  607.  
  608. tcu_db_find
  609. -----------
  610.  
  611. Function      Locates a record with matching primary key in the database.
  612.  
  613. Syntax        #include <usr\tcu.h>
  614.               int tcu_db_find (TCU_DB *db,
  615.                                TCU_FIELD_VALUE *val)
  616.  
  617. Remarks       'val' must be preloaded with the correct type for the primary
  618.               key of 'db'.  The service finds the first record with a matching
  619.               primary key.  For string field searches, the default is for a
  620.               search ignoring trailing spaces, but case significant.  These
  621.               defaults may be overridden with the 'tcu_db_set_search_mode'
  622.               service.
  623.  
  624. Return Value  TCU_OK if a match was found, else TCU_ERROR and the current
  625.               record pointer remains unchanged.
  626.  
  627.  
  628. tcu_db_first
  629. ------------
  630.  
  631. Function      Moves record pointer to the first record in the database.
  632.  
  633. Syntax        #include <usr\tcu.h>
  634.               int tcu_db_first (TCU_DB *db)
  635.  
  636. Remarks       Moves the current record pointer to the first record in 'db'.
  637.               If no records exist, the service will fail.
  638.  
  639. Return Value  TCU_OK if successful, TCU_ERROR if no records in the database.
  640.  
  641.  
  642. tcu_db_last
  643. -----------
  644.  
  645. Function      Moves record pointer to the last record in the database.
  646.  
  647. Syntax        #include <usr\tcu.h>
  648.               int tcu_db_last (TCU_DB *db)
  649.  
  650. Remarks       Moves the current record pointer to the last record in 'db'.
  651.               If no records exist, the service will fail.
  652.  
  653. Return Value  TCU_OK if successful, TCU_ERROR if no records in the database.
  654.  
  655.  
  656. tcu_db_next
  657. -----------
  658.  
  659. Function      Moves record pointer to the next record in the database.
  660.  
  661. Syntax        #include <usr\tcu.h>
  662.               int tcu_db_next (TCU_DB *db)
  663.  
  664. Remarks       Moves the current record pointer to the next record in 'db'.
  665.               If the pointer was already at the end of the database, it
  666.               becomes undefined with this call and the call fails.
  667.  
  668. Return Value  TCU_OK if successful, TCU_ERROR if no records or already at
  669.               end of database.
  670.  
  671.  
  672. tcu_db_open
  673. -----------
  674.  
  675. Function      Opens an existing TCU database.
  676.  
  677. Syntax        #include <usr\tcu.h>
  678.               int tcu_db_open (TCU_DB *db,
  679.                                TCU_FORM *form,
  680.                                char *dbname,
  681.                                int duplicates)
  682.  
  683. Remarks       Opens 'dbname' using 'form'.  The specified 'form' must be the
  684.               same as the form used at creation time.  The form need not be
  685.               identical, but must possess the same fields with the same types
  686.               and lengths as when the database was created.  The form must
  687.               already be open.  The user defined structure 'db' is loaded with
  688.               the initial database data which is required for subsequent calls
  689.               to database services.
  690.  
  691.               If records with duplicate keys are to be permitted, 'duplicates'
  692.               should be 1, else it should be 0.
  693.  
  694. Return Value  TCU_OK if the open was successful, else TCU_ERROR.  Most likely
  695.               failure cases are:
  696.  
  697.                    o   Form specified is not open (loaded);
  698.                    o   One or more of the indices in the database is not
  699.                        part of the form;
  700.                    o   The total key size exceeds the maximum key size or
  701.                        the total form record size is different to that when
  702.                        the database was created;
  703.                    o   The database and/or index header is invalid;
  704.                    o   Filing error, write-protect, disc full, etc.
  705.  
  706.  
  707. tcu_db_previous
  708. ---------------
  709.  
  710. Function      Moves record pointer to the previous record in the database.
  711.  
  712. Syntax        #include <usr\tcu.h>
  713.               int tcu_db_previous (TCU_DB *db)
  714.  
  715. Remarks       Moves the current record pointer to the previous record in
  716.               'db'. If the pointer was already at the start of the database,
  717.               it becomes undefined with this call and the call fails.
  718.  
  719. Return Value  TCU_OK if successful, TCU_ERROR if no records or already at
  720.               start of database.
  721.  
  722.  
  723. tcu_db_read
  724. -----------
  725.  
  726. Function      Reads the current database record into the form.
  727.  
  728. Syntax        #include <usr\tcu.h>
  729.               int tcu_db_read (TCU_DB *db)
  730.  
  731. Remarks       Loads the current record into the form structure which was
  732.               specified at creation or open time.  Fields are validated in
  733.               the usual way according to form range specifications and/or
  734.               user defined verification functions.
  735.  
  736.               If the form is currently displayed, it will be updated with the
  737.               new fields immediately with this call.
  738.  
  739. Return Value  TCU_OK if the read was successful, TCU_ERROR if the current
  740.               record pointer is undefined.
  741.  
  742.  
  743. tcu_db_read_index_field
  744. -----------------------
  745.  
  746. Function      Reads an index field of the current record.
  747.  
  748. Syntax        #include <usr\tcu.h>
  749.               int tcu_db_read_index_field (TCU_DB *db,
  750.                                            int index_id,
  751.                                            TCU_FIELD_VALUE *val)
  752.  
  753. Remarks       This service loads the 'val' structure with the value of the
  754.               specified index field of database 'db'.  'index_id' specifies
  755.               which index field is to be obtained.  1 represents the first
  756.               and primary index, 2 the next, etc.
  757.  
  758.               If the current record pointer is undefined the service will
  759.               fail.
  760.  
  761. Return Value  TCU_OK if the field was successfully read else TCU_ERROR if the
  762.               current record pointer is undefined.
  763.  
  764.  
  765. tcu_db_remove
  766. -------------
  767.  
  768. Function      Erases a database from disc.
  769.  
  770. Syntax        #include <usr\tcu.h>
  771.               int tcu_db_remove (char *dbname)
  772.  
  773. Remarks       The database should be closed.  This service physically removes
  774.               the database and its associated index from disc.
  775.  
  776. Return Value  TCU_OK if successful, TCU_ERROR if an error occurred.
  777.  
  778.  
  779. tcu_db_rewrite
  780. --------------
  781.  
  782. Function      Writes an existing form record to the database.
  783.  
  784. Syntax        #include <usr\tcu.h>
  785.               int tcu_db_rewrite (TCU_DB *db)
  786.  
  787. Remarks       This service writes the contents of the form to the database.
  788.               The key fields in the form should constitute a record which
  789.               already exists in the database.  The current field pointer is
  790.               adjusted to point at the newly added record.
  791.  
  792.               'tcu_db_rewrite' is normally used for performing in-place
  793.               updates of records.
  794.  
  795. Return Value  TCU_OK if the write was successful, TCU_ERROR if an error
  796.               occurred or if a record with similar key does not exist in the
  797.               database.
  798.  
  799.  
  800. tcu_db_save
  801. -----------
  802.  
  803. Function      Flushes critical database buffers to disc.
  804.  
  805. Syntax        #include <usr\tcu.h>
  806.               int tcu_db_save (TCU_DB *db)
  807.  
  808. Remarks       This service is used for force all control data for an open
  809.               database to be written to disc.  It does not change the current
  810.               record pointer, nor does it close the database.  The call should
  811.               be made when a failure or program crash could cost database
  812.               integrity.  E.g. a call could be made to 'tcu_db_save' before
  813.               performing any service which could allow DOS to abort the
  814.               program through its critical error handler.
  815.  
  816.               The service is an alternative to closing and reopening the
  817.               database, and has the advantage that it maintains the current
  818.               record pointer.
  819.  
  820. Return Value  TCU_OK if the flush was successful, else TCU_ERROR.
  821.  
  822.  
  823. tcu_db_search
  824. -------------
  825.  
  826. Function      Locates a record with equal or higher primary key.
  827.  
  828. Syntax        #include <usr\tcu.h>
  829.               int tcu_db_search (TCU_DB *db,
  830.                                  TCU_FIELD_VALUE *val)
  831.  
  832. Remarks       The search function attempts to locate a record with an equal or
  833.               higher primary key.  It is convenient when only the first part
  834.               of the key is known.  If the call is successful, the current
  835.               record pointer will point to the record found.
  836.  
  837. Return Value  TCU_OK if a record is located else TCU_ERROR with no change in
  838.               the current record pointer.
  839.  
  840.  
  841. tcu_db_set_search_mode
  842. ----------------------
  843.  
  844. Function      Changes search mode for string keys.
  845.  
  846. Syntax        #include <usr\tcu.h>
  847.               int tcu_db_set_search_mode (TCU_DB *db,
  848.                                           int mode)
  849.  
  850. Remarks       The usual search mode for strings is to ignore trailing spaces
  851.               but to be case sensitive.  These defaults may be changed by
  852.               specifiying 'mode' for the database.  'mode' should be one of
  853.               the following:
  854.  
  855.                    TCU_DB_TRIM_SPACES          Ignore trailing spaces
  856.                    TCU_DB_NO_TRIM_SPACES       Treat all spaces as significant
  857.                    TCU_DB_IGNORE_CASE          Ignore case
  858.                    TCU_DB_NO_IGNORE_CASE       Treat case as significant
  859.  
  860. Return Value  TCU_OK if the mode was successfully changed else TCU_ERROR.
  861.  
  862.  
  863. tcu_db_write
  864. ------------
  865.  
  866. Function      Writes a form record to the database.
  867.  
  868. Syntax        #include <usr\tcu.h>
  869.               int tcu_db_write (TCU_DB *db)
  870.  
  871. Remarks       The form record is written to the database indexed on the
  872.               fields specified at database creation time.  The current
  873.               record pointer is moved to the newly written record.  If the
  874.               record is a duplicate and the database was created or opened
  875.               with no duplicates specified then the call will fail.
  876.  
  877. Return Value  TCU_OK if the record was successfully written.  TCU_ERROR if an
  878.               error occurred or a duplicate record clash was detected.
  879.  
  880.  
  881. tcu_define_menu
  882. ---------------
  883.  
  884. Function      Establish a definition for a menu, comprising characteristics
  885.               and content.
  886.  
  887. Syntax        #include <usr\tcu.h>
  888.               int tcu_define_menu (TCU_MENU *menu,
  889.                                    char *title,
  890.                                    unsigned char title_attrib,
  891.                                    unsigned char box_attrib,
  892.                                    unsigned char option_attrib,
  893.                                    unsigned char select_attrib,
  894.                                    unsigned char unavail_attrib,
  895.                                    unsigned char escape_keys,
  896.                                    unsigned char box_type,
  897.                                    char *options[],
  898.                                    unsigned char hot_key_attrib)
  899.  
  900. Remarks       Uses the user declared element 'menu' to build a menu prototype
  901.               for subsequent menu functions.  'menu' is the address of a MENU
  902.               type.  It is initialised with the call to define_menu and used
  903.               in subsequent menu functions.  'title' is an optional title for
  904.               the menu which, if present, will be displayed in the menu header
  905.               line.  'title_attrib' defines the colour attributes of the title
  906.               of the menu.  'box_attrib' defines the attributes of the menu
  907.               border.  'option_attrib' defines the attributes of the choices
  908.               of the menu.  'select_attrib' defines the attributes of the
  909.               currently selected menu option.  'unavail_attrib' defines the
  910.               attributes of menu options currently unavailable.  'escape_keys'
  911.               defines the set of keys permitted to exit from the menu select.
  912.               'box_type' defines the type of the surrounding menu box.
  913.  
  914.               The attributes may be formed by using the function 'menu_attrib'
  915.               which builds the attribute byte.  The two parameters are
  916.               foreground colour and background colour, and the return value
  917.               is of type attribute, i.e. unsigned char.
  918.  
  919.               'escape_keys' is formed by logically ORing the following,
  920.               depending on which should be permitted to exit the menu choice.
  921.               The RETURN key is always valid for actively selecting the
  922.               current choice.
  923.  
  924.                     TCU_ESC_ESC         ESCAPE key
  925.                     TCU_ESC_PGUP        Page Up key
  926.                     TCU_ESC_PGDN        Page Down key
  927.                     TCU_ESC_CLEFT       Left arrow key
  928.                     TCU_ESC_CRIGHT      Right arrow key
  929.                     TCU_ESC_FUNC        An unshifted function key F2 - F12
  930.                     TCU_ESC_CNTL_C      The CNTL/C key (ASCII 3)
  931.  
  932.               Note that F1 is reserved for help activation.
  933.  
  934.               'box_type' defines whether the box is singly or doubly lined
  935.               and is one of the following:
  936.  
  937.                     TCU_BOX_SINGLE      Single line surround
  938.                     TCU_BOX_DOUBLE      Double line surround
  939.                     TCU_BOX_BLANK       Surrounded by blank spaces
  940.  
  941.               'options' is a pointer to an array of the character strings
  942.               defining the menu choices. If 'hot_key_attrib' is non-zero
  943.               it should be a valid colour attribute used to display the
  944.               hot key character of a menu selection. When hot keys are
  945.               used, the FIRST character of each of the menu option strings
  946.               should be used to identify the character occurring in the rest
  947.               of the option string which is to be used as the hot key. E.g.,
  948.               the string "PDisPlay Customer" would use 'P' as the hot-key.
  949.               Note that only the first character matching the hot-key may
  950.               be used. If 'hot_key_attrib' is zero, no hot-keys will be
  951.               used at all.
  952.  
  953. Return Value  define_menu returns TCU_OK if the call was successful or
  954.               TCU_ERROR if an error was detected in the processing.
  955.  
  956.  
  957. tcu_define_pulldown
  958. -------------------
  959.  
  960. Function      Defines a pulldown menu ready for display and activation.
  961.  
  962. Syntax        #include <usr\tcu.h>
  963.               int tcu_define_pulldown (TCU_PULLDOWN *pmenu,
  964.                                        unsigned char line_colour,
  965.                                        unsigned char option_colour,
  966.                                        unsigned char select_colour,
  967.                                        char *titles[],
  968.                                        unsigned char hot_key_attrib,
  969.                                        TCU_MENU *menus[]);
  970.  
  971. Remarks       Defines a pulldown menu. 'pmenu' specifies the menu to be
  972.               defined, and should be declared by the caller. 'line_colour',
  973.               'option_colour' and 'select_colour' specify the colours of the
  974.               pulldown header line, the title texts and the currently selected
  975.               title respectively. The function 'tcu_colour_attrib' may be used
  976.               to obtain the compound colour codes for these colours.
  977.  
  978.               'titles' is an array of strings which contain the titles used
  979.               in the header line. This list must be terminated with a NULL
  980.               pointer. If 'hot_key_attrib' is non-zero it should be a valid
  981.               colour attribute used to display the hot key character of a
  982.               pulldown menu selection. When hot keys are used, the FIRST
  983.               character of each of the title strings should be used to
  984.               identify the character occurring in the rest of the title
  985.               string which is to be used as the hot key. E.g., the string
  986.               "fConfiguration Menu" would use 'f' as the hot-key and will
  987.               highlight that character with the specified attributes in
  988.               the title when not selected. Note that only the first character
  989.               matching the hot-key may be used. If 'hot_key_attrib' is zero,
  990.               no hot-keys will be used at all.
  991.  
  992.               'menus' is a pointer to an array of menus. These menus are
  993.               normal menus defined with 'tcu_define_menu', and may also be
  994.               used outside the control of the pulldown menu.  Note that if a
  995.               pulldown menu title is to have no associated menu, the pointer
  996.               in that position should contain NULL.
  997.  
  998. Return Value  Returns TCU_OK if the definition was successful, otherwise
  999.               returns TCU_ERROR.
  1000.  
  1001.  
  1002. tcu_display_form
  1003. ----------------
  1004.  
  1005. Function      Displays a loaded form on the screen.
  1006.  
  1007. Syntax        #include <usr\tcu.h>
  1008.               int tcu_display_form (TCU_FORM *form,
  1009.                                     int x_pos,
  1010.                                     int y_pos)
  1011.  
  1012. Remarks       The form to be displayed must have been loaded with a call
  1013.               to 'tcu_load_form'. 'form' specifies the address of a form
  1014.               object. 'x_pos' and 'y_pos' specify the top-left corner of
  1015.               the form. It is the callers responsibility to ensure that
  1016.               the form to be displayed has room on the screen for the
  1017.               specified position.
  1018.  
  1019. Return Value  Returns TCU_OK is successful, otherwise TCU_ERROR.
  1020.  
  1021.  
  1022. tcu_display_menu
  1023. ----------------
  1024.  
  1025. Function      Uses a predefined menu to display the menu on the screen
  1026.               ready for interactive selection.
  1027.  
  1028. Syntax        #include <usr\tcu.h>
  1029.               int tcu_display_menu (TCU_MENU *menu,
  1030.                                     int x_pos,
  1031.                                     int y_pos)
  1032.  
  1033. Remarks       Displays a menu on the screen.  No waiting for user input is
  1034.               performed; the menu is displayed and control returns to the
  1035.               caller.
  1036.  
  1037.               'menu' is the address of a MENU type initialised with the
  1038.               'tcu_define_menu' service.  'x_pos' and 'y_pos' define the
  1039.               screen position of the top-left corner of the menu.  Note that
  1040.               the top-left corner of the screen is (1, 1).
  1041.  
  1042. Return Value  The service returns TCU_OK if the menu was successfully
  1043.               displayed and TCU_ERROR if an error condition was encountered.
  1044.  
  1045.  
  1046. tcu_display_notice
  1047. ------------------
  1048.  
  1049. Function      Displays a notice or prompt on the screen.
  1050.  
  1051. Syntax        #include <usr\tcu.h>
  1052.               int tcu_display_notice (TCU_NOTICE *notice,
  1053.                                       int x_pos,
  1054.                                       int y_pos)
  1055.  
  1056. Remarks       The notice/prompt is displayed with the top-left corner at
  1057.               the position specified by 'x_pos' and 'y_pos'. If the notice
  1058.               includes a prompt field, it may be interactively edited after
  1059.               this call. The completion of a prompt input completes this
  1060.               service and removes the prompt from the screen (though does
  1061.               not remove its definition from memory until a call to the
  1062.               'tcu_clear_notice' service. If the notice contains no prompt
  1063.               input the user must press to RETURN key, the ESC key or a mouse
  1064.               button to complete the call.
  1065.  
  1066.               Note that with prompts, if the input field returns with a
  1067.               length of -1, the user cancelled the input with the ESC key.
  1068.               Since the length is a character type the caller must be sure
  1069.               that the test against -1 is performed as a 'signed char' test,
  1070.               either by using default signed characters, casting or testing
  1071.               against the value 0xFF rather than -1.
  1072.  
  1073. Return Value  TCU_OK if successful, else TCU_ERROR.
  1074.  
  1075.  
  1076. tcu_display_pulldown_header
  1077. ---------------------------
  1078.  
  1079. Function      Displays the header line of a pulldown menu without waiting for
  1080.               a selection.
  1081.  
  1082. Syntax        #include <usr\tcu.h>
  1083.               int tcu_display_pulldown_header (TCU_PULLDOWN *pulldown)
  1084.  
  1085. Remarks       The header line for the pulldown menu 'pulldown' is displayed.
  1086.               The pulldown menu must already have been defined. The function
  1087.               is exactly as 'tcu_read_pulldown_selection' without the actual
  1088.               selection of an item.
  1089.  
  1090. Return Value  Returns TCU_OK if successful, else TCU_ERROR.
  1091.  
  1092.  
  1093. tcu_edit_form
  1094. -------------
  1095.  
  1096. Function      Interactively edit a loaded and displayed form.
  1097.  
  1098. Syntax        #include <usr\tcu.h>
  1099.               int tcu_edit_form (TCU_FORM *form,
  1100.                                  int start_field_id,
  1101.                                  int *keypress)
  1102.  
  1103. Remarks       The form may be interactively edited using the form and field
  1104.               attributes and characteristics that exist at the time of the
  1105.               call. 'form' specifies the address of a form object. The start
  1106.               field-ID may be specified with 'start_field_id'. If set to 1,
  1107.               the first valid field will be used. 'keypress' specifies the
  1108.               address of an integer which will indicate the key used to escape
  1109.               from the form input. 'keypress' will be one of the following
  1110.               symbols:
  1111.  
  1112.                 TCU_FLD_ESCESC      ESCAPE key used to quit
  1113.                 TCU_FLD_ESCCNTL     CNTL/C key used to abort
  1114.                 TCU_FLD_FNKEYESC    ESCAPE requested from function key handler
  1115.                 TCU_FLD_BUTTONESC   ESCAPE requested from button handler
  1116.                 TCU_FLD_ESCPGUP     PgUp key
  1117.                 TCU_FLD_ESCPGDN     PgDn key
  1118.                 TCU_FLD_FNKEYSAVE   PgUp requested from function key handler
  1119.                 TCU_FLD_BUTTONSAVE  PgUp requested from button handler
  1120.  
  1121.               The first four codes reflect that the form was exited abnormally
  1122.               and the field values remain as they were before the edit. The
  1123.               latter four are normal returns, and the form will have been
  1124.               updated to reflect the edits made. If the form has been set to
  1125.               'no escape keys' mode with 'tcu_set_form_mode' and the
  1126.               TCU_FORM_NOESCS parameter, only the button and function keys
  1127.               returns will be returned as the keyboard escape keys are blocked
  1128.               at a lower level.
  1129.  
  1130.               NOTE: Editing keys in a form are as follows:
  1131.  
  1132.                     ->          : Move right one character
  1133.                     <-          : Move left one character
  1134.                     Up Arrow    : Move to previous field
  1135.                     Down Arrow  : Move to next field
  1136.                     Home        : Move to first character in field
  1137.                     End         : Move to last character in field
  1138.                     CNTL PgUp   : Move to first field in form
  1139.                     CNTL PgDn   : Move to last field in form
  1140.                     F1          : Help
  1141.                     CNTL Home   : Restore contents of field as when entered
  1142.                     CNTL End    : Clear field
  1143.                     INSERT      : Toggle insert mode
  1144.                     BACKSPACE   : Delete character to the left of the cursor
  1145.                     Del         : Delete character under the cursor
  1146.                     ESC         : Escape (cancel) form edit
  1147.                     CNTL/C      : Escape (abort) form edit
  1148.                     PgUp        : Accept form edit
  1149.                     PgDn        : Accept form edit
  1150.  
  1151. Return Value  TCU_OK if the edit was successful, otherwise TCU_ERROR.
  1152.  
  1153.  
  1154. tcu_escape_fkey
  1155. ---------------
  1156.  
  1157. Function      Returns the last function key number used to escape a menu.
  1158.  
  1159. Syntax        #include <usr\tcu.h>
  1160.               int tcu_escape_fkey (void)
  1161.  
  1162. Remarks       If the function key escape mode is enabled, i.e., the option
  1163.               TCU_MENU_FUNC is set in the escape keys of the menu, and the
  1164.               menu was terminated with a FN key ('tcu_read_menu_selection'
  1165.               returned -TCU_ESC_FUNC), 'tcu_escape_fkey' will return the
  1166.               function key used to leave the menu.
  1167.  
  1168. Return Value  Returns 0 if no function key has been used, otherwise the
  1169.               number of the function key, 1 = F2, 2 = F2, etc. 12 is the
  1170.               last function key used. Keys F11 and F12 on may only be used
  1171.               on machines with BIOS support for extended keyboards. Note that
  1172.               the F1 key is reserved for activation of a user defined help
  1173.               function.
  1174.  
  1175.  
  1176. tcu_form_record_size
  1177. --------------------
  1178.  
  1179. Function      Obtains the size in bytes of a complete form record.
  1180.  
  1181. Syntax        #include <usr\tcu.h>
  1182.               int tcu_form_record_size (TCU_FORM *form)
  1183.  
  1184. Remarks       This service is used to obtain the size of a buffer required
  1185.               to hold the fields of a complete form.  It is normally used
  1186.               in conjunction with the 'tcu_read_formrec' service and the
  1187.               'tcu_write_formrec' service.
  1188.  
  1189. Return Value  Returns the size in bytes of a complete form record or -1 if
  1190.               an error was encountered.
  1191.  
  1192.  
  1193. tcu_get_confirm
  1194. ---------------
  1195.  
  1196. Function      Queries the user for confirmation or rejection
  1197.  
  1198. Syntax        #include <usr\tcu.h>
  1199.               int tcu_get_confirm (int x,
  1200.                                    int y,
  1201.                                    unsigned char box_attrib,
  1202.                                    unsigned char text_attrib,
  1203.                                    char *text,
  1204.                                    ...)
  1205.  
  1206. Remarks       Queries the user for confirmation of the 'text' which is
  1207.               displayed in a box with colour attributes 'box_attrib' at
  1208.               position (x,y). The text is displayed with attributes
  1209.               'text_attrib'. The user may enter 'y', 'Y', 'n', 'N' or a
  1210.               mouse button (left = confirm, right = reject) to confirm or
  1211.               reject. 
  1212.  
  1213.               If the confirmation box would lie outside the screen area,
  1214.               the confirmation text is changed automatically to the string
  1215.               "Confirm (Y,N)?" and placed in the upper-left corner of the
  1216.               screen.
  1217.  
  1218. Return Value  Returns 0 for rejection or 1 for confirmation.
  1219.  
  1220.  
  1221. tcu_get_field
  1222. -------------
  1223.  
  1224. Function      Obtains a value for a form field.
  1225.  
  1226. Syntax        #include <usr\tcu.h>
  1227.               int tcu_get_field (TCU_FORM *form,
  1228.                                  int field,
  1229.                                  TCU_FIELD_VALUE *val)
  1230.  
  1231. Remarks       'form' specifies the form object. 'field' is the field ID of
  1232.               the field of which the value is to be obtained. 'val' is the
  1233.               address of a TCU_FIELD_VALUE type object. The field value is a
  1234.               structure which must be addressed according to the type of the
  1235.               field (which should be known by the caller). The fields of the
  1236.               structure are:
  1237.  
  1238.                         v_int        : 32-bit signed integer for integers
  1239.                         v_float      : 64-bit floating value for real types
  1240.                         v_string     : Pointer to the string value
  1241.                         v_date       : 16-bit integer coded date
  1242.                         v_logical    : 8-bit data, 0 = FALSE, 1 = TRUE
  1243.                         v_choice.sel : 16-bit integer enumerated pointer
  1244.  
  1245.               String values are copied into the user's calling address. This
  1246.               means that 'v_string' should be set to point at the address
  1247.               where the string is to be received. Failing to do this will
  1248.               use a default pointer and will probably end in tears!
  1249.  
  1250.               Date types represent the number of days since the start of the
  1251.               19th century. This need not be known, though may be useful to
  1252.               know that arithmetic operations on these types will represent
  1253.               days.
  1254.  
  1255.               Choice types are addressed using the sub-element 'v_choice.sel'
  1256.               which is an index into the list of choices. I.e. 1 represents
  1257.               the first selection, 2 the second, etc. 'v_choice.max' contains
  1258.               the maximum valid index for the choice selection, though this
  1259.               must not be modified by the application.
  1260.  
  1261. Return Value  TCU_OK if the field was returned successfully, else TCU_ERROR.
  1262.  
  1263.  
  1264. tcu_get_field_choice_string
  1265. ---------------------------
  1266.  
  1267. Function      Obtains the text string associated with a field of 'Choice'
  1268.               type.
  1269.  
  1270. Syntax        #include <usr\tcu.h>
  1271.               int tcu_get_field_choice_string (TCU_FORM *form,
  1272.                                                int field,
  1273.                                                char *string);
  1274.  
  1275. Remarks       'form' specifies the form where field 'field' resides. The
  1276.               field must be of type 'Choice' or the call will fail. The
  1277.               string associated with the current selection will be placed
  1278.               at the address specified as 'string'.
  1279.  
  1280. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  1281.  
  1282.  
  1283. tcu_get_field_id
  1284. ----------------
  1285.  
  1286. Function      Obtains the field ID for a named field.
  1287.  
  1288. Syntax        #include <usr\tcu.h>
  1289.               int tcu_get_field_id (TCU_FORM *form,
  1290.                                     char *field_name,
  1291.                                     int *field_id)
  1292.  
  1293. Remarks       Fields in forms may optionally be named. This allows the caller
  1294.               to use meaningful names for fields rather than have to know
  1295.               the logical field ID. 'form' identifies the form object,
  1296.               'field_name' points to the name of the field for which the ID
  1297.               is required. Case is NOT significant. 'field_id' points to the
  1298.               integer into which the ID will be written. This may then be used
  1299.               for subsequent field related operations. If 'field_id' is NULL,
  1300.               it is not used.
  1301.  
  1302. Return Value  Returns the ID of the field if present, else 0 if either an
  1303.               error occurred or the field was not found.
  1304.  
  1305.  
  1306. tcu_get_field_info
  1307. ------------------
  1308.  
  1309. Function      Fills a struture with information about the specified field
  1310.  
  1311. Syntax        #include <usr\tcu.h>
  1312.               int tcu_get_field_info (TCU_FORM *form,
  1313.                                       int field_id,
  1314.                                       TCU_FIELD_INFO *info);
  1315.  
  1316. Remarks       The function fills the user-declared structure 'info' with
  1317.               information about field 'field_id' in form 'form'. The structure
  1318.               has the following fields:
  1319.  
  1320.               typedef struct {                 
  1321.                  char           name[9];       /* Field name */
  1322.                  unsigned char  type,          /* Type of field */
  1323.                                 size,          /* Width of field on screen */
  1324.                                 decimal,       /* Decimal places if numeric */
  1325.                                 present,       /* Presentation form of data */
  1326.                                 xpos,          /* Window x-coordinate */
  1327.                                 ypos,          /* Window y-coordinate */
  1328.                                 usemin,        /* 1 if minimum range active */
  1329.                                 usemax,        /* 1 if maximum range active */
  1330.                                 useval,        /* 1 if initial value used */
  1331.                                 usetmp;        /* 1 if string template used */
  1332.                  union {
  1333.                     struct {
  1334.                        long     min,           /* Minimum value */
  1335.                                 max;           /* Maximum value */
  1336.                     } i;
  1337.                     struct {
  1338.                        double   min,           /* Minimum value */
  1339.                                 max;           /* Maximum value */
  1340.                     } f;        
  1341.                     struct {
  1342.                        unsigned short   min,   /* Minimum value */
  1343.                                         max;   /* Maximum value */
  1344.                     } d;
  1345.                  } range;
  1346.                  unsigned char  colour;        /* Colour attributes */
  1347.                  struct {
  1348.                     unsigned int  ronly : 1,   /* Read only flag */
  1349.                                   noecho : 1,  /* No-echo input flag */
  1350.                                   fixtext : 1, /* Fixed text field flag */
  1351.                                   param : 1,   /* Non-editable variable field */
  1352.                                   confirm : 1; /* ENTER confirmation needed flag */
  1353.                  } attr;          
  1354.                  TCU_FIELD_VALUE      val;         /* Value of field */
  1355.               } TCU_FIELD_INFO;
  1356.  
  1357.               The fields in this structure represent the current state of the
  1358.               form field. Use this service to obtain information about a field
  1359.               rather than trying to access the field directly through the form
  1360.               structure.
  1361.  
  1362. Return Value  Returns TCU_OK if the field information was obtained without
  1363.               error, else returns TCU_ERROR.
  1364.  
  1365.  
  1366. tcu_get_form_info
  1367. -----------------
  1368.  
  1369. Function      Fills a structure with information about the specified form
  1370.  
  1371. Syntax        #include <usr\tcu.h>
  1372.               int tcu_get_form_info (TCU_FORM *form,
  1373.                                      TCU_FORM_INFO *info);
  1374.  
  1375. Remarks       The function fills the user-declared structure 'info' with
  1376.               information about form 'form'. The structure has the following
  1377.               fields:
  1378.  
  1379.               typedef struct {
  1380.                  unsigned int   num_fields;    /* Number of fields */
  1381.                  char          *title;         /* Title string of form */
  1382.                  unsigned char  text_colour,   /* Colour attribute */
  1383.                                 field_colour,  /* Input field colour default */
  1384.                                 title_colour,  /* Title string colour */
  1385.                                 edit_colour,   /* Colour of field under edit */
  1386.                                 xpos,          /* x-coordinate on screen */
  1387.                                 ypos,          /* y-coordinate on screen */
  1388.                                 height,        /* Height of form */
  1389.                                 width,         /* Width of form */
  1390.                                 box_type,      /* Form surround type */
  1391.                                 mode,          /* Flags whether in use/displayed */
  1392.                                 verify_fn,     /* 1 if verify function active */
  1393.                                 help_fn,       /* 1 if help function active */
  1394.                                 fn_key_fn;     /* 1 if fn. key handler active */
  1395.                                 button_fn;     /* 1 if button select handler */
  1396.                  struct {
  1397.                     unsigned int  ronly : 1,   /* Form is read only */
  1398.                                   no_esc : 1;  /* Escape keys disabled */
  1399.                  } attr;
  1400.               } TCU_FORM_INFO;
  1401.  
  1402.               The fields in this structure represent the current state of the
  1403.               form. Use this service to obtain information about the form
  1404.               rather than trying to access the information directly through
  1405.               the form structure.
  1406.  
  1407. Return Value  Returns TCU_OK if no error was encountered, else FORK_ERROR.
  1408.  
  1409.  
  1410. tcu_get_user_keypress
  1411. ---------------------
  1412.  
  1413. Function      Returns the last used user defined key
  1414.  
  1415. Syntax        #include <usr\tcu.h>
  1416.               unsigned short tcu_get_user_keypress (void)
  1417.  
  1418. Remarks       The function is used with the user key handler (set with the
  1419.               'tcu_set_user_key_handler' service) to return the actual
  1420.               scancode of the last user defined key used.  A user defined
  1421.               key is one which is processed with a user key handler and not
  1422.               ignored, i.e. the handler does not return 0.
  1423.  
  1424. Return Value  User key scancode or 0 if no user key has been used.
  1425.  
  1426.  
  1427. tcu_hash_value
  1428. --------------
  1429.  
  1430. Function      Returns a hash value associated with a string
  1431.  
  1432. Syntax        #include <usr\tcu.h>
  1433.               unsigned long tcu_hash_value (char *string,
  1434.                                             unsigned long range)
  1435.  
  1436. Remarks       This function calculates and returns a hash value for a given
  1437.               string between 0 and range-1.  The hash value may be used to
  1438.               index a table for data retrieval purposes.
  1439.  
  1440. Return Value  Returns the hash value.
  1441.  
  1442.  
  1443. tcu_load_form
  1444. -------------
  1445.  
  1446. Function      Loads a form from the .CFO form object file into a form object.
  1447.  
  1448. Syntax        #include <usr\tcu.h>
  1449.               int tcu_load_form (TCU_FORM *form,
  1450.                                  char *filename)
  1451.  
  1452. Remarks       This function operates on form object files which are produced
  1453.               from the .CUF source files by the forms compiler.  Form objects
  1454.               normally have the type .CFO.  'form' identifies the form object
  1455.               into which the form is to be loaded. 'filename' specifies the
  1456.               name of the object file.  See the forms compiler documentation
  1457.               for further details and a description of the source file format.
  1458.  
  1459. Return Value  Returns TCU_OK if the form was loaded successfully, else
  1460.               TCU_ERROR. TCU_ERROR will normally indicate an internal error
  1461.               such as memory allocation problems, though it is possible that a
  1462.               range error in date fields was invalidated.  For example, if a
  1463.               field was specified in the .CUF source file as:
  1464.  
  1465.                  FIELD = @10,10; Date (MonthFirst); Range (Today, 12/31/90)
  1466.  
  1467.               then an error will occur trying to load this on or after the
  1468.               date 12/31/90 as the range is invalidated.
  1469.  
  1470.  
  1471. tcu_load_image_form
  1472. -------------------
  1473.  
  1474. Function      Loads a form from a form image linked with the application.
  1475.  
  1476. Syntax        #include <usr\tcu.h>
  1477.               extern TCU_FORM FORM_IMAGE;
  1478.               int tcu_load_image_form (TCU_FORM *form,
  1479.                                        TCU_FORM *FORM_IMAGE)
  1480.  
  1481. Remarks       This function is directly equivalent to 'tcu_load_form', only it
  1482.               loads forms internally from object modules linked in with the
  1483.               application. 'form' specifies the form object with which the
  1484.               form will later be addressed. 'FORM_IMAGE' specifies the
  1485.               external form image data which should be declared elsewhere as a
  1486.               type of 'extern TCU_FORM FORM_IMAGE'. This service offers the
  1487.               advantage over the 'tcu_load_form' service that an application
  1488.               may be completely self-contained with no external form files to
  1489.               supply. A disadvantage is that the application must be relinked
  1490.               if the form definition changes. Use the /OBJECT or /LOADNAME
  1491.               options of the forms compiler to generate linkable object
  1492.               modules instead of the normal object files. 'FORM_IMAGE' is the
  1493.               loadname of the object module which defaults to the file name
  1494.               part of the original .CUF form definition file, but may be
  1495.               specified using the /LOADNAME option of the forms compiler.
  1496.  
  1497. Return Value  See 'tcu_load_form'
  1498.  
  1499.  
  1500. tcu_new_pulldown_cover
  1501. ----------------------
  1502.  
  1503. Function      Reloads the saved screen cover under pulldown menus.
  1504.  
  1505. Syntax        #include <usr\tcu.h>
  1506.               int tcu_new_pulldown_cover (TCU_PULLDOWN *pmenu);
  1507.  
  1508. Remarks       This service should be used when the screen is changed outside
  1509.               the control of a pulldown menu but while the menu is displayed.
  1510.               This ensures that the further manipulation of the screen by the
  1511.               pulldown menu services will result in a consistent display.
  1512.               'pmenu' specifies the pulldown menu object.
  1513.  
  1514. Return Value  TCU_OK is successful, else TCU_ERROR.
  1515.  
  1516.  
  1517. tcu_notice_text
  1518. ---------------
  1519.  
  1520. Function      Formats a string for inclusion in the body of a notice or
  1521.               prompt.
  1522.  
  1523. Syntax        #include <usr\tcu.h>
  1524.               int tcu_notice_text (TCU_NOTICE *notice,
  1525.                                    char *fmt, ...)
  1526.  
  1527. Remarks       The parameter list is identical to that of the 'printf'
  1528.               function, and any valid 'printf' format control facilities may
  1529.               be used with the exception of control codes such as '\n' and
  1530.               '\b'. Blank lines are obtained by using an empty string, as in
  1531.  
  1532.                    status = notice_text (&my_notice, "");
  1533.  
  1534.               Each call to 'tcu_notice_text' represents a line in the notice
  1535.               or prompt. The size of the notice is automatically computed to
  1536.               allow the longest line registered with 'tcu_notice_text'.
  1537.  
  1538. Return Value  TCU_OK if the call was successful, else TCU_ERROR.
  1539.  
  1540.  
  1541. tcu_open_window
  1542. ---------------
  1543.  
  1544. Function      Opens a window and displays it on the screen.
  1545.  
  1546. Syntax        #include <usr\tcu.h>
  1547.               int tcu_open_window (TCU_WINDOW *window,
  1548.                                    int xpos, int ypos,
  1549.                                    int xsize, int ysize,
  1550.                                    char *title,
  1551.                                    unsigned char box_attrib,
  1552.                                    unsigned char window_attrib,
  1553.                                    unsigned char title_attrib,
  1554.                                    unsigned char box_type);
  1555.  
  1556. Remarks       Opens a window of outside size 'xsize' x 'ysize' characters at
  1557.               location (xpos,ypos). 'title' defines a textual title to appear
  1558.               in the header line of the window, or may be omited by either
  1559.               specifying NULL or a zero length string. 'box_attrib',
  1560.               'window_attrib' and 'title_attrib' define the colour attributes
  1561.               of the surrounding box, the window body and the title text
  1562.               respectively. 'box_type' is one of:
  1563.  
  1564.                     TCU_BOX_SINGLE      Single line surround
  1565.                     TCU_BOX_DOUBLE      Double line surround
  1566.                     TCU_BOX_BLANK       Surrounded by blank spaces
  1567.  
  1568.               The user declared entity 'window' is filled with the initalised
  1569.               window data and passed to subsequent windowing services.
  1570.  
  1571.               Note that the window ALWAYS has a one character border, and the
  1572.               size is including this border. A window of size 40 x 10 will
  1573.               have a usable size 38 x 8, and this will be the maximum
  1574.               cursor address. (1,1) always represents the top-left corner of
  1575.               USABLE window space.
  1576.  
  1577. Return Value  Returns TCU_OK on success, TCU_ERROR on error. An error will
  1578.               normally be the result of specifying bad parameters or a memory
  1579.               overflow. Bad parameters will often be caused by specifying
  1580.               part of the window to be out of range of the screen.
  1581.  
  1582.  
  1583. tcu_position_cursor
  1584. -------------------
  1585.  
  1586. Function      Moves a window cursor to a specified point in the window.
  1587.  
  1588. Syntax        #include <usr\tcu.h>
  1589.               int tcu_position_cursor (TCU_WINDOW *window,
  1590.                                        int x, int y)
  1591.  
  1592. Remarks       Moves the cursor to the specified location in the window.
  1593.  
  1594. Return Value  Returns TCU_OK on success, TCU_ERROR on error. An error will
  1595.               normally be attributable to an attempt to move the cursor
  1596.               outside the window area.
  1597.  
  1598.  
  1599. tcu_prepare_notice
  1600. ------------------
  1601.  
  1602. Function      Initialises a notice/prompt.
  1603.  
  1604. Syntax        #include <usr\tcu.h>
  1605.               int tcu_prepare_notice (TCU_NOTICE *notice,
  1606.                                       char *title,
  1607.                                       unsigned char title_colour,
  1608.                                       unsigned char box_colour,
  1609.                                       unsigned char notice_colour,
  1610.                                       unsigned char box_type)
  1611.  
  1612. Remarks       A notice or prompt is initialised with this service. The
  1613.               parameters 'box_colour', 'notice_colour' and 'title_colour'
  1614.               specify the colours of the surrounding box, the main notice
  1615.               panel and the title string respectively. 'box_type' is one of
  1616.               the following and defines the form of the perimeter box:
  1617.  
  1618.                    TCU_BOX_SINGLE          : Single lined box
  1619.                    TCU_BOX_DOUBLE          : Double lined box
  1620.                    TCU_BOX_BLANK           : Surrounded by blank spaces
  1621.  
  1622.               Text may be added to the notice with the 'tcu_notice_text'
  1623.               service and the notice become complete at the call to
  1624.               'tcu_display_notice'. When the notice has been removed by the
  1625.               user, it remains defined until a 'tcu_clear_notice' call is
  1626.               made. This allows a notice to be used more than once without
  1627.               redefinition.
  1628.  
  1629.               If no title is to be used, it should be specified as "", i.e.
  1630.               an empty string.  In this case the 'title_colour' parameter is
  1631.               ignored.
  1632.  
  1633. Return Value  Returns TCU_OK if successful, else TCU_ERROR.
  1634.  
  1635.  
  1636. tcu_prompt_input
  1637. ----------------
  1638.  
  1639. Function      Adds an input field area to a notice.
  1640.  
  1641. Syntax        #include <usr\tcu.h>
  1642.               int tcu_prompt_input (TCU_NOTICE *notice,
  1643.                                     int xpos,
  1644.                                     int ypos,
  1645.                                     char *buffer,
  1646.                                     unsigned char prompt_colour)
  1647.  
  1648. Remarks       Only one input field may be present in a notice. If an input
  1649.               field is specified, the notice becomes a 'prompt'. 'xpos' and
  1650.               'ypos' specify the start position of the input area in the
  1651.               notice panel. 'buffer' is a pointer to a user area where the
  1652.               input is to be put. 'buffer' has the same form as the buffer
  1653.               used in the library function 'cgets', i.e. buffer[0] must
  1654.               specify the maximum length of the input field, and the actual
  1655.               data is returned from buffer[2]. buffer[1] contains the number
  1656.               of characters in the input field. This means 'buffer' must be
  1657.               large enough to hold the maximum input string + 3 (to include
  1658.               buffer[0], buffer[1] and the terminating '\0'. When the call
  1659.               is made, the default string displayed will the contents of
  1660.               the buffer at locations buffer[2] onwards. buffer[2] must be
  1661.               set to '\0' if this feature is not required.
  1662.  
  1663.               'prompt_colour' defined the colours to use for the prompt area.
  1664.  
  1665.               When a notice has been converted to a prompt, the call to
  1666.               'tcu_display_notice' will allow the user to enter the input
  1667.               string. The notice disappears when the input is complete,
  1668.               whereas a notice with no prompt area disappears when the user
  1669.               presses the RETURN key or the ESCAPE key.
  1670.  
  1671. Return Value  TCU_OK if the call was successful, TCU_ERROR if an error
  1672.               occurred.
  1673.  
  1674.  
  1675. tcu_restore_environment
  1676. -----------------------
  1677.  
  1678. Function      Restores the screen environment
  1679.  
  1680. Syntax        #include <usr\tcu.h>
  1681.               void tcu_restore_environment (void)
  1682.  
  1683. Remarks       This call should be made after the 'tcu_saqve_environment' call
  1684.               in an idle loop interrupt handler which changes the screen in
  1685.               some fashion. The calls which may alter the screen should be
  1686.               between 'tcu_save_environment' and 'tcu_restore_environment'.
  1687.  
  1688. Return Value  None.
  1689.  
  1690.  
  1691. tcu_put_field
  1692. -------------
  1693.  
  1694. Function      Loads a value into a field of a form.
  1695.  
  1696. Syntax        #include <usr\tcu.h>
  1697.               int tcu_put_field (TCU_FORM *form,
  1698.                                  int field,
  1699.                                  TCU_FIELD_VALUE *val)
  1700.  
  1701. Remarks       'form' identifies the form into which the value is to be
  1702.               loaded. 'field' is the field ID of the field, which may be
  1703.               obtained by 'tcu_get_field_id' if the field is named in the CUF
  1704.               file. 'val' is a pointer to a user declared TCU_FIELD_VALUE type
  1705.               which contains the value to be loaded.
  1706.  
  1707.               The value must comply with the type of the field and any
  1708.               range declaration which has been made in the CUF file. String
  1709.               lengths are checked, but compliance with string templates are
  1710.               not.
  1711.  
  1712.               See 'tcu_get_field' for details on how the field values in a
  1713.               form are addressed.
  1714.  
  1715.               If the form is currently displayed, the field is updated
  1716.               immediately.
  1717.  
  1718. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  1719.  
  1720.  
  1721. tcu_read_formrec
  1722. ----------------
  1723.  
  1724. Function      Reads a complete form from a buffer.
  1725.  
  1726. Syntax        #include <usr\tcu.h>
  1727.               int tcu_read_formrec (TCU_FORM *form,
  1728.                                     char *buffer)
  1729.  
  1730. Remarks       'form' identifies the form into which the 'buffer' is to be
  1731.               read.  An implicit call to 'tcu_put_field' is made for each
  1732.               field to ensure integrity.
  1733.  
  1734. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR. An
  1735.               error condition is likely to indicate that one of the fields
  1736.               in the buffer is invalid for the form by being of an invalid
  1737.               type or out of the range specified in the form definition.
  1738.  
  1739.  
  1740. tcu_read_menu_selection
  1741. -----------------------
  1742.  
  1743. Function      Returns the user selection from a defined and displayed menu.
  1744.               If the user escapes from the menu with one of the permitted
  1745.               escape keys, the key code is returned, otherwise the selected
  1746.               menu option is returned.
  1747.  
  1748. Syntax        #include <usr\tcu.h>
  1749.               int tcu_read_menu_selection (TCU_MENU *menu)
  1750.  
  1751. Remarks       'tcu_read_menu_selection' is an interactive function to obtain a
  1752.               user selection from a displayed menu. Only valid escape keys
  1753.               may be used to leave the interactive selection procedure.
  1754.  
  1755. Return Value  If a valid menu option is selected, it is returned as a positive
  1756.               integer; 1 represents the first choice, 2 the second, etc.  If
  1757.               an option is unavailable for selection, it will simply not be
  1758.               returned under any circumstances. The numbering of the options
  1759.               is sequential, including unavailable options; i.e. If the menu
  1760.               has three possible options, the second of which is unavailable,
  1761.               the third has the logical sequence number '3' even though it is
  1762.               the second valid selection.
  1763.  
  1764.               If the return is 0, an error was encountered. This will most
  1765.               likely be due to either the menu not having been defined, or
  1766.               not yet displayed.
  1767.  
  1768.               If the return is negative, it represents the negative value of
  1769.               the escape key used to leave the selection. E.g. to determine
  1770.               if the ESC key was used to leave the menu, the following code
  1771.               extract could be used:
  1772.  
  1773.                     selection = tcu_read_menu_selection (&mymenu);
  1774.                     if (!selection)
  1775.                        ERROR_CONDITION;
  1776.                     else
  1777.                        if (selection > 0)
  1778.                           NORMAL_SELECTION_MADE;
  1779.                        else
  1780.                           if (selection == -TCU_ESC_ESC)
  1781.                              ESCAPE_KEY_USED;
  1782.                           else
  1783.                              ...SOME_OTHER_ESCAPE_KEY_USED;
  1784.  
  1785.               Note that for function keys and user defined escape keys the two
  1786.               services 'tcu_escape_fkey' and 'tcu_get_user_keypress' may be
  1787.               used to determine the exact keypress used.  In these cases, the
  1788.               return code from 'tcu_read_menu_selection' would be either
  1789.               -TCU_ESC_FUNC (for function keys) or -TCU_ESC_USERKEY (for user
  1790.               defined escape keys).
  1791.  
  1792.  
  1793. tcu_read_pulldown_selection
  1794. ---------------------------
  1795.  
  1796. Function      Returns a menu option selected under control of a pulldown menu.
  1797.  
  1798. Syntax        #include <usr\tcu.h>
  1799.               int tcu_read_pulldown_selection (TCU_PULLDOWN *pmenu,
  1800.                                                int *menu,
  1801.                                                int *option);
  1802.  
  1803. Remarks       'pmenu' specifies the pulldown menu which is to be activated
  1804.               and from which an option is to be read.  The menu must have been
  1805.               already defined with 'tcu_define_pulldown'.  'menu' returns the
  1806.               menu from the pulldown header from which the selection was made
  1807.               (in the range 1..No_of_menus) and 'option' returns the actual
  1808.               option within the menu (in the range 1..No_of_options_in_menu).
  1809.  
  1810.               If 'option' is zero and 'menu' is non-zero, the pulldown menu
  1811.               option selected did not have an associated menu.  If 'menu' is
  1812.               zero the pulldown menu selection was aborted with the ESC key
  1813.               and no selection was made.
  1814.  
  1815.               Note that 'tcu_read_pulldown_selection' does not clear the
  1816.               menu(s) from the screen on completion of the call (to allow a
  1817.               sequence of user defined events to take place on selection of
  1818.               an option), and may be called in sequence with intervening
  1819.               actions. Do NOT attempt to perform operations using menus
  1820.               within the pulldown system BETWEEN calls to the
  1821.               'tcu_read_pulldown_selection' other than the provided
  1822.               'tcu_clear_menu_in_pulldown' and 'tcu_new_pulldown_cover'
  1823.               services.  Use 'tcu_remove_pulldown' to clear the pulldown from
  1824.               the screen.
  1825.  
  1826. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  1827.  
  1828.  
  1829. tcu_remove_form
  1830. ---------------
  1831.  
  1832. Function      Removes a form from the screen.
  1833.  
  1834. Syntax        #include <usr\tcu.h>
  1835.               int tcu_remove_form (TCU_FORM *form)
  1836.  
  1837. Remarks       'form' specifies the form which is to be removed. The
  1838.               definition is not removed; a 'tcu_display_form' is all that is
  1839.               required to redisplay the form.
  1840.  
  1841. Return Value  Returns TCU_OK if successful, TCU_ERROR if an error occurred.
  1842.  
  1843.  
  1844. tcu_remove_menu
  1845. ---------------
  1846.  
  1847. Function      Removes a displayed menu from the screen, restoring the original
  1848.               screen contents.
  1849.  
  1850. Syntax        #include <usr\tcu.h>
  1851.               int tcu_remove_menu (TCU_MENU *menu)
  1852.  
  1853. Remarks       If the menu to be removed is overlaid with another menu, the
  1854.               restoration of the screen will be incorrect. The user should
  1855.               ensure that selections from overlaid menus are satisfied by
  1856.               'tcu_read_menu_selection' and 'remove_menu' in the reverse order
  1857.               to that in which they were displayed with 'tcu_display_menu'.
  1858.  
  1859. Return Value  Returns TCU_OK if successful, or TCU_ERROR is unsuccessful.
  1860.               If unsuccessful the menu is logically flagged as removed, thus
  1861.               only leaving the screen incomplete.
  1862.  
  1863.  
  1864. tcu_remove_pulldown
  1865. -------------------
  1866.  
  1867. Function      Removes a pulldown menu from the screen, restoring the old
  1868.               screen contents.
  1869.  
  1870. Syntax        #include <usr\tcu.h>
  1871.               int tcu_remove_pulldown (TCU_PULLDOWN *pmenu);
  1872.  
  1873. Remarks       'pmenu' specifies the pulldown to be removed.  Note that the
  1874.               pulldown remains defined and may be activated again with the
  1875.               'tcu_read_pulldown_selection' service.
  1876.  
  1877. Return Value  TCU_OK if successful, or TCU_ERROR if an error occurred.
  1878.  
  1879.  
  1880. tcu_save_environment
  1881. --------------------
  1882.  
  1883. Function      Saves the screen environment.
  1884.  
  1885. Syntax        #include <usr\tcu.h>
  1886.               int tcu_push_environment (void)
  1887.  
  1888. Remarks       This service saves the screen environment for use inside
  1889.               idle loop handler functions which change the screen in
  1890.               some fashion. The calls which may alter the screen should be
  1891.               between 'tcu_save_environment' and 'tcu_restore_environment'.
  1892.  
  1893. Return Value  None.
  1894.  
  1895.  
  1896. tcu_select_field
  1897. ----------------
  1898.  
  1899. Function      Selects a single field from a form returning the field ID.
  1900.  
  1901. Syntax        #include <usr\tcu.h>
  1902.               int tcu_select_field (TCU_FORM *form,
  1903.                                     int start_field_id,
  1904.                                     int *exitkey);
  1905.  
  1906. Remarks       The service behaves exactly as 'tcu_edit_form', though
  1907.               disallowing any editing of fields and terminating at the first
  1908.               field select with the RETURN key. The form 'form' must be
  1909.               displayed. A start field 'start_field_id' determines which field
  1910.               will be the first one in which the cursor appears. If set to 1,
  1911.               the first valid field will be used. 'exitkey' will return with
  1912.               the field-ID of the field selected, or if negative will be one
  1913.               of the escape codes listed for 'tcu_edit_form'
  1914.  
  1915. Return Value  Returns with TCU_OK if no error, else TCU_ERROR.
  1916.  
  1917.  
  1918. tcu_set_button_fn
  1919. -----------------
  1920.  
  1921. Function      Establishes a button handler for a form.
  1922.  
  1923. Syntax        #include <usr\tcu.h>
  1924.               int tcu_set_button_fn (TCU_FORM *form,
  1925.                                      int far (*handler) (TCU_FORM *, int));
  1926.  
  1927. Remarks       'form' specifies the form for which the handler is to be
  1928.               activated. 'handler' is the handler to which control is passed
  1929.               when any button field on the form is selected. The two
  1930.               parameters passed by the system to the handler specify the
  1931.               form and the current button field ID.
  1932.  
  1933.               The handler must return one of three possible values according
  1934.               to the desired action:
  1935.  
  1936.                  0  =  Continue as if no key had been pressed, i.e. no
  1937.                        actions subsequent to the handler will be made as a
  1938.                        result of the selection.
  1939.  
  1940.                  1  =  Treat the keypress as a PgUp, i.e. save the results
  1941.                        of the form and exit. The exit code is
  1942.                        TCU_FLD_BUTTONSAVE.
  1943.  
  1944.                  2  =  Treat the keypress as an ESC, i.e. abort the form
  1945.                        entry and exit. The exit code is TCU_FLD_BUTTONESC.
  1946.  
  1947.               To remove an existing handler, set the function to NULL.
  1948.  
  1949.               If the handler code is to operate on objects outside the form in
  1950.               which the button exists (e.g. creates a new menu), the calls to
  1951.               services acting on the objects should be surrounded by calls to
  1952.               'tcu_save_environment' and 'tcu_restore_environment'.
  1953.  
  1954. Return Value  Returns TCU_OK if the handler was successfully installed, or
  1955.               TCU_ERROR if an error was encountered.
  1956.  
  1957.  
  1958. tcu_set_field_attrib
  1959. --------------------
  1960.  
  1961. Function      Sets the foreground and background colours of a field in a
  1962.               form.
  1963.  
  1964. Syntax        #include <usr\tcu.h>
  1965.               int tcu_set_field_attrib (TCU_FORM *form,
  1966.                                         int field,
  1967.                                         unsigned char new_colour)
  1968.  
  1969. Remarks       'form' identifies the form. 'field' is the field ID of the
  1970.               field to be changed. This may be returned by 'tcu_get_field_id'
  1971.               if the field is a named field. 'new_colour' specifies the new
  1972.               colours of the field, which may be obtained with the
  1973.               'tcu_colour_attrib' function.
  1974.  
  1975.               If the form is displayed, the colours are updated immediately.
  1976.  
  1977. Return Value  Returns TCU_OK if successful, TCU_ERROR if an error occurred.
  1978.  
  1979.  
  1980. tcu_set_field_mode
  1981. ------------------
  1982.  
  1983. Function      Sets a field attribute for a field in a form.
  1984.  
  1985. Syntax        #include <usr\tcu.h>
  1986.               int tcu_set_field_mode (TCU_FORM *form,
  1987.                                       int field,
  1988.                                       int mode)
  1989.  
  1990. Remarks       'form' specifies the form. 'field' is the field ID of the field.
  1991.               'mode' is one of the following:
  1992.  
  1993.                  TCU_FORM_EDIT   (def)  : Allow the field to be changed
  1994.                  TCU_FORM_NOEDIT        : Do not allow the field to be edited
  1995.                  TCU_FORM_ECHO   (def)  : Show field in form
  1996.                  TCU_FORM_NOECHO        : Do not display contents of field
  1997.                  TCU_FORM_ENTER  (def)  : Cursor may enter field during edit
  1998.                  TCU_FORM_NOENTER       : Cursor passes field by during edit
  1999.                  TCU_FORM_CONFIRM       : Needs ENTER to confirm field entry
  2000.                  TCU_FORM_NOCONFIFM (dflt)  : Prev. & next field confirm entry
  2001.  
  2002.               If the field is set NOEDIT, attempting to change the value of
  2003.               the field results in a tone.
  2004.  
  2005. Return Value  Returns TCU_OK if the mode was successfully set, else returns
  2006.               TCU_ERROR.
  2007.  
  2008.  
  2009. tcu_set_field_verify
  2010. --------------------
  2011.  
  2012. Function      Sets a verification function for a field.
  2013.  
  2014. Syntax        #include <usr\tcu.h>
  2015.               int tcu_set_field_verify (TCU_FORM *form,
  2016.                                         int far (*verify_fn)
  2017.                                                 (TCU_FORM *, int,
  2018.                                                  TCU_FIELD_VALUE *))
  2019.  
  2020.  
  2021. Remarks       'form' specifies the form. 'verify_fn' is the address of an
  2022.               integer function to perform the field verification. The function
  2023.               is passed the form address, an integer value which is the field
  2024.               ID and a pointer to the TCU_FIELD_VALUE structure of the field.
  2025.               The value must not be changed in the handler routine, other
  2026.               that by using 'tcu_put_field' with the passed 'form' parameter.
  2027.  
  2028.               The function should return 0 if the field failed verification
  2029.               and 1 if it verified successfully. If no field verification is
  2030.               specified, the range constraints on the field (if any) are the
  2031.               only checks made when the field is completed.
  2032.  
  2033.               Field verification is checked when an attempt to change the
  2034.               value of a field is made. This includes interactive form editing
  2035.               and changes with 'tcu_put_field'.
  2036.  
  2037. Return Value  Returns TCU_OK if verification was established successfully or
  2038.               TCU_ERROR if an error occurred.
  2039.  
  2040.  
  2041. tcu_set_form_fnkey_fn
  2042. ---------------------
  2043.  
  2044. Function      Establishes a function key handler function for form entry.
  2045.  
  2046. Syntax        #include <usr\tcu.h>
  2047.               int tcu_set_form_fnkey_fn (TCU_FORM *form,
  2048.                                          int far (*handler)
  2049.                                                  (TCU_FORM *, int, int));
  2050.  
  2051. Remarks       'form' specifies the form for which the handler is to be
  2052.               activated. 'handler' is the handler to which control is
  2053.               passed for all function keys. F1 is excluded as this is used
  2054.               exclusively for help invokation. The parameters passed by the
  2055.               system to the handler specify the form, the current field of the
  2056.               form and the actual function key (2-12) in that order.
  2057.  
  2058.               The handler must return one of three possible values according
  2059.               to the desired action:
  2060.  
  2061.                  0  =  Continue as if no key had been pressed, i.e. no
  2062.                        actions subsequent to the function key handler will
  2063.                        be made as a result of the keypress.
  2064.  
  2065.                  1  =  Treat the keypress as a PgUp, i.e. save the results
  2066.                        of the form and exit. The exit code is
  2067.                        TCU_FLD_FNKEYSAVE.
  2068.  
  2069.                  2  =  Treat the keypress as an ESC, i.e. abort the form
  2070.                        entry and exit. The exit code is TCU_FLD_ENKEYESC.
  2071.  
  2072.                  3  =  Same as 0, but update the field being edited with the
  2073.                        value set with a 'tcu_put_field'. This is used when a
  2074.                        'tcu_put_field' is called from within a function key
  2075.                        handler and the form is currently under edit.
  2076.  
  2077.               To remove an existing handler, set the function to NULL.
  2078.  
  2079. Return Value  Returns TCU_OK if the handler was successfully installed, or
  2080.               TCU_ERROR if an error was encountered.
  2081.  
  2082.  
  2083. tcu_set_form_help
  2084. -----------------
  2085.  
  2086. Function      Associates a help function with a form.
  2087.  
  2088. Syntax        #include <usr\tcu.h>
  2089.               int tcu_set_form_help (TCU_FORM *form,
  2090.                                      void far (*help_fn)(TCU_FORM *, int))
  2091.  
  2092. Remarks       'form' specifies the form, 'help_fn' is the address of a void
  2093.               function which will be called when the F1 key is pressed when
  2094.               the user is editing the form. The function is passed a single
  2095.               integer value which is the field ID. This allows the function
  2096.               to determine which field was selected when the help key was
  2097.               pressed.
  2098.  
  2099.               If no help function is defined for a field, the F1 key will
  2100.               generate a warning beep.
  2101.  
  2102. Return Value  Returns TCU_OK if the function was registered correctly, else
  2103.               TCU_ERROR.
  2104.  
  2105.  
  2106. tcu_set_form_mode
  2107. -----------------
  2108.  
  2109. Function      Sets the form edit mode for a complete form.
  2110.  
  2111. Syntax        #include <usr\tcu.h>
  2112.               int tcu_set_form_mode (TCU_FORM *form,
  2113.                                      int mode)
  2114.  
  2115. Remarks       'form' specifies the form. 'mode' is one of the following:
  2116.  
  2117.                  TCU_FORM_EDIT   (default)  : Form fields may be edited
  2118.                  TCU_FORM_NOEDIT            : Form fields may not be edited
  2119.                  TCU_FORM_ESCS   (default)  : Allow standard escape keys
  2120.                  TCU_FORM_NOESCS            : Disable all direct escape keys
  2121.  
  2122.               If the form mode is set to EDIT, the field modes may still
  2123.               prevent editing of individual fields.
  2124.  
  2125.               The escape keys include ESC, CNTL/C, PgUp and PgDn.  Disabling
  2126.               these keys allows the form to be controlled from handler
  2127.               functions returning appropriate continuation or escape codes.
  2128.  
  2129. Return Value  Returns TCU_OK if the mode was successfully set, else returns
  2130.               TCU_ERROR.
  2131.  
  2132.  
  2133. tcu_set_idle_loop
  2134. -----------------
  2135.  
  2136. Function      Establishes an idle processing handler
  2137.  
  2138. Syntax        #include <usr\tcu.h>
  2139.               int tcu_set_idle_loop (int far (*handler)(unsigned long))
  2140.  
  2141. Remarks       'handler' specifies the idle loop handler function to be
  2142.               installed. If a handler is present, it is called by TCU
  2143.               services every 10ms while waiting for a keypress or mouse
  2144.               click. It is passes a single unsigned long integer parameter
  2145.               which is the time in 10ms units that the system has been idle.
  2146.               If the handler wishes to emulate a keypress, it should return
  2147.               the scan-code of the key. If it returns zero, processing will
  2148.               continue.
  2149.  
  2150.               If the handler wishes to perform some activity which will
  2151.               change the contents of the screen, it should first save the
  2152.               screen environment with the 'tcu_save_environment' service. On
  2153.               completion of the screen updates, the 'tcu_restore_environment'
  2154.               call must be made. The idle processing function must be careful
  2155.               not to perform functions which alter parts of the screen
  2156.               being affected by currently executing foreground activities.
  2157.               Furthermore, should the idle handler need to operate on a
  2158.               form which is being edited when the handler is entered, it
  2159.               must use the special symbol '_TCU_UPDATE_form' as the FORM *
  2160.               type parameter to any form functions.
  2161.  
  2162. Return Value  Returns TCU_OK if the handler was successfully installed, else
  2163.               returns TCU_ERROR.
  2164.  
  2165.  
  2166. tcu_set_menu_help
  2167. -----------------
  2168.  
  2169. Function      Associates a help function with a menu.
  2170.  
  2171. Syntax        #include <usr\tcu.h>
  2172.               int tcu_set_menu_help (TCU_MENU *menu,
  2173.                                      void far (*handler)(int));
  2174.  
  2175. Remarks       'menu' specifies the menu to which the user defined help
  2176.               function, 'handler', is to refer.  Pressing the F1 function key
  2177.               while in the specified menu will activate this function, passing
  2178.               the currently selected menu option as a single integer parameter
  2179.               to the help function to allow an option specific action to be
  2180.               taken.
  2181.  
  2182.               Use NULL as a 'handler' value to remove the help function.  If
  2183.               F1 is pressed when no help function is available, a single tone
  2184.               will be sounded.
  2185.  
  2186. Return Value  TCU_OK if the help function was successfully installed, else
  2187.               TCU_ERROR.
  2188.  
  2189.  
  2190. tcu_set_menu_option
  2191. -------------------
  2192.  
  2193. Function      Enables or disables an option within a menu.
  2194.  
  2195. Syntax        #include <usr\tcu.h>
  2196.               int tcu_set_menu_option (TCU_MENU *menu,
  2197.                                        int choice,
  2198.                                        int mode)
  2199.  
  2200. Remarks       'choice' identifies the menu choice to be changed. 'mode' is
  2201.               0 to make a choice unavailable and 1 to enable a choice option.
  2202.  
  2203. Return Value  Returns TCU_OK if the call was successful, TCU_ERROR if an
  2204.               error was encountered.
  2205.  
  2206.  
  2207. tcu_set_mouse_mode
  2208. ------------------
  2209.  
  2210. Function      Enables or disables mouse support for menus and forms.
  2211.  
  2212. Syntax        #include <usr\tcu.h>
  2213.               int tcu_set_mouse_mode (unsigned char mode)
  2214.  
  2215. Remarks       The presence of a mouse is automatically detected and overrides
  2216.               any selection made with this service. By default mouse support
  2217.               if switched ON.  If mode is 0, mouse support will be disabled.
  2218.               If 1, it will be re-enabled. Note that the mouse mode may be
  2219.               toggled interactively by using the ALT-M key.
  2220.  
  2221. Return Value  TCU_OK if the service request was successful. TCU_ERROR means
  2222.               that no mouse was detected, though does not constitute a real
  2223.               error.
  2224.  
  2225.  
  2226. tcu_set_pulldown_help
  2227. ---------------------
  2228.  
  2229. Function      Associates a help function with a pulldown menu.
  2230.  
  2231. Syntax        #include <usr\tcu.h>
  2232.               int tcu_set_pulldown_help (TCU_PULLDOWN *pmenu,
  2233.                                          void far (*handler)(int));
  2234.  
  2235. Remarks       'menu' specifies the pulldown menu to which the user defined
  2236.               help function, 'handler', is to refer.  Pressing the F1 function
  2237.               key while on any pulldown title will activate this function,
  2238.               passing the currently selected menu option as a single integer
  2239.               parameter to the help function to allow an option specific
  2240.               action to be taken.
  2241.  
  2242.               Use NULL as a 'handler' value to remove the help function.  If
  2243.               F1 is pressed when no help function is available, a single tone
  2244.               will be sounded.
  2245.  
  2246. Return Value  TCU_OK if the help function was successfully installed, else
  2247.               TCU_ERROR.
  2248.  
  2249.  
  2250. tcu_set_user_key_handler
  2251. ------------------------
  2252.  
  2253. Function      Establishes a handler function to implement user defined keys
  2254.  
  2255. Syntax        #include <usr\tcu.h>
  2256.               int tcu_set_user_key_handler
  2257.                                       (int far (*handler)(unsigned short *));
  2258.  
  2259. Remarks       Establishes 'handler' as a function which will be invoked each
  2260.               time a key is pressed.  The function is passed a pointer to the
  2261.               key scancode, the dereferenced value of which may be altered if
  2262.               required, to allow it to decide how to process the keypress.
  2263.               The function will normally not alter the scancode.  The function
  2264.               should return 0 if no further action is required on behalf of
  2265.               the user defined keypress, 1 if the key is to be treated as an
  2266.               accept key (TCU_FLD_USERSAVE) and 2 if it is to be an escape key
  2267.               (TCU_FLD_USERESC).  The actual meaning of the returned value is
  2268.               dependent on the context.  E.g. TCU_FLD_USERSAVE during form
  2269.               entry will be treated exactly as TCU_FLD_ESCPGUP or
  2270.               TCU_FLD_ESCPGDN whilst TCU_FLD_USERESC is treated as
  2271.               TCU_FLD_ESCCNTLC.  This allows the user to implement individual
  2272.               key codes.  The actual key used by the user may be obtained with
  2273.               the 'tcu_get_user_keypress' service which returns the scancode.
  2274.  
  2275.               Note that the scancodes are standard, i.e. ALT-F1 is 104 (dec).
  2276.  
  2277.               Use NULL as the value of the function to be set to clear the
  2278.               present handler.
  2279.  
  2280. Return Value  TCU_OK if the help function was successfully installed, else
  2281.               TCU_ERROR.
  2282.  
  2283.  
  2284. _TCU_version
  2285. ------------
  2286.  
  2287. Function      Constant defining the version number of TCU
  2288.  
  2289. Syntax        #include <usr\tcu.h>
  2290.               extern unsigned char _TCU_version;
  2291.  
  2292. Remarks       The high-order nibble defines the major version number and the
  2293.               low-order nibble the minor version number.
  2294.  
  2295.                 printf ("This is TCU v%d.%d\n",
  2296.                         _TCU_version >> 4, _TCU_version & 0x0F);
  2297.  
  2298. Return Value  N/A
  2299.  
  2300.  
  2301. tcu_warnbeep
  2302. ------------
  2303.  
  2304. Function      Produce TCU standard warning beep sound
  2305.  
  2306. Syntax        #include <usr\tcu.h>
  2307.               void tcu_warnbeep (void)
  2308.  
  2309. Remarks       Sounds the warning beep used by TCU internals for such things
  2310.               as attempt to type into read-only form field, etc.
  2311.  
  2312. Return Value  None
  2313.  
  2314.  
  2315. tcu_wgets
  2316. ---------
  2317.  
  2318. Function      Receives user input from a window area.
  2319.  
  2320. Syntax        #include <usr\tcu.h>
  2321.               int tcu_wgets (TCU_WINDOW *window,
  2322.                              int maxlength,
  2323.                              char *buffer,
  2324.                              int *actuallength)
  2325.  
  2326. Remarks       Provides an editable input inside a window area. The input
  2327.               field must be on one line and may not extend beyond the
  2328.               window boundary. 'maxlength' specifies the maximum number of
  2329.               characters to input. 'buffer' is the address of a buffer to
  2330.               receive the input and should be at least maxlength+1 characters
  2331.               in length to include the null terminator. 'actuallength' is
  2332.               returned to indicate how many characters were present in the
  2333.               input field.
  2334.  
  2335.               The input buffer may be pre-loadad to give an inital input
  2336.               string. If the field should be empty, 'buffer' should be a
  2337.               zero length string.
  2338.  
  2339.               If the length is returned as -1, the user cancelled the input
  2340.               operation with ESC and the input string will be an empty
  2341.               string.
  2342.  
  2343. Return Value  TCU_OK on success, TCU_ERROR on error. Errors are likely to
  2344.               be the result of specifying an input area outside the boundary
  2345.               of the window.
  2346.  
  2347.  
  2348. tcu_write_formrec
  2349. -----------------
  2350.  
  2351. Function      Writes a complete form to a buffer.
  2352.  
  2353. Syntax        #include <usr\tcu.h>
  2354.               int tcu_write_formrec (TCU_FORM *form,
  2355.                                      char *buffer)
  2356.  
  2357. Remarks       'form' identifies the form which will be written to the
  2358.               'buffer'.  It is the caller's responsibility to ensure that
  2359.               the buffer points to sufficient free space to hold the form
  2360.               fields. The size may be obtained with the 'tcu_form_record_size'
  2361.               service.
  2362.  
  2363. Return Value  Returns TCU_OK if the call was successful, else TCU_ERROR.
  2364.  
  2365.  
  2366. tcu_wprintf
  2367. -----------
  2368.  
  2369. Function      Formatted output to a window.
  2370.  
  2371. Syntax        #include <usr\tcu.h>
  2372.               int tcu_wprintf (TCU_WINDOW *window,
  2373.                                char *format,
  2374.                                arg1, arg2, arg3, ...)
  2375.  
  2376. Remarks       As the C run-time library 'printf' function but to a window.
  2377.               Long lines will wrap around.
  2378.  
  2379. Return Value  TCU_OK on success, TCU_ERROR on error.
  2380.