Download SICStus Prolog User`s Manual

Transcript
344
SICStus Prolog
13.10.1 Introduction
The main purpose of the cross-referencer, spxref, is to find undefined predicates and unreachable code. To this end, it begins by looking for initializations, hooks and public
directives to start tracing the reachable code from. If an entire application is being checked,
it also traces from user:runtime_entry/1. If individual module-files are being checked, it
also traces from their export lists.
A second function of spxref is to aid in the formation of module statements. spxref can
list all of the required module/2 and use_module/2 statements by file.
13.10.2 Basic Use
The cross-referencer is run from the shell prompt, specifying the names of the Prolog source
files you wish to check. You may omit the ‘.pl’ suffix if you like.
% spxref [-R] [-v] [-c] [-i ifile] [-w wfile] [-x xfile] [-u ufile
] fspec ...
spxref takes a number of options, as follows. File arguments should be given as atoms or
as ‘-’, denoting the standard output stream.
‘-R’
Check an application, i.e. follow user:runtime_entry/1, as opposed to module
declarations.
‘-c’
Generate standard compiler style error messages.
‘-v’
Verbose output. This echoes the names of the files being read.
‘-i ifile’ An initialization file, which is loaded before processing begins.
‘-w wfile’ Warning file. Warnings are written to the standard error stream by default.
‘-x xfile’ Generate a cross-reference file. This is not generated by default.
‘-m mfile’ Generate a file indicating which predicates are imported and which are exported
for each file. This is not generated by default.
‘-u ufile’ Generate a file listing all the undefined predicates. This is not generated by
default.
13.10.3 Practice and Experience
Your code will probably rely on operator declarations and possibly term expansion. The
cross-referencer handles this in much the same way as fcompile/1: you must supply an
initialization file. Contrary to fcompile/1, spxref will execute any operator declaration it
encounters.