Next: , Previous: , Up: Compiling Scheme   [Contents][Index]

1.6.4 Top-level Variable References

(require 'top-refs)

These procedures complement those in Module Manifests by finding the top-level variable references in Scheme source code. They work by traversing expressions and definitions, keeping track of bindings encountered. It is certainly possible to foil these functions, but they return useful information about SLIB source code.

Function: top-refs obj

Returns a list of the top-level variables referenced by the Scheme expression obj.

Function: top-refs<-file filename

filename should be a string naming an existing file containing Scheme source code. top-refs<-file returns a list of the top-level variable references made by expressions in the file named by filename.

Code in modules which filename requires is not traversed. Code in files loaded from top-level is traversed if the expression argument to load, slib:load, slib:load-source, macro:load, defmacro:load, synclo:load, syncase:load, or macwork:load is a literal string constant or composed of combinations of vicinity functions and string literal constants; and the resulting file exists (possibly with ".scm" appended).

The following function parses an Info Index. 3

Function: exports<-info-index file n …

n … must be an increasing series of positive integers. exports<-info-index returns a list of all the identifiers appearing in the nth … (info) indexes of file. The identifiers have the case that the implementation’s read uses for symbols. Identifiers containing spaces (eg. close-base on base-table) are not included. #f is returned if the index is not found.

Each info index is headed by a ‘* Menu:’ line. To list the symbols in the first and third info indexes do:

(exports<-info-index "" 1 3)



Although it will work on large info files, feeding it an excerpt is much faster; and has less chance of being confused by unusual text in the info file. This command excerpts the SLIB index into

info -f -n "Index" -o

Next: , Previous: , Up: Compiling Scheme   [Contents][Index]