Customizing Documenting Wizard Output

In addition to the options that you choose when running the Documenting wizard, you can employ additional options outside the wizard by changing the Fdkeywrd.dbf table, which contains all the Visual FoxPro reserved words, in the ..\Wizards folder or by adding Documenting wizard directives to your code.

Changing the Fdkeywrd.dbf

You can change the style of indent of the CASE structure by changing the code field value in Fdkeywrd.dbf. By default, the wizard looks for indentation in a CASE structure like this:

DO CASE
CASE case1=1
   case2=2
CASE case3=3
   case4=4
ENDCASE

Some developers prefer to indent the lines between DO CASE and ENDCASE an additional level like this:

DO CASE
   CASE case1=1
      case2=2
   CASE case3=3
      case4=4
ENDCASE

If you indent your CASE structures, as in the second example, specify this in Fdkeywrd.dbf.

To specify wholly nested indents in DO CASE statements

  1. Locate the Fdkeywrd.dbf file in the ..\Wizards folder of the Visual FoxPro root directory.
  2. Open the Fdkeywrd.dbf table.
  3. Locate the ENDCASE record.
  4. Change the value in the Code field to UU.

Adding Wizard Directives

You can place special directives in your code files that instruct the Documenting wizard to perform specific tasks when analyzing the code. The available wizard directives are as follows:

  • ACTIONCHARS
    Specifies the characters used to create action or tree diagrams of your code. You might want to change the default settings if you use code pages other than ASCII 1250 or ANSI 1252 in FoxFont to get the characters you expect.
  • EXPANDKEYWORDS
    Specifies whether keyword expansion is active or not in the Documenting wizard. The default value is OFF, which retains keywords as typed in code. If you have used four-character abbreviations throughout your code, you might want to make the code more reader friendly by setting keyword expansion ON.
  • XREFKEYWORDS
    Specifies whether the wizard creates a file that shows all keywords and their locations in the code document. The file contains the keyword names, keyword type (according to the Fdxref.dbf table, as described in Step 5 of the Documenting wizard), the line it is located on, and the file containing it. The default is ON.
  • ARRAYBRACKETS
    Specifies whether square brackets and parentheses are treated differently. The default, ON, treats square brackets as array delimiters and parentheses as function or method delimiters.
  • ACTIONINDENTLENGTH
    Specifies the number of character spaces the wizard uses for indentation in tree or action diagrams. The minimum value is two characters. Functionally, in code, there is no difference between spaces or tabs. Indenting makes it easier to read and understand your code.

You can place wizard directives in the main program file of your project (to direct the wizard to analyze all code files in the project) or in individual code files (to instruct the wizard how to analyze specific files).

The syntax of the directives begins with an asterisk, so Visual FoxPro will treat them as comments and ignore them when compiling programs. The directives are not case sensitive. The syntax of the directives is:

*# document directive

For consistency throughout your code, it is a good idea to place the directives near the beginning of the main program file, so the Documenting wizard encounters the instruction when it begins analyzing.

The Documenting wizard directives are described below.

  • *# document ACTIONCHARS "abcdef"
    By default, when the wizard creates an Action Diagram or a Tree Diagram, the wizard uses six characters that appear as lines and square corners when viewed under ASCII code page 1250 or under ANSI code page 1252 in FoxFont. Not all the characters map to line characters when viewed under other code pages. The six default characters and their corresponding FoxFont characters are listed below as a, b, c, d, e, and f.
    abcdef Default Chr( ) Value As viewed in FoxFont
    a 32 (space)
    b 196
    c 179
    d 218
    e 192
    f 195

Tip   When using other code pages, insert the following code in your main program file to ensure that the lines in your diagrams map to line-like characters (the first character of the string enclosed in quotes is a space):

*# document ACTIONCHARS " -|+++"

Note   For a list of supported code pages, see Code Pages Supported by Visual FoxPro.

  • *# document XREF cMode
    Enables cross-referencing of variables. The default is ON.

    cMode Description
    ON Enables cross-referencing of variables
    OFF Disables cross-referencing of variables
    SUSPEND Disables cross-referencing of variables in the current file until the Documenting Wizard encounters the next instance of:

    *# document XREF ON

  • *# document EXPANDKEYWORDS cMode
    Enables the expansion of abbreviated keywords in your code. For example, "DEFI WIND" would be expanded to "DEFINE WINDOW." The default is OFF.

    Caution   Not all keywords in Visual FoxPro begin with a unique string of four characters. For example, "REPL" could be short for "REPLACE" or "REPLICATE." Be careful if you include this directive and choose to overwrite existing files.

    cMode Description
    ON Enables keyword expansion
    OFF Disables keyword expansion
    SUSPEND Disables keyword expansion in the current file until the next instance of:

    *# document EXPANDKEYWORDS ON

  • *# document XREFKEYWORDS cMode
    This directive corresponds to the Cross-Reference Keywords option on "Step 6 – Finish" in the Documenting Wizard. The default is OFF.

    cMode Description
    ON Enables cross-referencing of keywords
    OFF Disables cross-referencing of keywords
    SUSPEND Disables cross-referencing of keywords in the current file until the next instance of:

    *# document XREFKEYWORDS ON

  • *# document ARRAYBRACKETS cMode
    The default is OFF.

    cMode Description
    ON The Documenting Wizard assumes that square brackets are used for arrays and that parentheses are used for functions and methods.
    OFF The Documenting Wizard treats both square brackets and parentheses as arrays.
  • *# document ACTIONINDENTLENGTH nSpace
    nSpace is the number of character spaces that you want the Documenting Wizard to use for indentation. The minimum value allowed is 2.

See Also

Documenting Wizard | Wizards Overview | Code Pages Supported by Visual FoxPro