home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 480.lha / SmartField / Docs / Function Descriptions.pp / Function Descriptions
Encoding:
Text File  |  1991-02-06  |  53.6 KB  |  1,275 lines

  1. FUNCTION DESCRIPTIONS
  2.  
  3.  
  4. Low-Level Console Functions: Character Output
  5.  
  6. These functions handle all console display by outputting to the console
  7. device the required escape sequences.  Each function requires a pointer to
  8. the IOStdReq structure created either 1) by your calling program or 2) by the
  9. field_open() function and pointed to by the WriteReq pointer in your
  10. FieldHeader structure.  Some of the supplied functions were not required by
  11. the SmartFields system but were included just for completeness in case you
  12. decided to write your own console program.
  13.  
  14.  
  15. void con_char_backspace( wreq )
  16.     struct IOStdReq *wreq
  17.  
  18.     This function backspaces the cursor one character position to the left,
  19.     deleting the character to the left of the cursor and moving all
  20.     characters to the right of the cursor one character position to the left.
  21.  
  22.  
  23. void con_char_delete( wreq )
  24.     struct IOStdReq *wreq
  25.  
  26.     This function deletes the character under the cursor and moves all
  27.     characters to the right of the cursor one character position to the left.
  28.  
  29.  
  30. void con_char_insert( wreq )
  31.     struct IOStdReq *wreq
  32.  
  33.     This function moves all characters at and to the right of the cursor one
  34.     character position to the right and inserts a blank space at the current
  35.     cursor position.
  36.  
  37.  
  38. void con_char_mult_delete( wreq, chars )
  39.     struct IOStdReq *wreq
  40.     int chars
  41.  
  42.     This function deletes chars number of characters at and to the right of
  43.     the cursor, moving the characters to the right of the cursor chars
  44.     character positions to the left to fill in for the deleted characters.
  45.     Any value for chars less than 0 or greater than 999 will cause unexpected
  46.     results.  Because of the nature of the console's delete command, a value
  47.     of 0 for chars will default to 1.
  48.  
  49.  
  50. void con_display_erase( wreq )
  51.     struct IOStdReq *wreq
  52.  
  53.     This function erases from the cursor to the end of the console display.
  54.  
  55.  
  56. void con_events( wreq, flags, set_or_reset )
  57.     struct IOStdReq *wreq
  58.     ULONG flags
  59.     UBYTE set_or_reset
  60.  
  61.     This function sets which raw input events the console device is to
  62.     monitor for activity.  If you've ever used the console device for
  63.     monitoring raw input, you should be familiar with the large quantity of
  64.     data that must be handled.  We suggest that you use the Intuition IDCMP
  65.     to monitor raw input instead.  This function is not required for
  66.     SmartFields operation but was provided just for completeness.  The
  67.     operation of this function is not guaranteed and is provided "as is."
  68.  
  69.     Use the values SET_EVENTS or RESET_EVENTS as defined in console/console.h
  70.     to indicate whether you want to set or reset (in other words, monitor or
  71.     not monitor) the specified events.  When you first open the console
  72.     device, the default is to not monitor for any of the raw input events.
  73.     Use the intuition/intuition.h IDCMP flags for flags to indicate which of
  74.     the raw input events you want to begin or quit monitoring.
  75.  
  76.  
  77. void con_graphic_rend( wreq, style, foreground, background )
  78.     struct IOStdReq *wreq
  79.     USHORT style
  80.     USHORT foreground
  81.     USHORT background
  82.  
  83.     This function sets the console text attributes:
  84.  
  85.     style
  86.         Set this to any combination of the following values as defined in
  87.         console/console.h:  CON_PLAIN, CON_BOLD, CON_ITALIC, CON_UNDERSCORE,
  88.         and CON_INVERSE.  The style is reset to CON_PLAIN before the desired
  89.         style is rendered each time this function executes so that the
  90.         effects of this function are not cumulative.
  91.  
  92.     foreground
  93.         The foreground is the color of the characters displayed by the
  94.         console device.  A value less than zero or greater than seven will
  95.         produce unexpected results.  Note that with the default Workbench
  96.         screen colors, a foreground color of 0 will result in blue letters, 1
  97.         in white, 2 in black, and 3 in orange.
  98.  
  99.     background
  100.         This is the color of the background of each character displayed by
  101.         the console device.  Note that with Topaz 80, the default Workbench
  102.         font used by the console device, the background will be a square 8x8
  103.         pixels in size.  Two warnings:  if the foreground and background
  104.         values are equal, the characters will be invisible.  Also, any time a
  105.         character is deleted, an 8x8 pixel square the color of the background
  106.         will appear at the right side of the field (or the console display if
  107.         fields are not being used).  This is a quality inherited from the
  108.         nature of the console device.
  109.  
  110.     If you have any questions on how colors are rendered with the console
  111.     device, use the included graphic rendition test program, g.c.  Note that
  112.     in most cases, a background color equal to the default background color
  113.     of the window will produce the best results.
  114.  
  115.  
  116. void con_left_offset( wreq, x )
  117.     struct IOStdReq *wreq
  118.     int x
  119.  
  120.     This function sets the console left offset (the left margin of the
  121.     console display) to horizontal pixel position x as measured from the left
  122.     edge of the window.  Note that the left-most pixel position in the window
  123.     is 0.
  124.  
  125.  
  126. void con_line_erase( wreq )
  127.     struct IOStdReq *wreq
  128.  
  129.     This function erases the console display to the end of the current line
  130.     as established by the con_line_length() function.  The default end of the
  131.     line is the right window border.
  132.  
  133.  
  134. void con_line_length( wreq, length )
  135.     struct IOStdReq *wreq
  136.     int length
  137.  
  138.     This function sets the length of the console line to length characters.
  139.     Because this is the length of every console line and not just the current
  140.     line, this in effect sets the right margin of the console display.  Thus,
  141.     this function must be called each time the cursor moves to a new field
  142.     because fields are not all necessarily the same length.
  143.  
  144.  
  145. void con_line_next( wreq )
  146.     struct IOStdReq *wreq
  147.  
  148.     This function moves the cursor to column 1 of the next console line.
  149.     Remember that rows (lines) and columns can vary in location during the
  150.     duration of a program and are based on the left and top offsets of the
  151.     console display as set by the con_left_offset() and con_top_offset()
  152.     functions.  Caution: if the cursor is near the bottom border of the
  153.     window such that there is not enough room for the next line to be
  154.     completely displayed, the ENTIRE console display will be scrolled up one
  155.     line to make room for the next line.
  156.  
  157.  
  158. void con_line_prev( wreq )
  159.     struct IOStdReq *wreq
  160.  
  161.     This function moves the cursor to column 1 of the previous console line.
  162.     Caution: if the cursor is near the top border of the window such that
  163.     there is not enough room for the previous line to be completely
  164.     displayed, the ENTIRE console display will be scrolled down one line to
  165.     make room for the previous line.
  166.  
  167.  
  168. void con_line_scroll_down( wreq )
  169.     struct IOStdReq *wreq
  170.  
  171.     This function scrolls the entire console display down one line, deleting
  172.     the bottom line and inserting a blank line at the top of the display.
  173.     Note that the console display is initially defined to be just inside the
  174.     window borders, but can be later defined horizontally by the
  175.     con_left_offset() and con_line_length() functions and vertically by the
  176.     con_top_offset() and con_page_length() functions.
  177.  
  178.  
  179. void con_line_scroll_up( wreq )
  180.     struct IOStdReq *wreq
  181.  
  182.     This function scrolls the entire console display up one line, deleting
  183.     the top line and inserting a blank line at the bottom of the display.
  184.  
  185.  
  186. void con_page_length( wreq, length )
  187.     struct IOStdReq *wreq
  188.     int length
  189.  
  190.     This function sets the length (actually height) of the console display to
  191.     length rows from the top of the display, which is initially the top
  192.     border of the window but can be redefined by the con_top_offset()
  193.     function.  Note that this is an offset from the top of the console
  194.     display, and not an absolute position in the window.
  195.  
  196.  
  197. void con_put_char( wreq, character )
  198.     struct IOStdReq *wreq
  199.     UBYTE character
  200.  
  201.     This function outputs the specified character to the console.
  202.  
  203.  
  204. void con_put_line( wreq, string, max )
  205.     struct IOStdReq *wreq
  206.     UBYTE *string
  207.     int max
  208.  
  209.     This function outputs to the console a null-terminated string of at most
  210.     max characters in length.  If string contains fewer than max characters,
  211.     the characters up to but not including the terminating null will be
  212.     output to the console.
  213.  
  214.  
  215. void con_put_string( wreq, string )
  216.     struct IOStdReq *wreq
  217.     UBYTE *string
  218.  
  219.     This function outputs a null-terminated string to the console.
  220.  
  221.  
  222. void con_read( rreq, input_buffer )
  223.     struct IOStdReq *rreq
  224.     UBYTE *input_buffer
  225.  
  226.     This function reads as many characters as possible from the console into
  227.     the specified input buffer, returning the actual number of characters
  228.     read.  Note that the buffer should be declared by your calling program to
  229.     be at least as large as CONSOLE_BUFFER_SIZE as defined in console/
  230.     console.h.  This function returns immediately even if no characters are
  231.     read.  Be careful to supply a pointer here to the READ request and not
  232.     the write request.
  233.  
  234.  
  235. void con_top_offset( wreq, y )
  236.     struct IOStdReq *wreq
  237.     int y
  238.  
  239.     This function sets the console top offset (the top of the console
  240.     display) to vertical pixel position y as measured from the top edge of
  241.     the window.  Note that the topmost pixel position in the window (which is
  242.     hidden by the title bar) is 0.
  243.  
  244.  
  245. void con_write( wreq, string, length )
  246.     struct IOStdReq *wreq
  247.     UBYTE *string
  248.     int length
  249.  
  250.     This function outputs a string of exactly length characters to the
  251.     console.  This function does not check for a terminating null.
  252.  
  253.  
  254.  
  255. Low-Level Console Functions: Cursor Movement
  256.  
  257. These functions handle all console cursor movement by outputting to the
  258. console device the required escape sequences.  Each function requires a
  259. pointer to the IOStdReq structure created either 1) by your calling program
  260. or 2) by the field_open function and pointed to by the WriteReq pointer in
  261. your FieldHeader structure.  With all of these cursor movement functions, if
  262. the cursor moves past the end of the current line, it will appear at the
  263. beginning of the next line.  Or if the cursor moves back past the beginning
  264. of the current line, it will appear at the end of the previous line.  Also be
  265. careful, because if the cursor moves back past the beginning of the display
  266. or forward past the end of the display, the entire display will scroll to
  267. make room for a previous or next line to which the cursor moves.
  268.  
  269.  
  270. void cursor_invisible( wreq )
  271.     struct IOStdReq *wreq
  272.  
  273.     This function renders the cursor invisible.
  274.  
  275.  
  276. void cursor_jump_left( wreq, positions )
  277.     struct IOStdReq *wreq
  278.     int positions
  279.  
  280.     This function moves the cursor positions character positions to the left
  281.     on the console display.  A value for positions less than 0 or greater
  282.     than 999 will cause unexpected results.  Because of the nature of the
  283.     console's cursor movement commands, a value of 0 for positions will
  284.     default to 1.
  285.  
  286.  
  287.  
  288. void cursor_jump_right( wreq, positions )
  289.     struct IOStdReq *wreq
  290.     int positions
  291.  
  292.     This function moves the cursor positions character positions to the right
  293.     on the console display.  A value for positions less than 0 or greater
  294.     than 999 will cause unexpected results.  Because of the nature of the
  295.     console's cursor movement commands, a value of 0 for positions will
  296.     default to 1.
  297.  
  298.  
  299. void cursor_left( wreq )
  300.     struct IOStdReq *wreq
  301.  
  302.     This function moves the cursor one character position to the left on the
  303.     console display.
  304.  
  305.  
  306. void cursor_place( wreq, x, y )
  307.     struct IOStdReq *wreq
  308.     int x
  309.     int y
  310.  
  311.     This function moves the cursor such that the upper left corner of the
  312.     cursor is located at the xth horizontal pixel position and the yth
  313.     vertical pixel as measured from the upper left corner of the window.
  314.     Note that the upper left corner of the window (at the top of the title
  315.     bar just to the left of the close gadget) is pixel position (0,0).
  316.  
  317.  
  318. void cursor_pos( wreq, row, col )
  319.     struct IOStdReq *wreq
  320.     int row
  321.     int col
  322.  
  323.     This function moves the cursor to the rowth row (horizontal rows) and
  324.     colth column (vertical columns) relative to the top and left edges of the
  325.     console display, respectively.  The top edge of the console display is
  326.     initially defined as the eleventh vertical pixel position (the twelfth
  327.     pixel), or the second pixel below the window's title bar.  This may be
  328.     changed, however, with the con_top_offset() function.  The left edge of
  329.     the console display is initially defined as the fourth horizontal pixel
  330.     position (the fifth pixel), but may be altered with the con_left_offset()
  331.     function.
  332.  
  333.  
  334. void cursor_right( wreq )
  335.     struct IOStdReq *wreq
  336.  
  337.     This function moves the cursor one character position to the right on the
  338.     console display.
  339.  
  340.  
  341. void cursor_visible( wreq )
  342.     struct IOStdReq *wreq
  343.  
  344.     This function renders the cursor visible.
  345.  
  346.  
  347.  
  348. Miscellaneous Console Functions
  349.  
  350. These are console-handling functions that do not fit into any of
  351. the above categories.
  352.  
  353.  
  354. long con_open( window, wreq, rreq )
  355.     struct Window *window
  356.     struct IOStdReq *wreq
  357.     struct IOStdReq *rreq
  358.  
  359.     This function opens the console device, returning the value CONSOLE_ERROR
  360.     as defined in console/console.h if the console device could not be
  361.     opened.  You need to pass a pointer to the window, and to the window's
  362.     read and write requests as opened either manually or by the field_open()
  363.     function in your calling program.
  364.  
  365.  
  366. void console_close( header )
  367.     struct ConsoleHeader *header
  368.  
  369.     This function closes the console device and deletes the console's read
  370.     and write requests and ports.  You can open all of the devices, ports,
  371.     and requests required for console operation using the console_open()
  372.     function.  However, if you decide to open these devices manually, be sure
  373.     to fill the ConsoleHeader structure with the correct pointers before
  374.     calling this function or the system will crash.
  375.  
  376. int console_input( header )
  377.     struct ConsoleHeader *header
  378.  
  379.     This function attempts to read from the console device, returning the
  380.     first character read.  If more than one character was read, the
  381.     subsequent characters are discarded.  This function is useful for console
  382.     programs where you handle your own input and output.  You can also use
  383.     this function to monitor input from "noisy" requesters--requesters which
  384.     have the NOISYREQ flag set which allows console input to be monitored.
  385.     Thus you can create a yes/no requester that allows the use of either the
  386.     mouse of keyboard shortcuts.
  387.  
  388.     This function will return the following based on the input:
  389.  
  390.         displayable characters
  391.             The ASCII value of the character itself will be returned.
  392.  
  393.         cursor controls
  394.             The cursor codes as defined in console/console.h will be
  395.             returned.  They include: CON_CURSOR_UP, CON_CURSOR_DOWN,
  396.             CON_CURSOR_LEFT, CON_CURSOR_RIGHT, CON_SHIFT_UP (which is the
  397.             up-arrow key and the SHIFT key pressed simultaneously),
  398.             CON_SHIFT_DOWN, CON_HELP, and CON_SHIFT_TAB.
  399.  
  400.         control keys
  401.             This function will return the sum of CON_CONTROL (as defined in
  402.             console/console.h) and the ASCII value of the character pressed
  403.             simultaneously with the control key.
  404.  
  405.         function keys
  406.             This function will return the values CON_F1 through CON_F10 as
  407.             defined in console/console.h corresponding to function keys F1
  408.             through F10, and values CON_SHIFT_F1 through CON_SHIFT_F10
  409.             corresponding to function keys F1 through F10 pressed
  410.             simultaneously with the SHIFT key.
  411.  
  412.         no character or unrecognizable character
  413.             This function will return zero if no characters are read or if
  414.             the code returned is not recognized by this function (which would
  415.             most likely indicate an error condition of some sort).  Strangely
  416.             enough, pressing CTRL-(hyphen) also returns zero.
  417.  
  418.         miscellaneous keys
  419.             The codes as defined in console/console.h for the remaining
  420.             miscellaneous keys may also be returned.  They include:
  421.             CON_BACKSPACE, CON_DELETE, CON_ESCAPE, CON_ALT_ESCAPE, CON_HELP,
  422.             and CON_RETURN.
  423.  
  424.         masked keys
  425.             Note that you can mask out certain characters from input using a
  426.             mask.  If the user inputs a masked-out character, zero will be
  427.             returned.
  428.  
  429.     WARNING: The ALT-space combination returns the code 0xa0 which is
  430.     accepted by the console_input() and field_input() functions.  Because
  431.     ALT-space does not produce alternate imagery but does produce a different
  432.     ASCII value, you may wish to eliminate this from the functions, either by
  433.     checking for it explicitly or by changing the displayable character test
  434.     in the console_input() and field_input() functions to buffer[where] >=
  435.     0xa1.
  436.  
  437.     Note that not all characters and key combinations are accessible through
  438.     the console device.  ONLY the following keys are:
  439.  
  440.         all of the lower ASCII characters (space through ~)
  441.         all of the upper ASCII characters accessible through ALT-key
  442.             combinations
  443.         the TAB and shifted-TAB keys
  444.         the ESCape, BACKSPACE, DELETE, RETURN, and HELP keys
  445.         the arrow keys and shifted-arrow keys
  446.         the function keys and shifted-functions keys
  447.         the ALT-space and CTRL-RETURN keys
  448.         all alphabetic control keys except:
  449.             CTRL-h which is an equivalent for BACKSPACE
  450.             CTRL-i which is an equivalent for TAB
  451.             CTRL-j which is an equivalent for CTRL-RETURN
  452.             CTRL-m which is an equivalent for RETURN
  453.             CTRL-{ which is an equivalent for ESCape
  454.  
  455.     Thus, if you want more key combinations such as ALT-arrow keys or access
  456.     to the Commodore-Amiga keys, you will have to use RAWKEY input instead.
  457.     For a complete list of all possible return codes, see the "Keyboard
  458.     Chart" section of this manual.
  459.  
  460.  
  461. int console_open( window, header, buffer )
  462.     struct Window *window
  463.     struct FieldHeader *header
  464.     UBYTE *buffer
  465.  
  466.     This function opens all of the devices, requests, and ports required for
  467.     console operation.  This function returns 0 (or CONSOLE_OPEN_OK as
  468.     defined in console/console.h) if everything was successfully opened, or a
  469.     flag defined in console/console.h if an error occurred.  If an error
  470.     occurs, you must shutdown your program immediately (and as gracefully as
  471.     possible).  Note that the pointers themselves in the ConsoleHeader
  472.     structure serve as flags as to whether the devices were opened
  473.     successfully.  As long as you have not manually modified these pointers,
  474.     you may call the console_close() function anytime after calling the
  475.     console_open() function and be assured only the correct devices will be
  476.     closed.  Be sure to initialize all ConsoleHeader structures to
  477.     INIT_CONSOLE_HEADER as defined in console/console.h in case your program
  478.     terminates before the console_open() function is called.  Specifically,
  479.     this function:
  480.  
  481.         - initializes the ConsoleHeader structure.
  482.         - creates the write port required for the console device.  If this
  483.               port could not be created, CONSOLE_EXIT_WPORT is returned.
  484.         - creates the write request required for the console device.  If this
  485.               request could not be created, CONSOLE_EXIT_WREQ is returned.
  486.         - creates the read port required for the console device.  If this
  487.               port could not be created, CONSOLE_EXIT_RPORT is returned.
  488.         - creates the read request required for the console device.  If this
  489.               request could not be created, CONSOLE_EXIT_RREQ is returned.
  490.         - opens the console device, returning CONSOLE_EXIT_CONSOLE if it
  491.               could not be opened.
  492.         - performs an initial read which "primes" the buffer.  This initial
  493.               read is essential before calling the console_input() function
  494.               for the first time.
  495.  
  496.     The arguments for this function are:
  497.  
  498.         window
  499.             This is a pointer to the window in which you open the console
  500.             device.
  501.  
  502.         header
  503.             Pointer to the ConsoleHeader structure to be used by the console
  504.             device.  You must define one of these structures in your calling
  505.             program for each console device you maintain.
  506.  
  507.         buffer
  508.             This is a pointer to the input buffer to be used by the console
  509.             device.  You must define this in your calling program to be at
  510.             least CONSOLE_BUFFER_SIZE bytes large (as defined in console/
  511.             console.h).
  512.  
  513.  
  514. Field Buffer Functions
  515.  
  516. These functions operate on the input buffers of the specified field.  The
  517. operations are performed at the BufferPos character position of the buffers
  518. pointed to by Buffer.  In each case, you pass a pointer to the field whose
  519. buffer you want modified.
  520.  
  521.  
  522. void buffer_char_delete( field )
  523.     struct Field *field
  524.  
  525.     This function deletes a character in the BufferPos character position in
  526.     the Buffer of the specified field.
  527.  
  528.  
  529. void buffer_char_insert( field )
  530.     struct Field *field
  531.  
  532.     This function moves all characters at and to the right of the BufferPos
  533.     character position in the buffer of the specified field one character
  534.     position to the right so that a character may be inserted.  The character
  535.     to be inserted is NOT done so by this function.
  536.  
  537.  
  538.  
  539. Field Mask Functions
  540.  
  541. These functions are used to create and modify masks used to filter console
  542. and field input.  For more information on masks, see the definition of the
  543. FieldMask structure.  Each of the functions requires a pointer to the mask
  544. you wish to modify, instead of the field using the mask.  This is because
  545. many fields can share the same mask.  The functions also require a set
  546. argument, which should be set to either MASK_ENABLE or MASK_DISABLE (defined
  547. in console/fields.h) depending on whether you want to enable or disable the
  548. specified characters from being input.  Note that this argument is an
  549. unsigned long integer.
  550.  
  551.  
  552. void mask_chars( mask, string, set )
  553.     struct FieldMask *mask
  554.     UBYTE *string
  555.     ULONG set
  556.  
  557.     This function either enables or disables the characters in the null-
  558.     terminated string pointed to by string.  Some examples:
  559.  
  560.         mask_chars( &yn_mask, "YNyn", MASK_ENABLE )
  561.             ...for a simple single-character yes/no field
  562.         mask_chars( &date_mask, "0123456789/- ", MASK_ENABLE )
  563.             ...for a date field or social security number field
  564.  
  565.  
  566. void mask_entire( mask, set )
  567.     struct FieldMask *mask
  568.     ULONG set
  569.  
  570.     This function either enables or disables the entire ASCII character set.
  571.     Or, instead of using this function, you may pre-initialize a mask by
  572.     setting the mask equal to MASK_ENTIRE_ENABLED or MASK_ENTIRE_DISABLED as
  573.     defined in console/fields.h.
  574.  
  575.  
  576. void mask_range( mask, low, high, set )
  577.     struct FieldMask *mask
  578.     UBYTE low
  579.     UBYTE high
  580.     ULONG set
  581.  
  582.     This function allows you to enable or disable a range of ASCII characters
  583.     from low to high, inclusive.  For example:
  584.  
  585.         mask_range( &upper_mask, 'A', 'Z', MASK_ENABLE )
  586.             ...to allow only upper-case alphabetic characters
  587.         mask_range( &digit_mask, '0', '9', MASK_ENABLE )
  588.             ...to allow only numeric digits
  589.         mask_range( &alpha_mask, 'A', 'Z', MASK_ENABLE )
  590.         mask_range( &alpha_mask, 'a', 'z', MASK_ENABLE )
  591.             ...to allow only alphabetic characters
  592.  
  593.     Notice from the above example, you can make multiple mask function calls
  594.     to configure a mask to your specifications.  You can also mix the
  595.     different functions and different set flags.
  596.  
  597.  
  598.  
  599. Low-Level Field Functions
  600.  
  601. These functions are used to manage and display the field output.  They handle
  602. all field calculations required, such as updating the NumChars and BufferPos
  603. parameters, and then they call the low-level console functions to move the
  604. cursor and display the field contents.  Unless you are handling your own
  605. field I/O, your program will not need to call these functions because the
  606. field_input() function will accept your input and handle the output for you.
  607. Most of the functions require a pointer to the field on which you want to
  608. perform the operation (usually the current field) and a pointer to the
  609. console's write request as opened either manually by your program or by the
  610. field_open() function.  To make these definitions easier to comprehend, even
  611. though these functions are not necessarily performed on the current active
  612. field (the field in which the cursor is located), their definitions will
  613. assume they are.
  614.  
  615. There are a few definitions which need to be made:
  616.  
  617.     current buffer position
  618.         This is the position in the field where the cursor would appear if
  619.         the field was active.  It is stored in the BufferPos parameter of the
  620.         Field structure.  Note that because BufferPos describes the current
  621.         location in the field's buffer (which is a string, or in other words,
  622.         just an array of characters), the first character occupies buffer
  623.         position zero.  All manipulations done to the field's buffer is
  624.         correspondingly displayed in the field on the screen.
  625.  
  626.     beginning of the field
  627.         This is simply the beginning of the field, in other words, the first
  628.         character position, and BufferPos will equal zero.
  629.  
  630.     absolute end of the field
  631.         This is the position in the field where the cursor rests when the
  632.         maximum number of allowed characters (MaxChars) has been entered into
  633.         the field.  Note that because MaxChars is the length of the field
  634.         including the terminal null, BufferPos will always be less than or
  635.         equal to MaxChars - 2 (minus one because of the terminal null and
  636.         minus another because BufferPos starts from zero).
  637.  
  638.     current end of the field
  639.         If the field is not completely full, the current end of the field is
  640.         one character position to the right of the position occupied by the
  641.         last character currently in the field.  For example, if the field
  642.         contains the word "Smart" (without the quotes), then NumChars (which
  643.         is the number of characters currently in a field) will equal 5.  The
  644.         last character in the field (the 't') occupies buffer position 4,
  645.         therefore the current end of the field will be buffer position 5.
  646.         Note that if the field contains trailing blanks, the end of the field
  647.         may appear to be past the last character in the field.
  648.  
  649.         On the other hand, if the field is completely full, the cursor is
  650.         considered to be at the absolute end of the field.  Since the cursor
  651.         cannot extend past the absolute end of the field, the cursor will
  652.         remain in the last character position in the field even after a
  653.         character has been typed there.  If you are in typeover mode, you can
  654.         continue typing, and each character you type will just be written
  655.         over the last character in the field.
  656.  
  657. One more note: when the user performs a field function that is not allowed,
  658. the screen will flash.  This is accomplished by calling the intuition.library
  659. DisplayBeep() function, as defined by FLASH_SCREEN in console/console.h.  You
  660. may substitute your own warning procedure if you wish.
  661.  
  662.  
  663. void field_char_backspace( field, wreq )
  664.     struct Field *field
  665.     struct IOStdReq *wreq
  666.  
  667.     This function deletes the character under the cursor and moves all
  668.     characters to the right of the cursor one character position to the left
  669.     to fill in for the deleted character.  If the cursor is at the beginning
  670.     of the field, the screen will flash, indicating that there are no
  671.     characters to the left of the cursor to delete.
  672.  
  673.  
  674. void field_char_delete( field, wreq )
  675.     struct Field *field
  676.     struct IOStdReq *wreq
  677.  
  678.     This function deletes the character under the cursor in the specified
  679.     field.  If there is no character under the cursor (in other words, the
  680.     cursor is one character position to the right of the last character in
  681.     the field) or if the buffer is empty, then the screen will flash
  682.     indicating that there is no character to delete.
  683.  
  684.  
  685. void field_char_type( field, wreq, character, mode )
  686.     struct Field *field
  687.     struct IOStdReq *wreq
  688.     UBYTE character
  689.     int mode
  690.  
  691.     This function outputs the specified character to the specified field at
  692.     the current cursor position.  mode is the typing mode, either
  693.     INSERT_TYPE_MODE or TYPEOVER_TYPE_MODE as defined in console/console.h.
  694.  
  695.     If the mode is TYPEOVER_TYPE_MODE (the default), character is displayed
  696.     at the cursor, replacing the character currently in that position, if
  697.     any, and the cursor moves one character position to the right.  If the
  698.     cursor is at the absolute end of the field, character will replace the
  699.     last character in the field, but the cursor will not move, remaining over
  700.     the character just typed.
  701.  
  702.     If the mode is INSERT_TYPE_MODE, character is inserted at the cursor,
  703.     moving all characters at and to the right of the cursor one character
  704.     position to the right to make room for the inserted character.  If the
  705.     field is full, the screen will flash, indicating that there is no more
  706.     room to insert any characters.
  707.  
  708.  
  709. void field_copy( field, wreq )
  710.     struct Field *field
  711.     struct IOStdReq *wreq
  712.  
  713.     This function copies the current contents of the specified field to the
  714.     field clip.  If the field is empty, the screen will flash indicating that
  715.     there are no characters to be copied.  This function has an added
  716.     safeguard that makes sure it doesn't copy more characters than the clip
  717.     can handle.  The clip is initially defined in console/fields.h to be 80
  718.     (FIELD_CLIP_SIZE) characters long, which is perhaps the longest single-
  719.     line field you could have on a screen.  Note that all of the field
  720.     functions assume a single-line field.
  721.  
  722.  
  723. void field_cursor_left( field, wreq )
  724.     struct Field *field
  725.     struct IOStdReq *wreq
  726.  
  727.     This function moves the cursor to the beginning of the specified field.
  728.     If the cursor is already at the beginning of the field, the screen will
  729.     flash.
  730.  
  731.  
  732. void field_cursor_right( field, wreq )
  733.     struct Field *field
  734.     struct IOStdReq *wreq
  735.  
  736.     This function moves the cursor to the current end of the specified field.
  737.     If the cursor is already at the current end of the field, the screen will
  738.     flash.
  739.  
  740.  
  741. void field_cut( field, wreq )
  742.     struct Field *field
  743.     struct IOStdReq *wreq
  744.  
  745.     This function copies the current contents of the specified field to the
  746.     field clip, then deletes the contents of that field.  This is
  747.     accomplished by first calling the field_copy() function, and then calling
  748.     the field_delete() function.  If the field is already empty, the screen
  749.     will flash indicating that there are no characters to be cut.
  750.  
  751.  
  752. void field_delete( field, wreq )
  753.     struct Field *field
  754.     struct IOStdReq *wreq
  755.  
  756.     This function deletes the entire contents of the specified field, copying
  757.     the contents of the buffer to the UndoBuffer so that the field contents
  758.     may be restored by the field_restore() function.  If the field is already
  759.     empty, the screen will flash, indicating that there are no characters to
  760.     delete.
  761.  
  762.  
  763. void field_delete_backward( field, wreq )
  764.     struct Field *field
  765.     struct IOStdReq *wreq
  766.  
  767.     This function deletes the contents to the left of the cursor in the
  768.     specified field, moving the cursor and the character under the cursor to
  769.     the first position in that field.  All characters to the right of the
  770.     cursor are also moved left to fill in for the deleted characters.  If the
  771.     cursor is already at the beginning of the field, the screen will flash,
  772.     indicating that there are no characters to the left of the cursor to be
  773.     deleted.
  774.  
  775.  
  776. void field_delete_forward( field, wreq )
  777.     struct Field *field
  778.     struct IOStdReq *wreq
  779.  
  780.     This function deletes the contents of the specified field under and to
  781.     the right of the cursor.  The cursor will not move.  If the cursor is
  782.     already at the current end of the field, the screen will flash,
  783.     indicating that there are no characters to the right of the cursor to be
  784.     deleted.
  785.  
  786.  
  787. void field_dup( field, wreq )
  788.     struct Field *field
  789.     struct IOStdReq *wreq
  790.  
  791.     This function replaces the contents of the specified field with the
  792.     contents of the DupBuffer.  If the DupBuffer is empty, the screen will
  793.     flash, indicating that there are no characters to duplicate.  The
  794.     DupBuffer remains intact, for it is maintained only by the field_clear()
  795.     function.
  796.  
  797.  
  798. void field_left( field, wreq )
  799.     struct Field *field
  800.     struct IOStdReq *wreq
  801.  
  802.     This function moves the cursor to the beginning of the specified field.
  803.     If the cursor is already at the beginning of the field, the screen will
  804.     flash.
  805.  
  806.  
  807. void field_paste( field, wreq )
  808.     struct Field *field
  809.     struct IOStdReq *wreq
  810.  
  811.     This function replaces the contents of the specified field with the
  812.     contents of the field clip.  If the contents of the field clip are longer
  813.     than MaxChars - 1 characters, only MaxChars - 1 characters will be
  814.     copied.  If the field clip is empty, the screen will flash, indicating
  815.     that there are no characters to be pasted.
  816.  
  817.  
  818. void field_restore( field, wreq )
  819.     struct Field *field
  820.     struct IOStdReq *wreq
  821.  
  822.     This function replaces the contents of the specified field with the
  823.     contents of the UndoBuffer.  If the UndoBuffer is empty, the screen will
  824.     flash, indicating that there are no characters to restore.  The
  825.     UndoBuffer is filled with the contents of the Buffer every time the
  826.     field_delete() or field_goto() functions are called.
  827.  
  828.  
  829. void field_right( field, wreq )
  830.     struct Field *field
  831.     struct IOStdReq *wreq
  832.  
  833.     This function moves the cursor to the current end of the specified field.
  834.     If the cursor is already at the current end of the field, the screen will
  835.     flash.
  836.  
  837.  
  838. void field_tab_backward( field, wreq )
  839.     struct Field *field
  840.     struct IOStdReq *wreq
  841.  
  842.     This function moves the cursor TAB_JUMP (as defined in console/console.h)
  843.     character positions to the left in the specified field.  If the cursor is
  844.     fewer than TAB_JUMP character positions from the beginning of the field,
  845.     the cursor will just be placed in the beginning of the field.  However,
  846.     if the cursor is already at the beginning of the field, the screen will
  847.     flash, indicating that the cursor cannot move any further to the left.
  848.  
  849.  
  850. void field_tab_forward( field, wreq )
  851.     struct Field *field
  852.     struct IOStdReq *wreq
  853.  
  854.     This function moves the cursor TAB_JUMP (as defined in console/console.h)
  855.     character positions to the right in the specified field.  If the cursor
  856.     is fewer than TAB_JUMP character positions from the current end of the
  857.     field, the cursor will just be placed in the current end of the field.
  858.     However, if the cursor is already at the current end of the field, the
  859.     screen will flash, indicating that the cursor cannot move any further to
  860.     the right.
  861.  
  862.  
  863.  
  864. Field Display Functions
  865.  
  866. These functions are used by your calling program to display entire fields or
  867. lists of fields.  All of the functions require the following arguments:
  868.  
  869.     struct FieldHeader *header
  870.         This is a pointer to the header structure used by all of the field(s)
  871.         you wish to display, so that they can access the window structure and
  872.         the console's write request.
  873.  
  874.     struct Field *first
  875.         With these functions, you can display a single field or a sub-list of
  876.         the entire field list for a window.  You pass to these functions a
  877.         pointer to the first field in the sub-list you wish to display, which
  878.         may not necessarily be the first field in the window's list.
  879.  
  880.     UINT count
  881.         This is the number of fields you wish to display, or
  882.         -1 if you want to display all fields until the end of the list (in
  883.         other words, field->NextField is NULL).  The functions will display
  884.         count number of fields or until the end of the field list, whichever
  885.         comes first.  The number of fields actually displayed (which of
  886.         course would be less than or equal to count) is returned.
  887.  
  888.         UINT is typedef'd in toolkit/toolkit.h as an unsigned integer.  When
  889.         you specify count as -1 to display to the end of the list, the UINT
  890.         declaration changes -1 to 65536, which cannot be reached with the
  891.         integer field counter in each of the functions.  Thus, the entire
  892.         list is displayed.
  893.  
  894.     struct Field *place
  895.         This is a pointer to the field in which you want to place the cursor
  896.         after the fields are displayed.  If you just want to display the
  897.         fields but not make any field the current field, set this pointer to
  898.         NULL.  WARNING: These functions leave the cursor invisible in the
  899.         last field displayed, but do not update the CurrentField pointer in
  900.         the header structure.  Therefore, if you specify place as NULL, you
  901.         MUST call the field_goto() function before calling any of the field
  902.         I/O functions (especially field_input()), otherwise the display may
  903.         become corrupt.
  904.  
  905.  
  906. int field_clear( header, first, count, place )
  907.     struct FieldHeader *header
  908.     struct Field *first
  909.     UINT count
  910.     struct Field *place
  911.  
  912.     This function clears the contents of the fields in the list, placing the
  913.     current contents of each field in the field's DupBuffer (if it has one).
  914.     The field contents are cleared using the graphics.library RectFill()
  915.     function, clearing from Left,Top to Right,Bottom with the BackPen color.
  916.     This function also calls the SetAPen() function, so if you plan on doing
  917.     your own rendering after this function, be sure to set the A Pen back to
  918.     your desired color.
  919.  
  920.  
  921. int field_display( header, first, count, place )
  922.     struct FieldHeader *header
  923.     struct Field *first
  924.     UINT count
  925.     struct Field *place
  926.  
  927.     This function displays the contents of each field in the list.  Because
  928.     it does not erase the current contents of a field, use this function only
  929.     if the all of the fields are blank.  If you plan on changing a field
  930.     which has existing input, use the field_redisplay() function.
  931.  
  932.  
  933. int field_redisplay( header, first, count, place )
  934.     struct FieldHeader *header
  935.     struct Field *first
  936.     UINT count
  937.     struct Field *place
  938.  
  939.     This function deletes the current display of each field in the list,
  940.     redisplaying each field based on its Buffer contents.  This function is
  941.     extremely handy for formatted input fields.  For example, if you have a
  942.     date field, you can allow the user to just type in the digits as mmddyy.
  943.     Once the user presses RETURN, you can call this function to redisplay the
  944.     field with the formatted date mm/dd/yy.  Do this by manually changing the
  945.     contents of Buffer, then immediately calling this function.  Although the
  946.     argument count will almost always be 1 for this function, it was provided
  947.     for consistency with the other field display functions.
  948.  
  949.  
  950. int field_refresh( header, first, count, place )
  951.     struct FieldHeader *header
  952.     struct Field *first
  953.     UINT count
  954.     struct Field *place
  955.  
  956.     This function displays the contents of each field in the list, plus
  957.     renders each field's image, border, and title.  Because this function
  958.     does not erase the current contents of a field, do not use it to
  959.     redisplay a field whose contents have been changed.  Instead, use this
  960.     function to 1) initially display a field or field list in a window and 2)
  961.     to refresh the display of a field whose display may have been corrupted
  962.     by window sizing or by your own graphic rendering.  Thus, if you have the
  963.     REFRESHWINDOW flag set for your window, call field_refresh() BEFORE your
  964.     BeginRefresh()/EndRefresh() function pair.  This is because
  965.     BeginRefresh() locks layers which the console program uses to render its
  966.     cursor.
  967.  
  968.     This function creates the field display in the following order:  1)
  969.     renders the field's image, 2) border, 3) title, and 4) contents.  Note
  970.     that any imagery under the field contents will be destroyed.
  971.  
  972.     This is also the only SmartFields function that determines the Right and
  973.     Top edges of each field.  These parameters determine whether a field can
  974.     be available for input, whether a field's contents may be displayed, and
  975.     also sets the boundaries for field clearing and mouse clicks.  These
  976.     parameters are calculated using the size of the window's default font,
  977.     the size of the window's borders, and the size of the window itself.
  978.     Therefore, if any of these factors change (such as after a window
  979.     sizing), this function should be called.
  980.  
  981.  
  982. int field_reshow( header, first, count, place )
  983.     struct FieldHeader *header
  984.     struct Field *first
  985.     UINT count
  986.     struct Field *place
  987.  
  988.     This function is identical to the field_redisplay() function, except that
  989.     field_reshow() does not assume that each field has a Buffer.  As a matter
  990.     of fact, this is the only SmartFields function that does not make that
  991.     assumption.  You can use this function in a simple word processing
  992.     program set up using SmartFields, for example.  In that situation, not
  993.     every field would necessarily have input.
  994.  
  995.  
  996.  
  997. Miscellaneous Field I/O Functions
  998.  
  999. These three functions do not fit into any other category but are extremely
  1000. important.
  1001.  
  1002.  
  1003. struct Field *field_click( header, mouseX, mouseY )
  1004.     struct FieldHeader *header
  1005.     SHORT mouseX
  1006.     SHORT mouseY
  1007.  
  1008.     This function checks the entire field list corresponding to the specified
  1009.     header to see if the mouse was clicked in any of the fields.
  1010.  
  1011.     To monitor for mouse input, set the MOUSEBUTTONS IDCMP flag in your
  1012.     window structure.  When a MOUSEBUTTONS input event has been generated,
  1013.     check the IntuiMessage structure's Code parameter.  If it equals
  1014.     LEFT_MOUSE_BUTTON as defined in console/fields.h, call the field_click()
  1015.     function.  This function will then return a pointer to the field in which
  1016.     the mouse was clicked and fill the BufferPos parameter in the supplied
  1017.     FieldHeader structure with the character position in that field where the
  1018.     mouse was clicked.  If the mouse was clicked outside all of the fields in
  1019.     the list, NULL will be returned.
  1020.  
  1021.     Note that this function does not call the field_goto() function.
  1022.     Therefore, it is entirely up to your calling program whether you want to
  1023.     move the cursor to the field in which the mouse was clicked.  If you do,
  1024.     you must call the field_goto() function yourself.  For more information,
  1025.     see the example program, e.c.
  1026.  
  1027.     The area occupied by MaxChars characters in the default window font is
  1028.     considered to be the field's edges when checking for mouse clicks.  In
  1029.     addition to just being clicked within the field's borders, this function
  1030.     also checks to make sure that the field is enabled.  Also, the entire
  1031.     field must appear within the visible portion of the window (the same
  1032.     requirement as for an active field).  If the mouse is clicked within a
  1033.     field but past the current end of the field, the current end of the field
  1034.     is returned in the BufferPos parameter.
  1035.  
  1036.  
  1037. void field_goto( header, field )
  1038.     struct FieldHeader *header
  1039.     struct Field *field
  1040.  
  1041.     This function moves the cursor to the BufferPos character position in the
  1042.     specified field, makes it the current field by storing its address in the
  1043.     CurrentField parameter of the header structure, and copies the current
  1044.     contents of the specified field to its UndoBuffer.  These contents can
  1045.     then be restored at any time with the field_restore() function.
  1046.  
  1047.     It is essential that you use this function to move the cursor from field
  1048.     to field because this function performs these "housekeeping" duties
  1049.     required for the smooth operation of the SmartFields system in addition
  1050.     to the above:
  1051.  
  1052.         - establishes the field's graphic rendition characteristics
  1053.         - sets the console line length
  1054.         - makes the cursor visible only if the specified field is entirely
  1055.               visible within the window
  1056.  
  1057.  
  1058. int field_input( header )
  1059.     struct FieldHeader *header
  1060.  
  1061.     This function handles all of the input in the SmartFields system.
  1062.     field_input() reads from the console device, performs any field output as
  1063.     necessary, and returns a code detailing what action was taken or needs to
  1064.     be taken by the calling program.  These return codes are defined in
  1065.     console/fields.h.  This function performs the following actions:
  1066.  
  1067.         - attempts to read from the console device, returning zero if no
  1068.               characters are read.
  1069.         - checks to make sure there is a current field.  If there is no
  1070.               CurrentField, FIELD_NO_CURRENT is returned.
  1071.         - checks if the CurrentField is contained entirely within the visible
  1072.               portion of the window.  If not, FIELD_OFF is returned.
  1073.         - checks if the character pressed is allowed according to the
  1074.               CurrentField's established mask.  If not, the screen flashes,
  1075.               and FIELD_SWALLOW is returned.  Remember, if no mask is
  1076.               specified, all input characters are allowed.
  1077.  
  1078.     If the function makes it past these checks, it may perform a field
  1079.     maintenance function.  This includes typing, inserting, or deleting
  1080.     characters in a field or moving the cursor within a field.  If such an
  1081.     action occurs (which requires no intervention from your calling program),
  1082.     the value FIELD_SWALLOW will be returned.  Because FIELD_SWALLOW is the
  1083.     most-often returned value, you should make this your first check in your
  1084.     calling program.
  1085.  
  1086.     This function may also return some values which require program response.
  1087.     Actually, response is not required, so it is up to you to decide to which
  1088.     field inputs you want to respond.  They include:
  1089.  
  1090.         cursor movements
  1091.             - FIELD_RETURN ..... <RETURN> or <ENTER> keys
  1092.             - FIELD_PREVIOUS ... up-arrow key
  1093.             - FIELD_NEXT ....... down-arrow key
  1094.             - FIELD_FIRST ...... shifted up-arrow key
  1095.             - FIELD_FINAL ...... shifted down-arrow key
  1096.  
  1097.         individual keys
  1098.             - FIELD_ESCAPE ..... <ESCape> key
  1099.             - FIELD_HELP ....... <HELP> key
  1100.  
  1101.         function keys
  1102.             FIELD_F1 through FIELD_F10 is returned when the function keys F1
  1103.             through F10 are pressed, and FIELD_SHIFT_F1 through
  1104.             FIELD_SHIFT_F10 are returned when the shifted function keys F1
  1105.             through F10 are pressed.
  1106.  
  1107.  
  1108.  
  1109. Field List Maintenance Functions
  1110.  
  1111. This final group of functions perform all of the background functions which
  1112. create, destroy, and maintain your field lists.
  1113.  
  1114.  
  1115. int field_add_list( header, position, add, count )
  1116.     struct FieldHeader *header
  1117.     UINT position
  1118.     struct Field *add
  1119.     UINT count
  1120.  
  1121.     This function allows you to add a sub-list of fields to the existing (or
  1122.     non-existing) list of fields maintained by the FieldHeader structure
  1123.     pointed to by header.  This function will attempt to add count number of
  1124.     fields in the field sub-list pointed to by add, placing the add field in
  1125.     the specified position in the existing list if possible.  The actual
  1126.     position in which the sub-list was added is returned.  Note that you can
  1127.     specify -1 for position to add the sub-list to the end of the existing
  1128.     list, or 0 or 1 to add the sub-list to the beginning of the existing
  1129.     list.  Specifying -1 for count will add the entire sub-list (until field-
  1130.     >NextField is NULL).  Your calling program is required, however, to
  1131.     display the added fields itself.
  1132.  
  1133.  
  1134. void field_close( header )
  1135.     struct FieldHeader *header
  1136.  
  1137.     This function closes the console device and deletes the console's read
  1138.     and write requests and ports.  You can open all of the devices, ports,
  1139.     and requests required for SmartFields operation using the field_open()
  1140.     function.  However, if you decide to open these devices manually, be sure
  1141.     to fill the FieldHeader structure with the correct pointers before
  1142.     calling this function or the system will crash.
  1143.  
  1144.  
  1145. void field_disable( header, field )
  1146.     struct FieldHeader *header
  1147.     struct Field *field
  1148.  
  1149.     This function disables the specified field, which means it is no longer
  1150.     available for input.  At this time, there is no visual indication to the
  1151.     user that this field has been disabled other than the user cannot enter
  1152.     data in it.  You may wish to notify the user on your own by removing the
  1153.     field's border (by setting the border's FrontPen equal to the window's
  1154.     default background color) or something similar.  If the specified field
  1155.     is the current field when you call this function, the CurrentField
  1156.     pointer in the FieldHeader structure is set to NULL, and the cursor
  1157.     disappears.  Be sure to call this function instead of manually setting
  1158.     the Enabled flag to allow for upward compatibility.
  1159.  
  1160.  
  1161. void field_enable( field )
  1162.     struct Field *field
  1163.  
  1164.     This function enables the specified field for input, but does not make
  1165.     this field the current field.  To make this field the current field, call
  1166.     the field_goto() function.
  1167.  
  1168.  
  1169. struct Field *field_link( final )
  1170.     struct Field *final
  1171.  
  1172.     When you pre-initialize field structures in your calling program, you set
  1173.     all of the PrevField pointers to point to the previous field listed.
  1174.     Pre-initialization, however, does not allow you to set the NextField
  1175.     pointers.  By supplying a pointer to the final field in a field list,
  1176.     this function steps through the list using the PrevField pointer and sets
  1177.     the NextField pointer for each field, including the NULL pointer for the
  1178.     final field.  A pointer to the first field in the list is returned.  This
  1179.     function is automatically called by the field_open() function.  If you
  1180.     open the required SmartFields devices yourself, however, be sure to call
  1181.     the field_link() function because many of the SmartFields functions
  1182.     require a valid NextField pointer.
  1183.  
  1184.  
  1185. int field_open( window, header, initial, final, buffer )
  1186.     struct Window *window
  1187.     struct FieldHeader *header
  1188.     struct Field *initial
  1189.     struct Field *final
  1190.     UBYTE *buffer
  1191.  
  1192.     This function opens all of the devices, requests, and ports required for
  1193.     SmartFields operation.  This function returns 0 (or FIELD_OPEN_OK as
  1194.     defined in console/fields.h) if everything was successfully opened, or a
  1195.     flag defined in console/fields.h if an error occurred.  If an error
  1196.     occurs, you must shutdown your program immediately (and as gracefully as
  1197.     possible).  Note that the pointers themselves in the FieldHeader
  1198.     structure serve as flags as to whether the devices were opened
  1199.     successfully.  As long as you have not manually modified these pointers,
  1200.     you may call the field_close() function anytime after calling the
  1201.     field_open() function and be assured only the correct devices will be
  1202.     closed.  Be sure to pre-initialize all FieldHeader structures to
  1203.     INIT_FIELD_HEADER defined in console/fields.h in case your program
  1204.     terminates before the field_open() function is called.  Specifically,
  1205.     this function:
  1206.  
  1207.         - initializes the FieldHeader structure.
  1208.         - links the fields using the field_link() function.
  1209.         - creates the write port required for the console device.  If this
  1210.               port could not be created, FIELD_EXIT_WPORT is returned.
  1211.         - creates the write request required for the console device.  If this
  1212.               request could not be created, FIELD_EXIT_WREQ is returned.
  1213.         - creates the read port required for the console device.  If this
  1214.               port could not be created, FIELD_EXIT_RPORT is returned.
  1215.         - creates the read request required for the console device.  If this
  1216.               request could not be created, FIELD_EXIT_RREQ is returned.
  1217.         - opens the console device, returning FIELD_EXIT_CONSOLE if it could
  1218.               not be opened.
  1219.         - renders the cursor invisible.
  1220.         - performs an initial read which "primes" the buffer.  This initial
  1221.               read is essential before calling the field_input() function for
  1222.               the first time.
  1223.  
  1224.     The arguments for this function are:
  1225.  
  1226.         window
  1227.             This is a pointer to the window to contain the field list.  Note
  1228.             that you can have many field lists per window (although only one
  1229.             is recommended), but only one window per field list.
  1230.  
  1231.         header
  1232.             Pointer to the FieldHeader structure to be used by the field
  1233.             list.  You must defined one of these structures in your calling
  1234.             program for each field list you maintain.
  1235.  
  1236.         initial
  1237.             This is the field which you want to make the initial current
  1238.             field.  You may set this to NULL.  See the example "Vendor
  1239.             Maintenance" program e.c as to how setting this field may be
  1240.             advantageous.
  1241.  
  1242.         final
  1243.             This is a pointer to the final field in the field list and is
  1244.             used for the field_list() function.
  1245.  
  1246.         buffer
  1247.             This is a pointer to the input buffer to be used by the console
  1248.             device.  You must define this in your calling program to be at
  1249.             least CONSOLE_BUFFER_SIZE bytes large (as defined in console/
  1250.             console.h).
  1251.  
  1252.  
  1253. int field_remove_list( header, remove, count )
  1254.     struct FieldHeader *header
  1255.     struct Field *remove
  1256.     UINT count
  1257.  
  1258.     This function allows you to remove a sub-list of fields from the existing
  1259.     (or non-existing) list of fields maintained by the FieldHeader structure
  1260.     pointed to by header.  This function will attempt to remove count number
  1261.     of fields from the field list beginning with the field pointed to by
  1262.     remove.  The actual number of fields removed is returned.  Note that you
  1263.     can specify -1 for count to remove all fields until the end of the list.
  1264.     If you happen to remove the current field, the CurrentField pointer in
  1265.     the FieldHeader structure is set to NULL, and the cursor disappears.  It
  1266.     is up to your calling program to clear the imagery of the removed fields,
  1267.     however.
  1268.  
  1269.  
  1270. Function Descriptions  01/13/90
  1271. © Copyright 1990 Timm Martin
  1272. All Rights Reserved Worldwide
  1273.  
  1274. /*-- END --*/
  1275.