home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / edit / edutils / readme.doc < prev   
Encoding:
Text File  |  1994-03-06  |  49.0 KB  |  1,052 lines

  1.  
  2. -------------------------------------------------------------------------------
  3. ----------------------------- EDUTILS Version 1.0 -----------------------------
  4. -------------------------------------------------------------------------------
  5.  
  6.                          Written By:  Kenneth J. Macke
  7.  
  8.                      (c) Copyright 1994  Kenneth J. Macke
  9.  
  10.  
  11. EDUTILS is a library of text-mode eduting functions designed to make it
  12. as easy as possible to add editing and viewing of files and string
  13. variables into your programs.
  14.  
  15. To offer suggestions, please write the following address, or contact me
  16. at my Compuserve or Internet address.
  17.  
  18. Compuserve address:   73020,2265
  19. Internet address:     73020,2265@CompuServe.COM
  20.  
  21. Kenneth J. Macke
  22. P.O. Box 11313
  23. Cincinnati, OH  45211
  24.  
  25.  
  26. Shareware is a wonderful concept that enables the programmer to write
  27. new and innovative programs and utilities that can be used by anyone
  28. on a "try before you buy" basis.  The number of registrations for this
  29. program will show me the interest that exists for this utility, and will
  30. determine whether or not I release another improved version.  If you
  31. find this utility useful, please register!
  32.  
  33. To register, use the following chart to determine the registration fee,
  34. then send your name, address, and phone number with a check or money order
  35. made payable to Kenneth J. Macke to the above address.
  36.  
  37.                                REGISTRATION FEES
  38.          ┌────────────────────────────────┬─────────────────────┐
  39.          │  Description of User Account   │   Registration Fee  │
  40.          ├────────────────────────────────┼─────────────────────┤
  41.          │  Personal use only             │        $15          │
  42.          │  Personal use to be sold       │        $25          │
  43.          │  Business internal use         │        $35          │
  44.          │  Business use to be sold       │        $45          │
  45.          └────────────────────────────────┴─────────────────────┘
  46.  
  47. -------------------------------------------------------------------------------
  48.                                   DISCLAIMER
  49. EDUTILS has been thoroughly tested and should perform exactly as specified.
  50. However, as with all software, some problems may still exist.  It is
  51. recommended that you test any application developed with EDUTILS thoroughly
  52. on test data to your satisfaction before using it in full.  I cannot assume
  53. any responsibility for damage or lost data caused in part or in full by
  54. EDUTILS or any application developed with EDUTILS.
  55.                                         -- Kenneth J. Macke
  56. -------------------------------------------------------------------------------
  57.  
  58.  
  59. -------------------------------------------------------------------------------
  60.  
  61. -------------------------------------------------------------------------------
  62.  
  63.                                TABLE OF CONTENTS
  64. 1. Introduction.......................................................1
  65. 2. Installation.......................................................2
  66. 3. Choosing the Correct EDUTILS Library...............................3
  67. 4. Compiling and Linking Your Programs................................4
  68. 5. Using the EDUTILS Functions........................................5
  69. 6. Changing Editor Parameters........................................14
  70. 7. What Happened?  Examining Result Codes............................19
  71.  
  72. APPENDIX A.  A listing of the ed_set_default_parameters function.....22
  73. APPENDIX B.  Examples................................................24
  74. APPENDIX C.  Usage Notes.............................................25
  75.  
  76.  
  77. -------------------------------------------------------------------------------
  78.  
  79. -------------------------------------------------------------------------------
  80. 1.  Introduction                                                             1
  81.  
  82. EDUTILS is a library of Editing Utilities which allows any programmer to
  83. add simple text-mode editing/viewing windows to their programs.
  84.  
  85. With EDUTILS you can write very short, simple programs to create a
  86. README-style file viewer, and Panel Field Editor, or just simplify the
  87. task of acquiring character data from the user.
  88.  
  89. -------------------------------------------------------------------------------
  90.  
  91. -------------------------------------------------------------------------------
  92. 2.  Installation                                                             2
  93.  
  94. The EDUTILS Package consists of the following files:
  95.     README.DOC        -- This documentation file
  96.     ORDER.DOC         -- Registration information
  97.     EDUTILS.H         -- Include file
  98.     EDUTILSS.LIB      -- Small Memory Model Library
  99.     EDUTILSM.LIB      -- Medium Memory Model Library
  100.     EDUTILSC.LIB      -- Compact Memory Model Library
  101.     EDUTILSL.LIB      -- Large Memory Model Library
  102.     FILEVIEW.C        -- Example File Viewer program source code
  103.     FILEVIEW.PRJ      -- Example File Viewer Turbo C 3.0 Project File
  104.     FILEVIEW.EXE      -- Example File Viewer program executable
  105.     PANEL.C           -- Example Panel Editor program source code
  106.     PANEL.PRJ         -- Example Panel Editor Turbo C 3.0 Project File
  107.     PANEL.EXE         -- Example Panel Editor program executable
  108.  
  109. In order to use EDUTILS, simply copy the EDUTILS.H file into the directory
  110. where your Turbo C Include files are stored, and copy EDUTILSS.LIB,
  111. EDUTILSM.LIB, EDUTILSC.LIB, and EDUTILSL.LIB into the directory where your
  112. Turbo C Library files are stored.
  113.  
  114. For example, if your Include directory is C:\TC\INCLUDE, and your Library
  115. directory is C:\TC\LIB, then perform the following commands:
  116.  
  117.     copy EDUTILS.H C:\TC\INCLUDE
  118.     copy EDUTILS?.LIB C:\TC\LIB
  119.  
  120. -------------------------------------------------------------------------------
  121.  
  122. -------------------------------------------------------------------------------
  123. 3.  Choosing the Correct EDUTILS Library                                     3
  124.  
  125. One of the main considerations in using EDUTILS in your program is choosing
  126. the correct EDUTILS library to use when linking your program.  There are
  127. four libraries to choose from--one for each of four separate memory models:
  128. Small, Medium, Compact, and Large.
  129.  
  130. You must select the library which uses the same memory model as the one
  131. that your compiler is set to use.  For example, Turbo C uses the
  132. Small memory model by default.  Therefore, you would use the Small model
  133. EDUTILS library, EDUTILSS.LIB.
  134.  
  135. Use the following chart to determine which EDUTILS Library to use:
  136.  
  137.   Memory Model Map
  138.  
  139.  ┌──────────────┬───────────────────────┬──────────────┬──────────────────┐
  140.  │              │        SEGMENTS       │   POINTERS   │     EDUTILS      │
  141.  │ Memory Model │   Code  Data  Stack   │  Code  Data  │  Library to Use  │
  142.  ├──────────────┼───────────────────────┼──────────────┼──────────────────┤
  143.  │ SMALL        │  [64K] [----64K----]  │  Near  Near  │  EDUTILSS.LIB    │
  144.  │ MEDIUM       │  [1MB] [----64K----]  │  Far   Near  │  EDUTILSM.LIB    │
  145.  │ COMPACT      │  [64K] [----1MB----]  │  Near  Far   │  EDUTILSC.LIB    │
  146.  │ LARGE        │  [1MB] [----1MB----]  │  Far   Far   │  EDUTILSL.LIB    │
  147.  └──────────────┴───────────────────────┴──────────────┴──────────────────┘
  148.  
  149.  Figure 1-1  --  Determining which Memory Model and EDUTILS Library to use.
  150.  
  151.  Memory Model Descriptions
  152.  1.  SMALL Memory Model.
  153.      The Small Memory Model gives the program 64K bytes of Code space,
  154.      and 64K bytes of Data space.  If your program is relatively small
  155.      and the maximum number of lines you wish to Edit with EDUTILS is
  156.      200 lines or less, then use the SMALL Memory Model, and compile
  157.      with the EDUTILS Library "EDUTILSS.LIB".
  158.  
  159.  
  160.  2.  MEDIUM Memory Model.
  161.      The Medium Memory Model gives the program 1M bytes of Code space,
  162.      and 64K bytes of Data space.  If your program is relatively large
  163.      and the maximum number of lines you wish to Edit with EDUTILS is
  164.      200 lines or less, then use the MEDIUM Memory Model, and compile
  165.      with the EDUTILS Library "EDUTILSM.LIB".
  166.  
  167.  3.  COMPACT Memory Model.
  168.      The Compact Memory Model gives the program 64K bytes of Code space,
  169.      and 1M bytes of Data space.  If your program is relatively small
  170.      and the maximum number of lines you wish to Edit with EDUTILS is
  171.      2000 lines or less, then use the COMPACT Memory Model, and compile
  172.      with the EDUTILS Library "EDUTILSC.LIB".
  173.  
  174.  4.  LARGE Memory Model.
  175.      The Compact Memory Model gives the program 1M bytes of Code space,
  176.      and 1M bytes of Data space.  If your program is relatively large
  177.      and the maximum number of lines you wish to Edit with EDUTILS is
  178.      2000 lines or less, then use the LARGE Memory Model, and compile
  179.      with the EDUTILS Library "EDUTILSL.LIB".
  180.  
  181. If you link with a library and you have disastrous results, then
  182. double-check the memory model that your compiler is using and select
  183. a different EDUTILS library.
  184. -------------------------------------------------------------------------------
  185.  
  186. -------------------------------------------------------------------------------
  187. 4. Compiling and Linking your Programs                                       4
  188.  
  189. You can compile your programs either from within the TURBO C IDE
  190. (Interactive Development Environment) or from the command line.
  191.  
  192. Include the following line at the top of your program:
  193.     #include   <EDUTILS.H>
  194. This includes the function declarations and other definitions needed for
  195. EDUTILS to operate.
  196.  
  197. Within the Turbo C Development Environment, add the proper library
  198. to your Project.  To see what memory model your program is currently
  199. using, hit ALT-O (to enter the "Options" menu), and hit enter with the
  200. cursor on the "Application..." selection.  The Memory Model that your
  201. program is using is listed on the "Model" line.
  202.  
  203. From the command line use the following command to compile your
  204. program:
  205.     tcc -I<include dir> -L<library dir> program.c EDUTILSS.LIB
  206. where
  207.     <include dir>  -- The directory where the Include Files are stored
  208.     <library dir>  -- The directory where the Library Files are stored
  209.     program.c      -- The name of your program
  210.     EDUTILSS.LIB   -- The name of the EDUTILS library
  211.  
  212. To use the Large Memory Model with your program, use the following command:
  213.     tcc -ml -I<include dir> -L<library dir> program.c EDUTILSS.LIB
  214. where
  215.     -ml            -- Indicates that Large Memory Model should be used
  216.     <include dir>  -- The directory where the Include Files are stored
  217.     <library dir>  -- The directory where the Library Files are stored
  218.     program.c      -- The name of your program
  219.     EDUTILSL.LIB   -- The name of the EDUTILS library
  220.  
  221. You do not need to use the -I and -L parameters if you use the default
  222. Include and Library directories.
  223. -------------------------------------------------------------------------------
  224.  
  225. -------------------------------------------------------------------------------
  226. 5.  Using the EDUTILS Functions                                              5
  227.  
  228. The main EDUTILS functions are:
  229.  
  230.      a.  int  ed_display_string (char * str, int screen_len, int max_len);
  231.      b.  int  ed_display_string_xy (int x, int y, char * str, int screen_len,
  232.                                     int max_len);
  233.      c.  int  ed_edit_file_field (ED_PARMS * inparms, char * filename);
  234.      d.  int  ed_edit_string (char * str, int screen_len, int max_len);
  235.      e.  int  ed_edit_string_xy (int x, int y, char * str, int screen_len,
  236.                                  int max_len);
  237.      f.  int  ed_edit_text_field (ED_PARMS * inparms, void * store_lines,
  238.                                   int max_lines, int max_chars);
  239.      g.  int  ed_editor (ED_PARMS * inparms, char * filename,
  240.                          void * store_lines, int max_lines, int max_chars);
  241.      h.  void ed_set_default_parameters (ED_PARMS * inparms);
  242.  
  243. A description of the features of each function is described below.
  244.  
  245.  
  246.     Using the EDUTILS Functions (continued)                                  6
  247.  
  248.  
  249.   a.  ed_display_string ();      Display a string edit window and return
  250.  
  251.       Syntax:
  252.           int  ed_display_string (char * str, int screen_len, int max_len);
  253.  
  254.       This function will display a string edit window at the current cursor
  255.       position using the current foreground & background colors.  The
  256.       arguments should be exactly the same as those passed later to
  257.       ed_edit_string when string editing is performed.  This function
  258.       is meant to be called when there are several fields to be edited
  259.       at once and you wish them to appear on the screen before the user
  260.       is allowed to edit them.
  261.  
  262.       Variables:
  263.           str        -- Pointer to character string to be displayed
  264.           screen_len -- Number of characters that can appear in the
  265.                         edit window at one time.  If you do not wish any
  266.                         horizontal scrolling to take place, this value
  267.                         should be 1 larger than max_len.
  268.           max_len    -- Maximum number of characters that can be
  269.                         entered in the string.
  270.  
  271.  
  272.  
  273.     Using the EDUTILS Functions (continued)                                  7
  274.  
  275.  
  276.   b.  ed_display_string_xy ();      Display a string edit window and return
  277.  
  278.       Syntax:
  279.           int  ed_display_string_xy (int x, int y, char * str,
  280.                                      int screen_len, int max_len);
  281.  
  282.       This function will display a string edit window at the specified cursor
  283.       position using the current foreground & background colors.  The
  284.       arguments should be exactly the same as those passed later to
  285.       ed_edit_string when string editing is performed.  This function
  286.       is meant to be called when there are several fields to be edited
  287.       at once and you wish them to appear on the screen before the user
  288.       is allowed to edit them.
  289.  
  290.       Variables:
  291.           x          -- Horizontal cursor position.  Range is from 1 to 80.
  292.           y          -- Vertical cursor position.  Range is from 1 to 25.
  293.           str        -- Pointer to character string to be displayed
  294.           screen_len -- Number of characters that can appear in the
  295.                         edit window at one time.  If you do not wish any
  296.                         horizontal scrolling to take place, this value
  297.                         should be 1 larger than max_len.
  298.           max_len    -- Maximum number of characters that can be
  299.                         entered in the string.
  300.  
  301.  
  302.  
  303.     Using the EDUTILS Functions (continued)                                  8
  304.  
  305.  
  306.   c.  ed_edit_file_field ();     Edit a File
  307.  
  308.       Syntax:
  309.           int  ed_edit_file_field (ED_PARMS * inparms, char * filename);
  310.  
  311.       This function will display an Edit Window and will allow the user
  312.       to edit the contents of the file specified.  The functionality
  313.       of this function is completely modifiable, by altering the passed
  314.       parameters.  For example, the parameters can be set up to
  315.       automatically fill the edit buffer with the contents of the file,
  316.       and to automatically save the edit buffer into the file when editing
  317.       is complete.  Or, the parameters can be set so that editing of the
  318.       file is not allowed--thus producing a file VIEWER.  For more
  319.       information about the editing parameters, refer to Section 6,
  320.       Changing Editor Parameters.
  321.  
  322.       Variables:
  323.           inparms  -- Parameters to use during editing.  For a complete
  324.                       description of the ED_PARMS parameters structure,
  325.                       refer to Section 6, Changing Editor Parameters.
  326.           filename -- The name of the file to use when loading or saving.
  327.                       This should be the complete pathname referring to
  328.                       the file.
  329.  
  330.  
  331.  
  332.     Using the EDUTILS Functions (continued)                                  9
  333.  
  334.  
  335.   d.  ed_edit_string ();      Activate a string edit window
  336.  
  337.       Syntax:
  338.           int  ed_edit_string (char * str, int screen_len, int max_len);
  339.  
  340.       This function will invoke a string edit window at the current cursor
  341.       position using the current foreground & background colors.  The
  342.       user will be allowed to view and modify the contents of the passed
  343.       string.  Control will return back to the program when the user
  344.       presses a key corresponding to the function FN_QUIT, such as the
  345.       ESC Key or the ENTER Key.
  346.  
  347.       Variables:
  348.           str        -- Pointer to character string to be displayed & edited
  349.           screen_len -- Number of characters that can appear in the
  350.                         edit window at one time.  If you do not wish any
  351.                         horizontal scrolling to take place, this value
  352.                         should be 1 larger than max_len.
  353.           max_len    -- Maximum number of characters that can be
  354.                         entered in the string.
  355.  
  356.  
  357.  
  358.     Using the EDUTILS Functions (continued)                                 10
  359.  
  360.  
  361.   e.  ed_edit_string_xy ();      Activate a string edit window
  362.  
  363.       Syntax:
  364.           int  ed_edit_string_xy (int x, int y, char * str,
  365.                                   int screen_len, int max_len);
  366.  
  367.       This function will invoke a string edit window at the specified cursor
  368.       position using the current foreground & background colors.  The
  369.       user will be allowed to view and modify the contents of the passed
  370.       string.  Control will return back to the program when the user
  371.       presses a key corresponding to the function FN_QUIT, such as the
  372.       ESC Key or the ENTER Key.
  373.  
  374.       Variables:
  375.           x          -- Horizontal cursor position.  Range is from 1 to 80.
  376.           y          -- Vertical cursor position.  Range is from 1 to 25.
  377.           str        -- Pointer to character string to be displayed & edited
  378.           screen_len -- Number of characters that can appear in the
  379.                         edit window at one time.  If you do not wish any
  380.                         horizontal scrolling to take place, this value
  381.                         should be 1 larger than max_len.
  382.           max_len    -- Maximum number of characters that can be
  383.                         entered in the string.
  384.  
  385.  
  386.     Using the EDUTILS Functions (continued)                                 11
  387.  
  388.  
  389.   f.  ed_edit_text_field ();     Edit an array of text string variables
  390.  
  391.       Syntax:
  392.           int  ed_edit_text_field (ED_PARMS * inparms, void * store_lines,
  393.                                    int max_lines, int max_chars);
  394.  
  395.       This function will display an Edit Window and will allow the user to
  396.       edit the contents of the string variable specified.  The functionality
  397.       of this function is completely modifiable, by altering the passed
  398.       parameters.  For example, the parameters can be set up to
  399.       automatically fill the edit buffer with the contents of the string,
  400.       and to automatically save the edit buffer into the string when editing
  401.       is complete.  Or, the parameters can be set so that editing of the
  402.       string is not allowed--thus producing a VIEWER.  For more
  403.       information about the editing parameters, refer to Section 6,
  404.       Changing Editor Parameters.
  405.  
  406.       Variables:
  407.           inparms     -- Parameters to use during editing.  For a complete
  408.                          description of the ED_PARMS parameters structure,
  409.                          refer to Section 6, Changing Editor Parameters.
  410.           store_lines -- A pointer to the two dimensional array which holds
  411.                          the strings to be edited.  The declaration of this
  412.                          variable in the calling program should be as
  413.                          follows (for example):
  414.                                  char store_lines [200][80];
  415.                          where 200 is the maximum number of lines to
  416.                          be allowed in the edit buffer, and 80 is the
  417.                          maximum number of characters per line.
  418.           max_lines   -- Refers to the maximum number of lines to allow
  419.                          in the edit buffer.  In the above example, this
  420.                          would be 200.  Note that this should EXACTLY
  421.                          match the first dimension of the declared variable,
  422.                          otherwise the results are unpredictable.
  423.           max_chars   -- Refers to the maximum number of characters per
  424.                          line to allow in the edit buffer.  In the above
  425.                          example, this would be 80.  Not that this should
  426.                          EXACTLY match the second dimension of the declared
  427.                          variable, otherwise the results are unpredictable.
  428.  
  429.  
  430.     Using the EDUTILS Functions (continued)                                 12
  431.  
  432.  
  433.   g.  ed_editor ();     Edit an array of text string variables or a file
  434.  
  435.       Syntax:
  436.           int  ed_editor (ED_PARMS * inparms, char * filename,
  437.                           void * store_lines, int max_lines, int max_chars);
  438.  
  439.       This function is simply a combination of the ed_edit_file_field and
  440.       ed_edit_text_field functions.  When called, it will display an Edit
  441.       Window and will allow the user to edit the contents of the file or
  442.       string variable specified.  The functionality of this function is
  443.       completely modifiable, by altering the passed parameters.
  444.       For example, the parameters can be set up to automatically fill
  445.       the edit buffer with the contents of either the string or the file,
  446.       and to automatically save the edit buffer into the string, the file,
  447.       or both when editing is complete.
  448.       Or, the parameters can be set so that editing of the
  449.       string is not allowed--thus producing a VIEWER.  For more
  450.       information about the editing parameters, refer to Section 6,
  451.       Changing Editor Parameters.
  452.  
  453.       Variables:
  454.           inparms     -- Parameters to use during editing.  For a complete
  455.                          description of the ED_PARMS parameters structure,
  456.                          refer to Section 6, Changing Editor Parameters.
  457.           filename    -- The name of the file to use when loading or saving.
  458.                          This should be the complete pathname referring to
  459.                          the file.
  460.           store_lines -- A pointer to the two dimensional array which holds
  461.                          the strings to be edited.  The declaration of this
  462.                          variable in the calling program should be as
  463.                          follows (for example):
  464.                                  char store_lines [200][80];
  465.                          where 200 is the maximum number of lines to
  466.                          be allowed in the edit buffer, and 80 is the
  467.                          maximum number of characters per line.
  468.           max_lines   -- Refers to the maximum number of lines to allow
  469.                          in the edit buffer.  In the above example, this
  470.                          would be 200.  Note that this should EXACTLY
  471.                          match the first dimension of the declared variable,
  472.                          otherwise the results are unpredictable.
  473.           max_chars   -- Refers to the maximum number of characters per
  474.                          line to allow in the edit buffer.  In the above
  475.                          example, this would be 80.  Not that this should
  476.                          EXACTLY match the second dimension of the declared
  477.                          variable, otherwise the results are unpredictable.
  478.  
  479.  
  480.     Using the EDUTILS Functions (continued)                                 13
  481.  
  482.  
  483.   h.  ed_set_default_parameters ();      Store default parameters in structure
  484.  
  485.       Syntax:
  486.           void ed_set_default_parameters (ED_PARMS * inparms);
  487.  
  488.       This function resets all of the parameters contained in the ED_PARMS
  489.       Editor Parameters structure to their default values.  This function
  490.       should be called to initialize every parameter structure that is
  491.       defined before it is first used.  To see the default values which
  492.       are stored in the structure, refer to Appendix A, "A listing of
  493.       the ed_set_default_parameters function"
  494.  
  495.       Variables:
  496.           inparms -- Pointer to the parameter structure in which to
  497.                      store the default parameter values.  For a complete
  498.                      description of the ED_PARMS parameters structure,
  499.                      refer to Section 6, "Changing Editor Parameters".
  500.  
  501.  
  502. -------------------------------------------------------------------------------
  503.  
  504. -------------------------------------------------------------------------------
  505. 6.  Changing Editor Parameters                                              14
  506.  
  507. The following is the definition of the ED_PARMS parameter stucture.
  508. A more detailed description of each parameter follows.
  509.  
  510.     typedef struct
  511.     {
  512.         int    max_num_lines;           /*  Max Num lines for this buffer  */
  513.         int    min_num_lines;           /*  Min Num lines for this buffer  */
  514.         int    max_line_length;         /*  Max Length of each line in the buffer  */
  515.         int    screen_top;              /*  Topmost row of editing window */
  516.         int    screen_bottom;           /*  Bottommost row of editing window */
  517.         int    screen_left;             /*  Leftmost column of editing window */
  518.         int    screen_right;            /*  Rightmost column of editing window */
  519.         int    editing_background;      /*  Editing Window Background Color  */
  520.         int    editing_foreground;      /*  Editing Window Foreground Color  */
  521.         int    highlight_background;    /*  Background Color for highlighted text  */
  522.         int    highlight_foreground;    /*  Foreground Color for highlighted text  */
  523.         int    overtype_cursor;         /*  CURSOR_LINE or CURSOR_BLOCK  */
  524.         int    insert_cursor;           /*  CURSOR_LINE or CURSOR_BLOCK  */
  525.         int    wrap_line;               /*  TRUE-words wrap to next line  */
  526.         int    remove_ending_spaces;    /*  TRUE-Spaces removed from ends of lines  */
  527.         int    remove_ending_chars;     /*  TRUE-Chars removed at end if others inserted before it  */
  528.  
  529.         int    status_allowed;          /*  TRUE-Status will be displayed  */
  530.         int    status_x;                /* X position of status on screen */
  531.         int    status_y;                /* Y position of status on screen */
  532.         int    status_type;             /*  STATUS_ALL, STATUS_COL, STATUS_LINE, or STATUS_NONE  */
  533.  
  534.         int    message_allowed;         /*  TRUE-Message will be displayed in position  */
  535.         int    message_x;               /*  X position of message on screen  */
  536.         int    message_y;               /*  Y position of message on screen  */
  537.         int    message_max_len;         /*  Maximum length of message to be displayed  */
  538.  
  539.         int    error_on_borders;        /*  TRUE-Displays error msgs at top and bottom of files */
  540.         int    load_automatically;      /*  LOAD_NONE, LOAD_ARRAY, LOAD_FILE, LOAD_BOTH */
  541.         int    save_automatically;      /*  SAVE_NONE, SAVE_ARRAY, SAVE_FILE, SAVE_BOTH */
  542.         int    restore_window;          /*  TRUE-Edit window will be replaced with previous contents on exit  */
  543.  
  544.         int    vertical_scrolling;      /*  TRUE-Page Up & Down will be active  */
  545.         int    editing_allowed;         /*  TRUE-user will be allowed to modify buffer */
  546.         int    exit_after_display;      /*  TRUE-Function will exit after display */
  547.         char   default_filename [50];   /*  Default File to load if no file specified  */
  548.         char   char_types [256];        /*  Regular Character Types  */
  549.         char   esc_char_types [256];    /*  Escape Character Types   */
  550.     } ED_PARMS;
  551.  
  552.  
  553.     Changing Editor Parameters (continued)                                  15
  554.  
  555.  
  556. Detailed Parameter Descriptions
  557. -------------------------------
  558.  
  559.   1.  int    max_num_lines;           /*  Max Num lines for  his buffer  */
  560.  
  561.       Indicates that maximum number of lines that can be allowed in the
  562.       Edit Buffer.  Change this value to keep a user from entering more
  563.       lines in the buffer than you wish them to (especially for editing
  564.       character string variables).  The absolute maximum value for Small and
  565.       Medium model programs is 200 lines, whereas the absolute maximum value
  566.       for Compact and Large model programs is 2000 lines.
  567.  
  568.  
  569.   2.  int    min_num_lines;           /*  Min Num lines for this buffer  */
  570.  
  571.       This parameter is for future use and should be left alone.
  572.  
  573.  
  574.   3.  int    max_line_length;         /*  Max Length of each line in the buffer  */
  575.  
  576.       Indicates the maximum number of characters that can be allowed in a
  577.       single line.  Change this value to keep a user from entering more
  578.       characters in a line than you wish them to.  The absolute maximum
  579.       value for this parameter is 256.
  580.  
  581.  
  582.   4.  int    screen_top;              /*  Topmost row of editing window */
  583.       int    screen_bottom;           /*  Bottommost row of editing window */
  584.       int    screen_left;             /*  Leftmost column of editing window */
  585.       int    screen_right;            /*  Rightmost column of editing window */
  586.  
  587.       These four parameters dictate the edit window size and position.
  588.       The valid range for screen_top and screen_bottom is between 1 and 25.
  589.       The valid range for screen_left and screen_right is between 1 and 80.
  590.  
  591.  
  592.   5.  int    editing_background;      /*  Editing Window Background Color  */
  593.       int    editing_foreground;      /*  Editing Window Foreground Color  */
  594.  
  595.       These two parameters indicate the Foreground and Background colors to
  596.       use for the editing window.  The values allowed here are between
  597.       0 (for BLACK) and 15 (for WHITE).  The values correspond directly
  598.       to the Turbo C Color Constants (BLACK, BLUE, GREEN, CYAN, etc) defined
  599.       in <CONIO.H>.
  600.  
  601.  
  602.     Changing Editor Parameters (continued)                                  16
  603.  
  604.  
  605.   6.  int    highlight_background;  /* Background Color for highlighted text */
  606.       int    highlight_foreground;  /* Foreground Color for highlighted text */
  607.  
  608.       These two parameters are for future use and should be left alone.
  609.  
  610.  
  611.   7.  int    overtype_cursor;         /*  CURSOR_LINE or CURSOR_BLOCK  */
  612.       int    insert_cursor;           /*  CURSOR_LINE or CURSOR_BLOCK  */
  613.  
  614.       These two parameters describe the look that the cursor should have in
  615.       each of two edit modes.  The values which can be used are CURSOR_LINE
  616.       or CURSOR_BLOCK.
  617.  
  618.  
  619.   8.  int    wrap_line;               /*  TRUE-words wrap to next line  */
  620.  
  621.       This parameter is for future use and should be left alone.
  622.  
  623.  
  624.   9.  int    remove_ending_spaces;  /* TRUE-Spaces removed from end of lines */
  625.  
  626.       This parameter indicates whether spaces should be removed from the
  627.       ends of each line after editing.  The valid values for this parameter
  628.       are either TRUE or FALSE.
  629.  
  630.  
  631.   10. int    remove_ending_chars;     /*  TRUE-Chars removed at end if others inserted before it  */
  632.  
  633.       This parameter only has effect during editing while in INSERT mode.
  634.       With remove_ending_chars set to FALSE, and in INSERT mode
  635.       a character is typed and there are already the maximum number of
  636.       characters possible in the current line, then an error will occur and
  637.       the character pressed will not be inserted (You can not have any more
  638.       than parms.max_line_length chars in a line at one time).
  639.       With remove_ending_chars set to TRUE, and in INSERT mode a character
  640.       is typed with the line already filled with characters, the characters
  641.       at the end of the line will be eliminated to make room for the
  642.       new characters being inserted.
  643.  
  644.  
  645.   11. int    status_allowed;     /* TRUE-Status will be displayed  */
  646.       int    status_x;           /* X position of status on screen */
  647.       int    status_y;           /* Y position of status on screen */
  648.       int    status_type;        /* STATUS_ALL, STATUS_COL, STATUS_LINE, or STATUS_NONE  */
  649.  
  650.       The status_allowed parameter indicates whether or not the current
  651.       Column or Line numbers will be displayed on the screen.  Set this
  652.       parameter to TRUE if you which them to be displayed, otherwise FALSE.
  653.       The parameters status_x and status_y indicate the x & y positions of
  654.       the current line & column status display on the screen.
  655.       The status_type parameter can be set to STATUS_ALL, STATUS_COL,
  656.       STATUS_LINE, or STATUS_NONE to indicate what numbers you would like
  657.       displayed.  For example with status_allowed set to TRUE and status_type
  658.       set to STATUS_ALL, both the current line and the current column
  659.       will be displayed.
  660.  
  661.     Changing Editor Parameters (continued)                                  17
  662.  
  663.  
  664.   12. int    message_allowed;    /* TRUE-Message will be displayed on screen */
  665.       int    message_x;          /* X position of message on screen  */
  666.       int    message_y;          /* Y position of message on screen  */
  667.       int    message_max_len;    /* Maximum length of message to be displayed */
  668.  
  669.       The message_allowed parameter indicates whether or not the editor's
  670.       messages will be displayed on the screen.  Set this parameter to TRUE
  671.       if you which them to be displayed, otherwise FALSE.
  672.       The parameters message_x and message_y indicate the x & y positions of
  673.       the message to be displayed on the screen.
  674.       The message_max_len parameter indicates the maximum length of a message
  675.       to be displayed on the screen.  For example, you wish the displayed
  676.       messages to start in column 45, you would want to set message_max_len
  677.       to 35 so messages do not go past the end of the screen.
  678.  
  679.  
  680.   13. int    error_on_borders;        /*  TRUE-Displays error msgs at top and bottom of files */
  681.  
  682.       This parameter determines whether an error message will be produced
  683.       and displayed on the screen when the user tries to move the cursor
  684.       past the top of the file, end of the file, or past the maximum number
  685.       of characters allowed in the line.  Can be set to either TRUE or FALSE.
  686.  
  687.  
  688.   14. int    load_automatically;      /*  LOAD_NONE, LOAD_ARRAY, LOAD_FILE, LOAD_BOTH */
  689.       int    save_automatically;      /*  SAVE_NONE, SAVE_ARRAY, SAVE_FILE, SAVE_BOTH */
  690.  
  691.       These two parameters determine the initial load and final save states
  692.       of the edit buffer.  The values for load_automatically are:  LOAD_NONE,
  693.       LOAD_ARRAY, LOAD_FILE, or LOAD_BOTH.  When set to LOAD_NONE, the
  694.       edit_buffer is not loaded with anything.  When set to LOAD_ARRAY,
  695.       the edit buffer is filled with the contents of the passed character
  696.       array.  When set to LOAD_FILE, the edit buffer is filled with the
  697.       contents of the specified file.  When set to LOAD_BOTH, an attempt
  698.       is made to first load the edit buffer with the specified file, and
  699.       if an error occurs, load the contents of the passed array.
  700.  
  701.       The values for save_automatically are:  SAVE_NONE, SAVE_ARRAY,
  702.       SAVE_FILE, and SAVE_BOTH.  When set to SAVE_NONE, the edit buffer is
  703.       not automatically saved.  When set to SAVE_ARRAY, the contents
  704.       of the edit buffer are automatically saved in the passed array.
  705.       When set to SAVE_FILE, the contents of the edit buffer are automatically
  706.       saved in the specified file.  When set to SAVE_BOTH, the contents
  707.       of the edit buffer are automatically saved in both the passed array
  708.       and the specified file.
  709.  
  710.     Changing Editor Parameters (continued)                                  18
  711.  
  712.  
  713.   15. int    restore_window;          /*  TRUE-Edit window will be restored */
  714.  
  715.       When set to TRUE, this parameter indicates that the contents of the
  716.       screen that were there before the edit buffer was first displayed
  717.       will be restored.  When set to FALSE, the edit buffer will remain
  718.       on the screen on exit.
  719.  
  720.  
  721.   16. int    vertical_scrolling;      /*  TRUE-Page Up & Down will be active */
  722.  
  723.       When set to TRUE, Page UP and Page DOWN keys will be active.  When
  724.       set to FALSE, the Page UP and Page DOWN keys will not function
  725.       during editing.
  726.  
  727.  
  728.   17. int    editing_allowed;         /*  TRUE-user allowed to modify buffer */
  729.  
  730.       When set to FALSE, this parameter indicates that the editing window
  731.       should function as a Viewer only.  That is, the user will not be
  732.       allowed to modify any of the data that appears in the buffer.
  733.       When set to TRUE, editing operations will work as normal.
  734.  
  735.  
  736.   18. int    exit_after_display;      /*  TRUE-Function will exit after display */
  737.  
  738.       When set to FALSE, control will remain in the EDUTILS function until
  739.       the user pressed some key to cause it to exit.  When set to TRUE,
  740.       EDUTILS will display the Edit Window as required, but will then
  741.       immediately exit and control will be passed to the calling program.
  742.       The major purpose of this parameter is for Panel Editing Windows,
  743.       where the program should display all of the fields in the Panel
  744.       before the first field should be edited.
  745.  
  746.  
  747.   19. char   default_filename [50];   /*  Default File to load */
  748.  
  749.       This parameter specifies the name of the file to use as a default
  750.       file if there was not a file specified.
  751.  
  752.  
  753.   20. char   char_types [256];        /*  Regular Character Types  */
  754.       char   esc_char_types [256];    /*  Escape Character Types   */
  755.  
  756.       These two parameters are for future use and should be left alone.
  757.  
  758. -------------------------------------------------------------------------------
  759.  
  760. -------------------------------------------------------------------------------
  761. 7.  What happened?  Examining Result Codes                                  19
  762.  
  763. The following is a listing of the ED_RESULTS result code structure.
  764. It can be accessed by the variable ed_results at any time through
  765. your program.  It is declared externally from within the EDUTILS.H
  766. include file.
  767.  
  768.     typedef struct
  769.     {
  770.         int   num_lines;
  771.         int   cur_line;
  772.         int   line_offset;
  773.         int   num_bytes;
  774.         int   mode;
  775.         int   x;
  776.         int   y;
  777.         int   offset;
  778.         int   pos;
  779.         char  filename [100];    // The name of the file which was edited
  780.         int   rc;                // Return Code. TRUE-Success, FALSE-Failure
  781.         char  last_char;
  782.         char  last_char_extended;
  783.         char  last_function;
  784.         char  term_reason [100];
  785.         char  last_message [81];
  786.     } ED_RESULTS;
  787.  
  788.     Examining Result Codes (continued)                                      20
  789.  
  790.  
  791. The following is a brief explanation of the fields in the structure.
  792.  
  793.   a.  num_lines
  794.       An integer which gives the total number of lines in the edit
  795.       buffer during the last edit session.
  796.  
  797.   b.  cur_line
  798.       An integer containing the number of the line which the cursor
  799.       was on when the edit session terminated.  Since the lines are
  800.       numbered starting with 1, the first line would be represented by 1.
  801.  
  802.   c.  line_offset
  803.       An integer representing the number of lines which have scrolled
  804.       off of the top of the screen.  During normal edit sessions,
  805.       when no vertical scrolling has taken place, this variable should
  806.       contain 0.
  807.  
  808.   d.  num_bytes
  809.       An integer containing the number of characters in the edit buffer
  810.       (not including carriage returns) upon termination of the edit session.
  811.  
  812.   e.  mode
  813.       An integer representing the insert/overstrike state when the
  814.       edit session terminated.  The possible values for mode are defined
  815.       in EDUTILS.H and are:  MODE_INSERT and MODE_OVERTYPE
  816.  
  817.   f.  x
  818.       The horizontal position of the cursor on the screen when the
  819.       edit session ended.  The range will be between 1 and 80.
  820.  
  821.   g.  y
  822.       The vertical position of the cursor on the screen when the
  823.       edit session ended.  The range will be between 1 and 25.
  824.  
  825.   h.  offset
  826.       An integer representing the number of character columns that
  827.       were scrolled off of the left-hand side of the edit window.
  828.       During a normal edit session where no horizontal scrolling
  829.       occurs, this value will always be 0.
  830.  
  831.   i.  pos
  832.       An integer representing the current position of the cursor from
  833.       within the current line.  Each character is number starting from 0.
  834.       Therefore, if the edit session was terminated with the cursor
  835.       positioned on the 3rd character of the line, then pos should be 2.
  836.  
  837.   j.  filename
  838.       A character string which holds the path and filename of the file
  839.       which was last passed to the edit function.
  840.  
  841.   k.  rc
  842.       An integer field referring to the return code returned by the function.
  843.       In all honesty, I don't know whether or not the value returned
  844.       in this variable can be trusted.
  845.  
  846.     Examining Result Codes (continued)                                      21
  847.  
  848.  
  849.   l.  last_char
  850.       A character variable which refers to the last character pressed
  851.       by the user.  This variable is useful for knowing what the user
  852.       wishes to do next.  The value returned in this variable is exactly
  853.       equal to the ASCII code returned by the Turbo C "getch()" function.
  854.       If an extended character was entered, last_char will be set to 0,
  855.       and last_char_extended will be set to the extended key code.
  856.  
  857.   m.  last_char_extended
  858.       A character variable which normally contains 0 unless an
  859.       extended character is entered.
  860.  
  861.   n.  last_function
  862.       An integer variable referring to the Function represented by the
  863.       last key hit by the user.  The possible values which can be returned
  864.       are listed in the include file EDUTILS.H and start with "FN_".
  865.       For example, if the ESC key is pressed, the last_function variable
  866.       will be set to FN_QUIT.  Or, if the F3 key is pressed during editing,
  867.       which saves the file and exits the edit session, then FN_SAVE_AND_QUIT
  868.       will be returned in last_function.  Note that the functions assigned
  869.       to each key can be modified.  For default key assignments, refer
  870.       to Appendix A, "A listing of the ed_set_default_parameters function".
  871.  
  872.   o.  term_reason
  873.       A character string variable which indicates the reason for the
  874.       termination of the edit session.  This variable is not currently
  875.       in use.
  876.  
  877.   p.  last_message
  878.       A character string variable which contains the last message which
  879.       was written to the screen.  An example would be "No more than 80
  880.       characters can be in a line!".  Note that the message window can
  881.       be shut off so no messages will be written to the screen, but the
  882.       messages will still be stored in this variable.
  883.  
  884.  
  885. -------------------------------------------------------------------------------
  886.  
  887. -------------------------------------------------------------------------------
  888. APPENDIX A.  A listing of the ed_set_default_parameters function            22
  889.  
  890. The following is the listing for the ed_set_default_parameters function.
  891. For the actual values of constants referred to below, look in the
  892. include file EDUTILS.H.
  893.  
  894. (c) Copyright 1994  Kenneth J. Macke
  895.  
  896.  /********************************************************************/
  897.   void ed_set_default_parameters (ED_PARMS * inparms)
  898.   {
  899.       int   I;
  900.  
  901.       inparms->max_num_lines = 500;   //  MAX_NUM_LINES;
  902.       inparms->min_num_lines = 1;
  903.       inparms->max_line_length = 100;   //  MAX_LINE_LENGTH;
  904.       inparms->screen_top = 10;
  905.       inparms->screen_bottom = 20;
  906.       inparms->screen_left = 10;
  907.       inparms->screen_right = 70;
  908.       inparms->wrap_line = FALSE;
  909.       inparms->remove_ending_spaces = TRUE;
  910.       inparms->remove_ending_chars = FALSE;
  911.  
  912.       inparms->overtype_cursor = CURSOR_LINE;
  913.       inparms->insert_cursor = CURSOR_BLOCK;
  914.       inparms->editing_background = BLUE;
  915.       inparms->editing_foreground = YELLOW;
  916.       inparms->highlight_background = RED;
  917.       inparms->highlight_foreground = WHITE;
  918.  
  919.       inparms->status_allowed = TRUE;
  920.       inparms->status_x    = 60;
  921.       inparms->status_y    = 24;
  922.       inparms->status_type = STATUS_ALL;
  923.  
  924.       inparms->message_allowed = TRUE;
  925.       inparms->message_x = 1;
  926.       inparms->message_y = 24;
  927.       inparms->message_max_len = 60;
  928.  
  929.       inparms->error_on_borders = TRUE;
  930.       inparms->load_automatically = LOAD_FILE;
  931.       inparms->save_automatically = SAVE_NONE;
  932.       inparms->restore_window = TRUE;
  933.  
  934.     ed_set_default_parameters function (continued)                          23
  935.  
  936.  
  937.       inparms->vertical_scrolling = TRUE;
  938.       inparms->editing_allowed = TRUE;
  939.       inparms->exit_after_display = FALSE;
  940.       strcpy (inparms->default_filename, "readme");
  941.  
  942.  
  943.       for (I = 0;  I < 256;  I++) {             /*  Default all chars  */
  944.           inparms->char_types [I] = 0;             /*  to invalid.        */
  945.           inparms->esc_char_types [I] = FN_INVALID;
  946.       }
  947.  
  948.       for (I = SMALLEST;  I <= LARGEST;  I++)   /*  Printables  */
  949.           inparms->char_types [I] = FN_REGULAR;
  950.  
  951.       inparms->char_types [ESC] = FN_QUIT;
  952.       inparms->char_types [BACKSPACE] = FN_BACKSPACE;
  953.       inparms->char_types [ENTER_KEY] = FN_NEW_LINE_AFTER;
  954.       inparms->char_types [25] = FN_DELETE_LINE;
  955.  
  956.       inparms->esc_char_types [LEFT] = FN_LEFT;
  957.       inparms->esc_char_types [RIGHT] = FN_RIGHT;
  958.       inparms->esc_char_types [UP] = FN_UP;
  959.       inparms->esc_char_types [DOWN] = FN_DOWN;
  960.  
  961.       inparms->esc_char_types [PAGE_UP] = FN_PAGE_UP;
  962.       inparms->esc_char_types [PAGE_DOWN] = FN_PAGE_DOWN;
  963.  
  964.       inparms->esc_char_types [HOME] = FN_START_OF_LINE;
  965.       inparms->esc_char_types [END_KEY] = FN_END_OF_LINE;
  966.       inparms->esc_char_types [DELETE] = FN_DELETE_CHAR;
  967.       inparms->esc_char_types [INSERT_KEY] = FN_INSERT_MODE;
  968.  
  969.       inparms->esc_char_types [F2] = FN_SAVE_FILE;
  970.       inparms->esc_char_types [F3] = FN_SAVE_AND_QUIT;
  971.       inparms->esc_char_types [F4] = FN_QUIT;
  972.       inparms->esc_char_types [F5] = FN_NEW_LINE_BEFORE;
  973.  
  974.       inparms->esc_char_types [ALT_L] = FN_MARK_LINES;
  975.  
  976.   }   /*  ed_set_default_parameters  */
  977.  /********************************************************************/
  978.  
  979. -------------------------------------------------------------------------------
  980.  
  981. -------------------------------------------------------------------------------
  982. APPENDIX B.  Examples                                                       24
  983.  
  984. There are two examples included with EDUTILS.  Both of which can and should
  985. be modified and used by registered users royalty free.
  986.  
  987. EXAMPLE 1:  FILEVIEW
  988.  
  989.     FileView is a README.COM-style file viewer which defaults to reading
  990.     a file called 'README.DOC', but will read whatever file is passed
  991.     to it on the command line.
  992.  
  993. EXAMPLE 2:  PANEL
  994.  
  995.     Panel is a simple Panel Field editor which prompts the user for
  996.     their Name, Address, City, State, and Zip Code.  When all of the
  997.     fields have been entered, the program terminates and all of the
  998.     information is printed.
  999.  
  1000. Both of the above examples are simple in their functionality, but are
  1001. meant to demonstrate the possible uses for the EDUTILS functions.
  1002. If you can think of other examples which might better demonstrate
  1003. the features of EDUTILS, or if you can think of ideas for improving
  1004. the existing examples, please feel free to write me through either
  1005. electronic mail or snail-mail.
  1006.  
  1007. -------------------------------------------------------------------------------
  1008.  
  1009. -------------------------------------------------------------------------------
  1010. APPENDIX C.  Usage Notes                                                    25
  1011.  
  1012. I.  One important thing to remember about EDUTILS is that it expects the
  1013.     current text window to be defined as:
  1014.           window (1,1, 80,25);
  1015.     All edit windows defined in your programs and utilized with the EDUTILS
  1016.     functions will use this full screen window as a reference point.
  1017.     If you define the text window to be something other than full screen
  1018.     before you call an EDUTILS function, you will find that it has been
  1019.     reset to full screen once the function has terminated.
  1020.  
  1021. II. Remember that the editing functions that are associated with keys
  1022.     can be assigned to different keys.  To do this you must make the
  1023.     proper change to the "char_types" and "esc_char_types" variables
  1024.     within the ED_PARMS parameters structure.  Refer to Appendix A,
  1025.     "A listing of the ed_set_default_parameters function" to see how
  1026.     the default key functions are assigned.
  1027.  
  1028.     Since this is more of an advanced feature and is not explained very
  1029.     well in this documentation, I will be happy to answer any questions
  1030.     you may have via electronic mail.
  1031. -------------------------------------------------------------------------------
  1032.  
  1033.  
  1034. Thank you for trying EDUTILS.  A lot of blood, sweat, and tears have
  1035. gone into this project (especially the documentation).  Since this is
  1036. the first release of this product, I more than expect there to be some
  1037. questions, complaints, and suggestions from the public at large.
  1038.  
  1039. If have anything you wish to tell me about EDUTILS, no matter how
  1040. small or insignificant, PLEASE WRITE!  Your suggestions may influence
  1041. a future version!
  1042.  
  1043.  
  1044.  
  1045. Kenneth J. Macke
  1046. P.O. Box 11313
  1047. Cincinnati, OH  45211
  1048.  
  1049. Compuserve address:   73020,2265
  1050. Internet address:     73020,2265@CompuServe.COM
  1051.  
  1052.