The Standard Lisp Cross Reference Program
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 19.3 The Standard Lisp Cross Reference Program

CREF is a Standard Lisp program for processing a set of Standard LISP function deﬁnitions to produce:

1. A “summary” showing:
   1. A list of ﬁles processed;
   2. A list of “entry points” (functions which are not called or are only called by themselves);
   3. A list of undeﬁned functions (functions called but not deﬁned in this set of functions);
   4. A list of variables that were used non-locally but not declared GLOBAL or FLUID before their use;
   5. A list of variables that were declared GLOBAL but not used as FLUIDs, i.e., bound in a function;
   6. A list of FLUID variables that were not bound in a function so that one might consider declaring them GLOBALs;
   7. A list of all GLOBAL variables present;
   8. A list of all FLUID variables present;
   9. A list of all functions present.
2. A “global variable usage” table, showing for each non-local variable:
   1. Functions in which it is used as a declared FLUID or GLOBAL;
   2. Functions in which it is used but not declared;
   3. Functions in which it is bound;
   4. Functions in which it is changed by SETQ.
3. A “function usage” table showing for each function:
   1. Where it is deﬁned;
   2. Functions which call this function;
   3. Functions called by it;
   4. 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 ﬁrst seven characters of each function name.

#### 19.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.

#### 19.3.2 Usage

To invoke the cross reference program, the switch CREF is used. on cref causes the cref program to load and the cross-referencing process to begin. After all the required deﬁnitions are loaded, off cref will cause the cross-reference listing to be produced. For example, if you wish to cross-reference all functions in the ﬁle tst.red, and produce the cross-reference listing in the ﬁle 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 ﬁle, more IN statements may be added before the call of off cref, or the IN statement changed to include a list of ﬁles.

#### 19.3.3 Options

Functions with the ﬂag NOLIST will not be examined or output. Initially, all Standard Lisp functions are so ﬂagged. (In fact, they are kept on a list NOLIST!*, so if you wish to see references to all functions, then CREF should be ﬁrst 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 ﬂag EXPAND, or, if the switch FORCE is on, without the property list ﬂag NOEXPAND, will be expanded before the deﬁnition is seen by the cross-reference program, so this ﬂag can also be used to select those macros you require expanded and those you do not.

Up | Next | Prev | PrevTail | Front