* WHERE-IS library doc * Gather keyboard files, add VIRTUAL.TEDIT * add UNIXCOMM.TEDIT * rest of TEdit library files * save table of contents index for reworking * Don't move around VIRTUALKEYBOARDS files; will move in separate commit * Add MATMULT from Envos/Medley
116 lines
89 KiB
Plaintext
116 lines
89 KiB
Plaintext
1
|
||
|
||
Lisp Library Modules, Medley Release 1.15, MASTERSCOPE
|
||
1
|
||
|
||
Lisp Library Modules, Medley Release 1.15, MASTERSCOPE
|
||
MASTERSCOPE
|
||
1
|
||
|
||
MASTERSCOPE
|
||
1
|
||
|
||
|
||
MASTERSCOPE
|
||
6
|
||
|
||
MasterScope(MASTERSCOPE NIL MasterScope NIL NIL 157) is an interactive program for analyzing and cross referencing user programs(ROSS% REFERENCING% USER% PROGRAMS NIL ross% referencing% user% programs NIL NIL 157). It contains facilities for analyzing user functions(ANALYZING% USER% FUNCTIONS NIL analyzing% user% functions NIL NIL 157) to determine what other functions are called; how and where variables are bound, set, or referenced; and which functions use particular record declarations. MasterScope can analyze definitions directly from a file as well as in-memory definitions.
|
||
MasterScope maintains a database of the results of the analyses it performs. Via a simple command language, you may interrogate the database, call the editor on those expressions in functions that were analyzed which use variables or functions in a particular way, or display the tree structure of function calls among any set of functions.
|
||
MasterScope is interfaced with the editor and file manager so that when a function is edited or a new definition loaded in, MasterScope knows that it must reanalyze that function.
|
||
With the Medley release, MasterScope now understands Common Lisp defun, defmacro, and defvar.
|
||
Requirements
|
||
1
|
||
|
||
MSANALYZE, MSPARSE, MSCOMMON, MS-PACKAGE
|
||
You may also want to make use of Browser, DataBaseFns, and SEdit or DEdit.
|
||
Installation
|
||
1
|
||
|
||
Load MASTERSCOPE.DFASL and the other .DFASL files from the library.
|
||
MasterScope Command Language
|
||
1
|
||
|
||
You communicate with MasterScope using an English-like command language, e.g., WHO CALLS PRINT. With these commands, you can direct that functions be analyzed, interrogate the MasterScope database(MASTERSCOPE% DATABASE NIL MasterScope% database NIL NIL 157), and perform other operations. The commands deal with sets of functions, variables, etc., and relations between them (e.g., call, bind). Sets correspond to English nouns; relations correspond to verbs.
|
||
A set of atoms can be specified in a variety of ways, either explicitly, e.g., FUNCTIONS ON FIE specifies the atoms in (FILEFNSLST 'FIE), or implicitly, e.g., NOT CALLING Y, where the meaning must be determined in the context of the rest of the command. Such sets of atoms are the basic building blocks with which the command language deals.
|
||
MasterScope also deals with relations between sets(RELATIONS% BETWEEN% SETS NIL relations% between% sets NIL NIL 157).
|
||
For example, the relation CALL relates functions and other functions; the relations BIND and USE FREELY relate functions and variables. These relations get stored in the MasterScope database when functions are analyzed. In addition, MasterScope "knows" about file manager conventions; CONTAIN relates files and various types of objects (functions, variables).
|
||
Sets and relations are used (along with a few additional words) to form sentence-like commands.
|
||
For example, the command WHO ON 'FOO USE 'X FREELY prints out the list of functions contained in the file FOO which use the variable X freely. The command EDIT WHERE ANY CALLS 'ERROR calls EDITF (see IRM) on those functions which have previously been analyzed that directly call ERROR, pointing at each successive expression where the call to ERROR actually occurs.
|
||
MasterScope Commands(MASTERSCOPE% COMMANDS NIL MasterScope% Commands NIL NIL 158)
|
||
The normal mode of communication with MasterScope is via commands. These are sentences in the MasterScope command language which direct MasterScope to answer questions or perform various operations.
|
||
MasterScope commands are typed into the Executive window, preceded by a period (.) to distinguish them from other commands to the Exec. MasterScope keywords can be in any package, so MasterScope commands can be issued in any type of Exec. The commands may be typed uppercase or lowercase.
|
||
To use a keyword as a variable or function name, you must use a single quote in front of it, e.g., .WHO SETS 'SETS.
|
||
Note: Any MasterScope command may be followed by OUTPUT FILENAME to send output tothe given file rather than the terminal, e.g., .WHO CALLS WHO OUTPUT CROSSREF.
|
||
ANALYZE SET [MasterScope command]
|
||
Analyzes the functions in SET (and any functions called by them) and includes the information gathered in the database. MasterScope does not reanalyze a function if it thinks it already has valid information about that function in its database. You may use the command REANALYZE to force reanalysis.
|
||
Note that whenever a function is referred to in a command as a subject of one of the relations, it is automatically analyzed; you need not give an explicit ANALYZE command. Thus, WHO IN MYFNS CALLS FIE automatically analyzes the functions in MYFNS if they have not already been analyzed.
|
||
Note also that only EXPR definitions are analyzed; that is, MasterScope does not analyze compiled code. If necessary, the definition is DWIMIFYed before analysis. If there is no in-core definition for a function (either in the function definition cell or an EXPR property), MasterScope attempts to read in the definition from a file. Files which have been explicitly mentioned previously in some command are searched first. If the definition cannot be found on any of those files, MasterScope looks among the files on FILELST for a definition. If a function is found in this manner, MasterScope prints a message "(reading from FILENAME)". If no definition can be found at all, MasterScope prints a message "FN can't be analyzed". If the function previously was known, the message "FN disappeared!" is printed.
|
||
REANALYZE SET [MasterScope command]
|
||
Causes MasterScope to reanalyze the functions in SET (and any functions called by them) even if it already has valid information in its database. This would be necessary if you had disabled or subverted the file manager; e.g., performed PUTD's to change the definition of functions.
|
||
ERASE SET [MasterScope command]
|
||
Erases all information about the functions in SET from the database. ERASE by itself clears the entire database.
|
||
SHOW PATHS PATHOPTIONS [MasterScope command]
|
||
Displays a tree of function calls. This is described fully in "SHOW PATHS" below.
|
||
SET RELATION SET [MasterScope command]
|
||
SET IS SET [MasterScope command]
|
||
SET ARE SET [MasterScope command]
|
||
These commands have the same format as an English sentence with a subject (the first SET), a verb (RELATION or IS or ARE), and an object (the second SET). Any of the SETs within the command may be preceded by the question determiners WHICH or WHO (or just WHO alone).
|
||
For example, WHICH FUNCTIONS CALL X prints the list of functions that call the function X.
|
||
RELATION may be one of the relation words in present tense (CALL, BIND, TEST, SMASH, etc.) or used as a passive (e.g., WHO IS CALLED BY WHO). Other variants are allowed, e.g., WHO DOES X CALL, IS FOO CALLED BY FIE, etc.
|
||
The interpretation of the command depends on the number of question elements present:
|
||
If there is no question element, the command is treated as an assertion and MasterScope returns either T or NIL, depending on whether that assertion is true. Thus, ANY IN MYFNS CALL HELP prints T if any function in MYFNS call the function HELP, and NIL otherwise.
|
||
If there is one question element, MasterScope returns the list of items for which the assertion would be true.
|
||
For example,
|
||
MYFN BINDS WHO USED FREELY BY YOURFN
|
||
prints the list of variables bound by MYFN which are also used freely by YOURFN.
|
||
If there are two question elements, MasterScope prints a doubly indexed list:
|
||
_. WHO CALLS WHO IN /FNS
|
||
RECORDSTATEMENT -- /RPLNODE
|
||
RECORDECL1 -- /NCONC, /RPLACD, /RPLNODE
|
||
RECREDECLARE1 -- /PUTHASH
|
||
UNCLISPTRAN -- /PUTHASH, /RPLNODE2
|
||
RECORDWORD -- /RPLACA
|
||
RECORD1 -- /RPLACA, /SETTOPVAL
|
||
EDITREC -- /SETTOPVAL
|
||
EDIT WHERE SET RELATION SET [- EDITCOMS] [MasterScope command]
|
||
(WHERE may be omitted.) The first SET refers to a set of functions. The EDIT command calls the editor on each expression where the RELATION actually occurs.
|
||
For example, EDIT WHERE ANY CALL ERROR calls EDITF on each (analyzed) function which calls ERROR stopping within a TTY: at each call to ERROR. Currently you cannot EDIT WHERE a file which CONTAINS a datum, nor where one function CALLS another SOMEHOW.
|
||
EDITCOMS, if given, is a list of commands passed to EDITF to be performed at each expression.
|
||
For example,
|
||
EDIT WHERE ANY CALLS MYFN DIRECTLY - (SW 2 3) P
|
||
switches the first and second arguments to MYFN in every call to MYFN and prints the result. EDIT WHERE ANY ON MYFILE CALL ANY NOT @ GETD calls the editor on any expression involving a call to an undefined function.
|
||
Note that EDIT WHERE X SETS Y points only at those expressions where Y is actually set, and skips over places where Y is otherwise mentioned.
|
||
SHOW WHERE SET RELATION SET [MasterScope command]
|
||
Like the EDIT command except merely prints out the expressions without calling the editor.
|
||
EDIT SET [- EDITCOMS] [MasterScope command]
|
||
Calls EDITF on each function in SET. EDITCOMS, if given, is passed as a list of editor commands to be Executed.
|
||
For example,
|
||
EDIT ANY CALLING FN1 - (R FN1 FN2)
|
||
replaces FN1 by FN2 in those functions that call FN1.
|
||
DESCRIBE SET [MasterScope command]
|
||
Prints the BIND, USE FREELY and CALL information about the functions in SET.
|
||
For example, the command DESCRIBE PRINTARGS might print out:
|
||
PRINTARGS[N,FLG]
|
||
binds: TEM,LST,X
|
||
calls: MSRECORDFILE,SPACES,PRIN1
|
||
called by: PRINTSENTENCE,MSHELP,CHECKER
|
||
This shows that PRINTARGS has two arguments, N and FLG; binds internally the variables TEM, LST and X; calls MSRECORDFILE, SPACES and PRIN1; and is called by PRINTSENTENCE, MSHELP, and CHECKER.
|
||
You can specify additional information to be included in the description. DESCRIBELST is a list each of whose elements is a list containing a descriptive string and a form. The form is evaluated (it can refer to the name of the funtion being described by the free variable FN). If it returns a non-NIL value, the description string is printed followed by the value. If the value is a list, its elements are printed with commas between them.
|
||
For example, the entry
|
||
("types: " (GETRELATION FN '(USE TYPE) T)
|
||
would include a listing of the types used by each function.
|
||
CHECK SET [MasterScope command]
|
||
Checks for various anomalous conditions (mainly in the compiler declarations) for the files in SET (if SET is not given, FILELST is used).
|
||
For example, this command warns about:
|
||
<EFBFBD><EFBFBD> |