REDUCE

17.1 Introduction

This chapter describes tools which build cross references, and which aid in analyzing LISP code for building other cross reference - like tools.

17.1.1 RCREF - Cross Reference Generator for PSL Files

rcref is a Standard LISP program for processing a set of PSL function definitions to produce:

  1. A ”Summary” showing:
  2. A ”global variable usage” table, showing for each non-local variable:
  3. A ”function usage” table showing for each function:

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

RCREF also checks that functions are called with the correct number of arguments.

17.1.2 Restrictions

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

RCREF adds the eval flag to some functions, so it probably cannot coexist with the compiler in a core image.

SYSLisp procedures are not correctly analyzed.

17.1.3 Usage

RCREF should be used in PSL:RLisp. To make a file FILE.CRF which is a cross reference listing for files FILE1.EX1 and FILE2.EX2 do the following in RLisp:

LOAD RCREF;

OUT ”file.crf”; ON CREF;
IN ”file1.ex1”,”file2.ex2”;
OFF CREF;
SHUT ”file.crf”.

To process more files, more IN statements may be added, or the IN statement may be changed to include more files.

17.1.4 Options

*crefsummary = [Initially:NIL] switch
   
If the switch CREFSUMMARY is ON then only the summary (see 1 above) is produced.

Functions with the flag NOLIST are not examined or output. Initially, all PSL functions are so flagged. (In fact, they are kept on a list NOLIST!*, so if you wish to see references to ALL functions, then CREF should be first loaded with the command LOAD RCREF, and this variable then set to NIL). (RCREF is now autoloading.)

nolist* = [Initially: the following list] global
   
(and cond list max min or plus prog prog2 progn times lambda abs add1 append apply assoc atom car cdr caar cadr cdar cddr caaar caadr cadar caddr cdaar cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr close codep compress cons constantp de deflist delete df difference digit divide dm eject eq eqn equal error errorset eval evlis expand explode expt fix fixp flag flagp float floatp fluid fluidp function densym get getd getv global globalp go greaterp idp intern length lessp linelength liter lposn map map mapc mapcan mapcar mapcon maplist max2 member memq minus minusp min2 mkvect nconc not null numberp onep open pagelength pair pairp plus2 posn princ print prin1 prin2 prog2 put putd putv quote quotient rds read readch remainder remd remflag remob remprop return reverse rplaca rplacd sassoc set setq stringp sublis subst sub1 terpri times2 unfluid upbv vectorp wrs zerop)

It should also be remembered that in RLisp any macros with the flag EXPAND or, if FORCE is on, without the flag NOEXPAND, are 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. The use of ON FORCE; is highly recommended for CREF.