REDUCE

23.3 The Standard Lisp Cross Reference Program

crefis a Standard Lisp program for processing a set of Standard LISP function definitions to produce:

1.
A “summary” showing:
(a)
A list of files processed;
(b)
A list of “entry points” (functions which are not called or are only called by themselves);
(c)
A list of undefined functions (functions called but not defined in this set of functions);
(d)
A list of variables that were used non-locally but not declared global or fluidbefore their use;
(e)
A list of variables that were declared globalbut not used as fluids, i.e., bound in a function;
(f)
A list of fluidvariables that were not bound in a function so that one might consider declaring them globals;
(g)
A list of all globalvariables present;
(h)
A list of all fluidvariables present;
(i)
A list of all functions present.
2.
A “global variable usage” table, showing for each non-local variable:
(a)
Functions in which it is used as a declared fluidor global;
(b)
Functions in which it is used but not declared;
(c)
Functions in which it is bound;
(d)
Functions in which it is changed by setq.
3.
A “function usage” table showing for each function:
(a)
Where it is defined;
(b)
Functions which call this function;
(c)
Functions called by it;
(d)
Non-local variables used.

The program will also check that functions are called with the correct number of arguments, and print a diagnostic message otherwise.

The output is alphabetized on the first seven characters of each function name.

23.3.1 Restrictions

Algebraic procedures in REDUCE are treated as if they were symbolic, so that algebraic constructs will actually appear as calls to symbolic functions, such as aeval.

23.3.2 Usage

To invoke the cross reference program, the switch crefis used. on crefcauses the cref program to load and the cross-referencing process to begin. After all the required definitions are loaded, off crefwill cause the cross-reference listing to be produced. For example, if you wish to cross-reference all functions in the file tst.red, and produce the cross-reference listing in the file tst.crf, the following sequence can be used:

        out "tst.crf";
        on cref;
        in "tst.red"$
        off cref;
        shut "tst.crf";

To process more than one file, more instatements may be added before the call of off cref, or the instatement changed to include a list of files.

23.3.3 Options

Functions with the flag nolistwill not be examined or output. Initially, all Standard Lisp functions are so flagged. (In fact, they are kept on a list nolist!*, so if you wish to see references to all functions, then crefshould be first loaded with the command load cref, and this variable then set to nil).

It should also be remembered that any macros with the property list flag expand, or, if the switch forceis on, without the property list flag noexpand, will be expanded before the definition is seen by the cross-reference program, so this flag can also be used to select those macros you require expanded and those you do not.


Hosted by Download REDUCE Powered by MathJax