home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / tools / tooldrv / filxrf.doc < prev    next >
Text File  |  1992-09-30  |  22KB  |  571 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. F i l e X r e f
  9. Version 2.0
  10. ────────────────────────
  11. User's Guide
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.                                     ┌───────┐
  23.                                ┌───────┐    │                (R)
  24.                              ──│       │    │───────────────────
  25.                                │  ┌───────┐ │  Association of
  26.    ConVal Software, Inc.       │  │       │─┘  Shareware
  27.                                └──│   o   │    Professionals
  28.                              ─────│   |   │─────────────────────
  29.                                   └───┴───┘    MEMBER
  30.  
  31.  
  32.  
  33.                                                                           
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. F i l e X r e f
  41. Version 2.0
  42. ────────────────────────
  43. User's Guide
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.                                     ┌───────┐
  55.                                ┌───────┐    │                (R)
  56.                              ──│       │    │───────────────────
  57.                                │  ┌───────┐ │  Association of
  58.    ConVal Software, Inc.       │  │       │─┘  Shareware
  59.                                └──│   o   │    Professionals
  60.                              ─────│   |   │─────────────────────
  61.                                   └───┴───┘    MEMBER
  62.  
  63.  
  64.  
  65.                                                                           
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. Copyright 1990-1992 ConVal Software, Inc.
  73. All rights reserved.
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. This program is produced by a member of the Association of Shareware
  92. Professionals (ASP).  ASP wants to make sure that the shareware principle
  93. works for you. If you are unable to resolve a shareware-related problem with
  94. an ASP member by contacting the member directly, ASP may be able to help.
  95. The ASP Ombudsman can help you resolve a dispute or problem with an ASP
  96. member, but does not provide technical support for members' products.
  97.  
  98. Please write to the ASP Ombudsman at:
  99.  
  100.      ASP Ombudsman
  101.      545 Grover Road
  102.      Muskegon, MI  49442-9427
  103.      U.S.A.
  104.  
  105. or send a CompuServe message via CompuServe MAIL to ASP Ombudsman
  106. 70007,3536.
  107.  
  108. The ombudsman may be contacted by FAX by sending to the ASP FAX number:
  109. (616) 788-2765. In communication with the ombudsman please include a
  110. telephone number and/or FAX if available.
  111.  
  112. TABLE OF CONTENTS
  113.  
  114.  
  115.  
  116.  
  117. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  118.  
  119. Features of FileXref . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  120.  
  121. Specifying the Files to be Examined. . . . . . . . . . . . . . . . . . .  9
  122.  
  123. Specifying Words to Search for . . . . . . . . . . . . . . . . . . . . . 10
  124.  
  125. Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  126.  
  127. Notes and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . 13
  128.  
  129. Data File Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  130.  
  131.  
  132.  
  133.  
  134.                                                                     Page   6
  135. Introduction
  136.  ──────────────────────────────────────
  137. ConVal Software supports software developers. It provides tools and services
  138. to assist throughout the life cycle of a software project.
  139.  
  140. FileXref was the first of these tools, and I think you'll find it can give
  141. you a competitive edge for your software projects.
  142.  
  143. There are three questions that FileXref directly answers.
  144.  
  145.      What is the potential application-wide impact of changing a particular
  146.      source file?
  147.  
  148.      When I'm fixing a bug, how can I be sure that I've addressed the whole
  149.      class of the underlying problem and not just one instance?
  150.  
  151.      What files are unused and obsolete?
  152.  
  153. These questions can't be answered without some groundwork on your part,
  154. however. (Isn't that always the case?)
  155.  
  156. FileXref examines text file representations of the components of your
  157. application. This can include source code as well as your documentation
  158. files, program specs, etc. It needs your files to follow minimum naming
  159. conventions. For example, file extensions must indicate the type of data
  160. held in the file. So .C files imply C source code, while .BAT files imply
  161. batch files, and .TXT or .DOC implies a printable text file.  It doesn't
  162. really matter what the extension is, as long as all files with the same
  163. extension are the same type of file.
  164.  
  165. Although it is not a requirement for FileXref, you will reduce your own
  166. analysis efforts if you:
  167.  ■   never let variable names match any of your filenames, language
  168.      keywords or words you may use in messages to the user,
  169.  ■   make your filenames unique across all the file types you use, and
  170.  ■   group files of the same file type under a common subdirectory
  171.  
  172. To state this differently, when you want to find something you want only to
  173. find what you're looking for.  So if you name a variable "help", and have
  174. files with the name "help" and  use the word help in messages, you will
  175. complicate your life.  Why?  Well  when you are having a problem with the
  176. variable named "help" not being properly initialized, the first thing you'll
  177. probably do is a global search for the word "help".   What  comes back from
  178. the search will be far more than you need to solve the immediate problem.
  179. So you'll have to waste your time looking at files having nothing to do with
  180. the problem you're solving.  Wouldn't it be easier if your search returned
  181. just references to the variable?
  182.  
  183. To see how FileXref works independently of ToolDriver, type FILEXREF at the
  184. DOS command line.  This will cross reference the files in FILEXREF.FSL and
  185. the words in FILEXREF.WSL.
  186.                                                                     Page   7
  187.  
  188. A Condensed File Cross Reference report, showing the relationships of the
  189. files will be produced.  A Condensed Word Usage Report will also be created
  190. if the text file FILEXREF.WSL exists. An Unreferenced Files will be produced
  191. if there were any files which were not referenced by any others in the list.
  192. View the output report FILEXREF.RPT and the run statistics FILEXREF.MSG.
  193.  
  194. Features of FileXref
  195.  ──────────────────────────────────────
  196. FileXref analyzes a list of text files, extracting cross reference
  197. information which it stores in memory. It can process all text files and
  198. this version has special processing logic for supporting the syntax of the
  199. following file types:
  200.  
  201.      FILE
  202.      EXTENSION      CATEGORY
  203.      ───────────────────────────────────────────────
  204.      .BAS           BASIC
  205.      .BAT           Batch Files
  206.      .C .CPP        C and
  207.         .H .HPP          C++ source
  208.      .CBL           COBOL
  209.      .COB           COBOL
  210.      .FOR           FORTRAN
  211.      .ASM           Macro Assembler
  212.      .MAK           Make files
  213.      .PAS           Pascal
  214.      .PLI           PL/I
  215.      .REX           REXX
  216.      .SQL  .INP     Oracle
  217.      .TXT  .DOC     Text (ASCII)
  218.      .PRG           xBASE
  219.      ───────────────────────────────────────────────
  220.      All other types are scanned as if they were ASCII text files with no
  221.      regard to whether a reference was found in a "comment".
  222.  
  223.  
  224. You will prepare the list of files to be examined and insure that it
  225. represents all files related to your application. Or, you may use a utility,
  226. FileList (see Page 10), to create a list of all files on a disk drive which
  227. match one of the file types in the table just above.
  228.  
  229. You'll optionally prepare a list of words and/or word prefixes you'd also
  230. like cross referenced.
  231.                                                                     Page   8
  232.  
  233. FileXref can run out of memory when processing very large numbers of files
  234. and words.  If this happens, you may unload other programs (like TSR's),
  235. and/or use your text editor to pare down the list generated by FileList to
  236. just those files needed by your application. You may also need to reduce the
  237. list of words and word prefixes you supplied.  Later you'll see how to break
  238. a large job into smaller pieces.
  239.  
  240. FileXref will generate report files containing cross reference information
  241. for the list of files and words provided.
  242.  
  243. Three report files may be produced:
  244.  
  245. 1)   The file cross reference report presents "up" and "down" references in
  246.      one integrated report. It lists a file name in the center column with
  247.      its "next assembly" information on the left and its "component"
  248.      information on the right.
  249.  
  250.      The cross reference report may be selected in two styles:
  251.  
  252.      Use "condensed" reporting style when knowing a file's file type is
  253.      enough to know the directory where it may be found.
  254.  
  255.      Use "extended" reporting when filenames are not enough to uniquely
  256.      determine a full file specification.
  257.  
  258.      E.G If C:\APP01\HIST.PRG and C:\APP01\HIST.C both exist, then a
  259.      reference to HIST alone is ambiguous.
  260.  
  261.      This report will tell you the global impact of changing a file. By
  262.      examining the list of impacted files repeatedly, you can construct a
  263.      completely exploded tree representing the "ripple effect" of changing
  264.      the one file.
  265.  
  266. 2)   The Word Usage Report is optional. It shows the usage of names,
  267.      symbols, and variables throughout your source and documentation files.
  268.      If you supply a list of words or word prefixes to FileXref, it will
  269.      cross reference the words and word prefixes to the files referencing
  270.      them. This report also is available in condensed and extended styles.
  271.  
  272. 3)   The List of Unreferenced Files lists every file which was referenced by
  273.      no other file examined. So this list contains your application's top
  274.      level components. You would expect to see top level overview specs
  275.      and/or batch files in this list. It also will contain components not
  276.      yet documented. This will assist you in keeping documentation up to
  277.      date with the product.
  278.  
  279.      And it may contain obsolete components. Now you have a tool to keep
  280.      obsolete components from confusing the development and maintenance
  281.      effort!
  282.  
  283.                                                                     Page   9
  284.  
  285.  
  286. By using the following guidelines, the Word Usage Report can be a valuable
  287. aid to problem solving.
  288.  
  289.  ■   use meaningful names for variables
  290.  
  291.  ■   use the same name for the same variable in all places
  292.  
  293.  ■   avoid the use of names which are the same as keywords in any of the
  294.      languages you're using
  295.  
  296.  
  297. So if you are working on a bug having to do with the value of a counter, the
  298. report will show you every reference to the counter variable in the system -
  299. including documentation and support files! You will be able to address the
  300. counter's integrity throughout the system instead of just in the particular
  301. instance where it was incorrectly set. Here, then, is a tool for solving
  302. problems, not just addressing individual symptoms!
  303.  
  304. As an alternative to producing report files, FileXref can instead generate
  305. cross reference data (or export) files. These files are in a "quote and
  306. comma delimited" format. You may load these files into your spreadsheet or
  307. database program and work with the data that way.
  308.  
  309.  
  310. Specifying the Files to be Examined
  311.  ──────────────────────────────────────
  312. A File Specification List (FSL) file identifies to FileXref the files to be
  313. scanned and cross referenced. It is a text file and may be created with
  314. any text editor. Each file spec must start in column one of a line and
  315. only one file spec may exist on each line.
  316.  
  317.      Example:
  318.  
  319.         C:\SOURCE\MAINPGM.C
  320.         C:\SOURCE\SUBPGM1.C
  321.         C:\SOURCE\SUBPGM2.C
  322.         C:\SOURCE\INCLUDE\INFILE.H
  323.         C:\SOURCE\INCLUDE\OUTFILE.H
  324.         A:\SAMPLES\DEMO01.TXT
  325.  
  326. By naming all files in your application for FileXref, you insure that you
  327. will get a complete cross referencing.
  328.                                                                     Page  10
  329.  
  330. To ease the effort in preparing this file, a utility called FileList is
  331. provided for you. Given a starting directory, it will read all file names in
  332. that directory, writing each filename matching a file type in the table on
  333. page 7.  FileList processes subdirectories as well so the file selection
  334. process examines a directory tree, not just a single directory.
  335.  
  336. Example 1:     This causes FileList to create an input file for FileXref of
  337.                files on C:\SOURCE and its subdirectories, writing it to
  338.                file FILEXREF.FSL.
  339.  
  340.                 FILELIST C:\SOURCE     FILEXREF.FSL
  341.  
  342. Example 2:     This causes FileList to create an input file for FileXref of
  343.                files on the C disk.
  344.  
  345.                 FILELIST C:     FILEXREF.FSL
  346.  
  347. Example 3:     This causes FileList to create an input file for FileXref of
  348.                files on the C, D, and E disks.
  349.  
  350.                 FILELIST C:     C.LST
  351.                 FILELIST D:     D.LST
  352.                 FILELIST E:     E.LST
  353.                 COPY C.LST+D.LST+E.LST     FILEXREF.FSL
  354.  
  355. Specifying Words to Search for
  356.  ──────────────────────────────────────
  357. An optional input to FileXref is a Word Specification List (WSL) file. This
  358. contains words and word prefixes you wish to see cross referenced to the
  359. files that reference them. It may also contain words to be excluded from the
  360. resulting list (for example, language keywords).
  361.  
  362. Use a text editor to create this file. Start each entry in column one and
  363. place a code and a word or word prefix on each line. The code must be "I"
  364. for Include or "X" for eXclude. Terminate word prefixes with an "*".
  365.  
  366. Example 1: Cross reference all uses of "malloc", "extern" and words that
  367.            start with the letters "str". Exclude "strcopy".
  368.  
  369.            I malloc
  370.            I extern
  371.            I str*
  372.            X strcopy
  373.  
  374.  
  375.                                                                     Page  11
  376.  
  377. Example 2: Cross reference all words.
  378.  
  379.            I *
  380.  
  381.           NOTE: This option will use up memory very quickly, since ALL words
  382.           will be cross referenced (even words like "the", "and", "a"). If
  383.           you use this option you may need to limit the number of files to
  384.           examine, or use the technique in the next example.
  385.  
  386. Example 3: Cross reference a portion of the alphabet on one pass of the
  387.            files. Use multiple passes to cover the whole alphabet. You may
  388.            use this technique if you get an "out of memory" type of error
  389.            message.
  390.  
  391.            I A*
  392.            I B*
  393.            I C*
  394.            I D*
  395.            .
  396.              .
  397.                .
  398.  
  399. Getting Started
  400.  ──────────────────────────────────────
  401. Prior to running FileXref, create the list of files to be examined (see page
  402. 9) and, optionally, the list of words and word prefixes to be cross
  403. referenced (see page 10). The program requires that CONFIG.SYS
  404. contain FILES=20, or greater.
  405.  
  406. The usual way to start up FileXref is to type FILEXREF and press Enter at
  407. the DOS prompt.  However, the following parameters can be specified on the
  408. command line to modify FileXref's behavior during a particular run. The
  409. general command line syntax for running FileXref is:
  410.  
  411.    FILEXREF   [opt  fsl  xrf  fei  msg  wsl  rpt]
  412.  
  413. where opt is:   ?        Causes FileXref to display help information.
  414.                /RPTC     Tells FileXref to create condensed reports. (This
  415.                          is the default)
  416.                /RPTE     Instructs FileXref to create extended reports.
  417.                /RPTX     Specifies that no reports are to be generated -
  418.                          produce export files instead.
  419.           fsl  is a file specification for the input file containing file
  420.                specifications of each text file to be examined. If
  421.                omitted, this defaults to FILEXREF.FSL.
  422.  
  423.           xrf  is a file specification for the output cross reference data
  424.                file. If omitted, this defaults to FILEXREF.XRF.
  425.                                                                     Page  12
  426.  
  427.           fei  is a file specification for the output data file to contain a
  428.                list of unreferenced files (File End Items). If omitted, this
  429.                defaults to FILEXREF.FEI.
  430.  
  431.           msg  is a file specification for the output file of run
  432.                statistics. If omitted, this defaults to FILEXREF.MSG.
  433.  
  434.           wsl  is a file specification for the input file containing the
  435.                words and word prefixes to be cross referenced. If omitted,
  436.                this defaults to FILEXREF.WSL. If this parameter is not
  437.                overridden and the file FILEXREF.WSL exists, then a Word
  438.                Usage Report will be generated.
  439.  
  440.           rpt  is a file specification for the output file containing the
  441.                reports.  If omitted, FILEXREF.RPT.
  442.  
  443. Example 1: Take all the defaults.
  444.  
  445.    FILEXREF
  446.  
  447. This will read file specifications from FILEXREF.FSL and look for the file
  448. FILEXREF.WSL. If found, it will read its contents for words to be cross
  449. referenced. Messages will be written to FILEXREF.MSG. Since the default
  450. processing is /RPTC, condensed reports will be written to FILEXREF.RPT.
  451. Files FILEXREF.XRF and FILEXREF.FEI will be empty - they are only used
  452. with the /RPTX option.
  453.  
  454. Example 2: Create data files instead of report files.
  455.  
  456.    FILEXREF     /RPTX
  457.  
  458.      This invocation will cause cross reference data (in quote and
  459.      comma delimited format) to be written to FILEXREF.XRF and
  460.      unreferenced words to be written to FILEXREF.FEI. The report file
  461.      FILEXREF.RPT will be empty.
  462.  
  463. Example 3: Override the location and naming of the report file.
  464.  
  465.    FILEXREF  /RPTC  FILEXREF.FSL  FILEXREF.XRF  FILEXREF.FEI
  466.           FILEXREF.MSG FILEXREF.WSL  C:\DATA\MYREPORT.FIL
  467.  
  468.      NOTE: Although the above is shown as two separate lines, you would
  469.      type it all in at the DOS prompt and press enter once.
  470.  
  471.      NOTE: All parameters are positional. So, to override the last one,
  472.      we supplied the defaults for all others. That is, none may be
  473.      omitted prior to the one you wish to override. 
  474.                                                                     Page  13
  475.  
  476. Notes and Restrictions
  477.  ──────────────────────────────────────
  478.  1.   The input files must be text files with each line terminated by a line
  479.       feed alone or a carriage return and line feed.
  480.  2.   The FileXref utility distinguishes the comment syntax of each file
  481.       extension, i.e. REM in .BAT files and /*    */ in C files. Words found
  482.       within comments are not cross referenced.
  483.  3.   Words found in quotes or apostrophes are cross referenced.
  484.  4.   If you get the message "Insufficient memory", try reducing the scope
  485.       of the processing.  This may mean limiting the file specification list
  486.       (FSL) entries to only those files used by your application and/or
  487.       eliminating/limiting the word specification list (WSL) entries to just
  488.       those you need to see. Or see example 3 on page 11 for a multiple pass
  489.       solution.
  490.  5.   Only the first 31 characters of a word are retained.
  491.  6.   Cross reference entries will be created only for filenames and words
  492.       that are consistent with the symbol naming convention for each source
  493.       file type. So the restriction means that if the following is a
  494.       fragment from a .C file, a cross reference entry would not be created
  495.       for lines c or d below, even though these are valid DOS file names.
  496.       This is because the names are not valid C symbols.
  497.  
  498.       a. avg_value = get_avg ( list );        OK
  499.       b. fp = fopen ( "C:\\TEST.dat", "r" );  OK
  500.       c. fp = fopen ( "87tax.dat", "w" );     starts with a digit
  501.       d. strcpy ( fspec, "A:$budget.trn" );   starts with $
  502.  
  503. Data File Formats
  504.  ──────────────────────────────────────
  505.  
  506. FILEXREF.XRF   Columns are quote and comma delimited.
  507.  
  508.      Every line in FILEXREF.XRF consists of three columns.
  509.  
  510.      COL       COL       COL
  511.      1         2         3
  512.      ------    --------  ---
  513.      SYMBOL    FILENAME  Flags
  514.  
  515.      Table 1: Export file flags
  516.      ────────────────────────────────────────────────────
  517.      Column
  518.      123456
  519.      ------
  520.             The symbol in the first column is:
  521.      1.....     a filename.
  522.      .1....     a whole word.
  523.      ..1...     a word prefix.
  524.      ...1..     an expansion of a word prefix.
  525.      ....1. The symbol was referenced.
  526.      .....1 The symbol was marked for inclusion.
  527.      ────────────────────────────────────────────────────
  528.  
  529.                                                                     Page  14
  530.  
  531.      Examples:
  532.           ─────────────────────────────────────────────────────────────────
  533.           "SUB1","DRIVER","100011" Filename DRIVER contains a reference to
  534.                                    symbol SUB1, which is a filename.
  535.  
  536.           "READ","DRIVER","010011" Filename DRIVER references the symbol
  537.                                    READ, which was specified as a word in
  538.                                    the word specification list.
  539.  
  540.           "Testing","DOC1","001011"     Filename DOC1 references the symbol
  541.                                         Testing, which is a word prefix in
  542.                                         the word specification list.
  543.           "Testing5","DOC1","000111"    Filename DOC1 references the symbol
  544.                                         Testing5, which matches a word
  545.                                         prefix in the word specification
  546.                                         list.
  547.           ─────────────────────────────────────────────────────────────────
  548.  
  549. FILEXREF.FEI   Columns are quote and comma delimited.
  550.  
  551.      Every line in FILEXREF.FEI consists of two columns.
  552.  
  553.      COLUMN    COLUMN
  554.      1         2
  555.      --------  -----
  556.      FILENAME  Flags
  557.  
  558.      Flags is as described on the prior page.
  559.  
  560.  
  561.      Examples:
  562.      ───────────────────────────────────────────────────────────────────────
  563.      "SUB2","100001"     Filename SUB2 was not referenced by any other file.
  564.      "EXEC","100001"     Filename EXEC was not referenced by any other file.
  565.      ───────────────────────────────────────────────────────────────────────
  566.  
  567.  
  568.  
  569.  
  570.                End of FileXref Documentation.
  571.