1
0
mirror of synced 2026-01-12 00:42:56 +00:00
Interlisp.medley/lispusers/GRAPHCALLS.TEDIT
2020-11-15 19:22:14 -08:00

26 lines
23 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

en·vÅos GRAPHCALLS
2
4
1
GRAPHCALLS
1
4
By: Christopher Lane (Lane@Sumex-Aim.Stanford.Edu)
Uses: GRAPHER, MSANALYZE (WHERE-IS & HELPSYS optional)
GRAPHCALLS is an extended graphical interface to the Envos Lisp CALLS function. It is to CALLS what BROWSER is to SHOW PATHS in MASTERSCOPE. It allows fast graphing of the calling hierarchy of both interpreted and compiled code, whether or not the source is available (see the CALLS function in the MASTERSCOPE section of the Lisp Library Modules manual), allowing examination of both user and system functions. The sources of the functions do not have to be analyzed by MASTERSCOPE first.
Additionally, buttoning a function on the graph brings up a menu of operations that can be done with the function, such as editing, inspecting, further graphing etc.
(GRAPHCALLS FUNCTION &REST OPTIONS) [Function]
Graphs the calling hierarchy of FUNCTION. Terminal nodes on the graph (those which call no other functions or are undefined) are printed in a bold version of the graph's font indicating that they cannot be graphed further:
((
FIELDS (
SIDESFLG T)
IDS 14 DATE \UNPACKDATE DAYTIME IMOD \DTSCAN \ISDST? \OUTDATE \LISPERROR NTH SUBSTRING NCHARS ALLOCSTRING \RPLRIGHT RPLSTRING
FONTS 2 (GACHA 8) (GACHA 8 BRR)
NODES (
(1 DATE
(11 . 76) 1 NIL NIL (2 7 ) NIL)
(2 \UNPACKDATE
(80 . 111) 1 NIL NIL (3 4 5 6 ) (1 ))
(3 DAYTIME
(157 . 129) 1 NIL NIL NIL (2 ))
(4 IMOD
(150 . 117) 2 NIL NIL NIL (2 ))
(5 \DTSCAN
(157 . 105) 2 NIL NIL NIL (2 ))
(6 \ISDST?
(157 . 93) 1 NIL NIL NIL (2 ))
(7 \OUTDATE
(73 . 41) 1 NIL NIL (8 9 10 11 12 13 14 ) (1 ))
(8 \LISPERROR
(150 . 77) 1 NIL NIL NIL (7 ))
(9 NTH
(132 . 65) 2 NIL NIL NIL (7 ))
(10 SUBSTRING
(147 . 53) 1 NIL NIL NIL (7 ))
(11 NCHARS
(140 . 41) 1 NIL NIL NIL (7 ))
(12 ALLOCSTRING
(152 . 29) 1 NIL NIL NIL (7 ))
(13 \RPLRIGHT
(147 . 17) 2 NIL NIL NIL (7 ))
(14 RPLSTRING
(147 . 5) 1 NIL NIL NIL (7 ))
))
0 0
NIL
The
remainder
of the)
The remainder of the arguments, in keyword format, make up OPTIONS eg.
(GRAPHCALLS 'DATE :FONT '(GACHA 10) :DEPTH 4 :FILTER 'FGETD)
Options include:
:STREAM An image stream to display the graph on. The options list is saved on the stream.
:FILTER A predicate to apply to the functions when building the graph to test their eligibility to appear on the graph. The filter can be any defined function; the default is not to filter. Interesting filters include:
WHEREIS Limits the tree to only functions the user as has loaded and prunes out system functions and SYSLOADed files. Quite useful.
FGETD Limits the tree to only functions that are actually defined. Thus if you are perusing the tree for BITBLT and do not have and are not interested in the color code, FGETD will remove all of the undefined color bitmap functions.
EXPRP Limits the tree to interpreted functions. Useful for graphing functions in the development stage.
CCODEP Limits the tree to compiled functions.
NO\ Keeps low level functions starting with \ (i.e. \OUTDATE) off of the graph. Useful for getting an overview of system functions and when advising system functions (as \'ed functions should probably not be advised).
:DEPTH The calling hierarchy is graphed to depth levels (defaults to 2).
:FORMAT Passed to LAYOUTGRAPH and can be any format specification (LATTICE, VERTICAL, REVERSE etc.); defaults to (HORIZONTAL COMPACT REVERSE/DAUGHTERS). In the forest format multiple instances of a function appear on the graph after every calling function and a boxed node indicates the function appears elsewhere on the graph, possibly graphed further. In the lattice format each function gets placed on the graph only once (particularly useful for dynamic graphing, described below), and boxed nodes indicate recursive functions calls.
:SEARCHFN A function to use to generate the children of a given node. It should return a list whose first item is a list of the children, the other items in the list are ignore. Using this feature, it is possible to graph things other than functions. To graph what files load other files, supply a search function of (LAMBDA (FILE) (LIST (FILECOMSLST FILE 'FILES))) and a file name for the function argument.
:ADVISE Advises the functions after they are graphed (see Dynamic Graphing below); recognized values are one or both of the following:
INVERT Visually tracks a running program .
COUNT Counts function calls in a running program.
:DELAY The delay to use in advised graphs; defaults to 500 milliseconds.
:NAMEFN A function to use to generate the node labels on the graph.
:FONT The font to use to display the graph; defaults to (GACHA 8).
:SHAPE A boolean that indicates if the window should be shaped to fit the graph; defaults to NIL.
:PRIN2FLG A boolean that indicates to use PRIN2 when printing node labels, defaults to NIL.
:SUBFNDEFFLG A boolean that enables graphing of compiler generated functions; defaults to T.
:TOPJUSTIFYFLG Passed to SHOWGRAPH; defaults to NIL.
:ALLOWEDITFLG Passed to SHOWGRAPH; defaults to NIL.
GRAPH MENUS
The menu that pops up when you left button a function on the graph contains the following items:
?= Print the arguments to the function, if available.
HELP Calls HELPSYS on the function.
FNTYP Print the function's FNTYP.
WHERE Do a WHEREIS (with FILES = T) on the function.
EDIT Calls the editor on the function if available for editing.
TYPEIN BKSYSBUFs the name of the function into the typein buffer.
BREAK Applies BREAK to the function. Its subitems are:
BREAKIN Breaks the function only in the context of a particular calling function. In lattice format, if the function has more than one function calling it on the graph, the user is prompted to indicate the caller in which to break the function.
UNBREAKIN Undoes BREAKIN.
UNBREAK Applies UNBREAK to the function.
TRACE Applies TRACE to the function.
TRACEIN Traces the function only when called from inside a particular function, like BREAKIN above. Use UNBREAKIN to remove the trace, or else UNBREAK on the window menu.
CCODE Calls INSPECTCODE on the function if it is compiled code.
GRAPH Calls GRAPHCALLS to make a new graph starting with function, inherits the original graph's options.
FRAME Inspect the local, free and global variables of the function. These are the last three lists of the CALLS function placed into INSPECT windows. Its subitems are:
>FRAME Like FRAME but for all of the functions on the sub-tree starting at the selected node and only for FREEVARS and GLOBALVARS.
<FRAME Like >FRAME but for all of the functions above the function in the graph, i.e. the FREEVARS and GLOBALVARS in the function's scope.
Buttoning the graph outside a node give you a menu with these options:
UNBREAK Does an (UNBREAK), unbreaking all broken functions.
RESET Resets the counters for the COUNT option and redisplays the graph.
DYNAMIC GRAPHING
When the ADVISE option is specified with the value(s) of INVERT and/or COUNT, GRAPHCALLS will advise all of the functions on the graph (in the context of their parent) to invert their corresponding node on the graph (as well as delay some to allow it to be seen) and/or follow each function name by a count of the number of times it has been executed. In invert mode, a node remains inverted as long as control is inside its corresponding function and it returns to normal when the function is exited. The lattice format is best when using the invert feature. Closing the graph window UNADVISEs the functions on the graph.
An example of this is (GRAPHCALLS 'DATE :ADVISE 'INVERT) and then evaluate (DATE).
GRAPHCALLS will not graph or advise any function in the system list UNSAFE.TO.MODIFY.FNS when the advise option is used. Functions which are unsafe to advise should be added to this list.
CAVEAT PROGRAMMER! This feature must be used with caution. As a rule, one should not do this to system functions, but only one's own, use WHEREIS as a filter for this. Advising system code indiscriminately will probably crash the machine unrecoverablely.
You can, at some risk, interactively break and edit functions on the graph while the code is executing. Also, creating subgraphs of advised graphs will show the generated advice functions not the original functions called, as will creating new graphs of functions in advised graphs. You can create advised graphs of functions already graphed normally on the screen.
COMMAND WINDOW
)¦ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€þÿÿïøíÿøÿÿÿÿÿý÷;ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€ý÷ÿÿï÷¿íÿ÷¿ÿÿÿÿÿý÷;ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€ûþ˜èèïøíÇïøtΙã£Å÷;hñpîïÿÿÿÿÿÿÿÿÿÿÿÿÿ€ûþWggo÷m»ï÷³6fÝ<66>¹ú×gnonïÿÿÿÿÿÿÿÿÿÿÿÿÿ€û†üoooümÇï÷·vîñ½½ú×ooou_ÿÿÿÿÿÿÿÿÿÿÿÿÿ€ûöóoooómûï÷·vîͽ½ú×ooou_ÿÿÿÿÿÿÿÿÿÿÿÿÿ€ýæ÷gow·m»÷··vîݽ¹ýïono{¿ÿÿÿÿÿÿÿÿÿÿÿÿÿ€þø¨ïxx­Çøxwvîâ½Åýïoqpû¿ÿÿÿÿÿÿÿÿÿÿÿÿÿ€ÿÿÿïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€ÿÿÿïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€À€À€Ïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿù€Ïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿù€Ïÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿù€Ï‡ÿÿÿÿÿÿßþÛÿÿÿÿÀßÿÿÿþÿÿÿýÿÿÿwø?ûÿù€Ï{ÿÿÿÿÿÿßþÿÛÿÿÿÿßßÿÿÿþÿÿÿÿýÿ{ÿÿwûßûÿù€Îÿ‡Léž:<_þþÐÇLÿßÜx¸ÿþÿ”Ï}ÇF{î;Žé€Îÿ{3fmÙÛŸþÛ»+¿ÿÁÛ·7þöS6íÿ}»;s»íÛvé€Îÿ{wnïÛßþþÛƒ|ÿßÞ7¸ÿþþö÷w<C3B7>ÿ}ƒ{w»ìÇY€Îÿ{wnìÛÛßþþÛ¿¿ÿßÙ·¿þþö÷vmÿ}¿{w»íû7Y€Ï{{wníÛÛŸþþÛ»{¿ÿßÛ·7þþö÷víÿ{»;w»ÝÛw¹€Ï‡‡wnî+Ü_þþÜÇ|ÿßÜX¸ÿþÿ÷wÇG—¸>;¹€Ïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ÷¿ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¹€Ïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿøÿÿÿÿÿÿÿÿÿÿÿÿÿÿþy€È  €È   €È? <18> @"À 8 €È0<18> @  D €È0føóìóà KˆŽ/Âçú8p D €È>fÍ™<C38D>0¥5" LH5"Dˆ D €È0fÍ<66><C38D>0¥Ÿ!ñ HE!r"@ø D €È0fÍ<66><C38D>0¥<10>! HE!"@€ D €È0fÍ™<C38D>0B!" HB!"Dˆ D €È0>Ìðìó0BŽ á HB Âøéš8pÀ 8 €È  €È  €È  €È  €È áð> x@  €È !@À  €È$#£€ç €!x„¹âGYÄÀ x €È˜$$d@Ä €!„„Ä‚H"j$D@  €È<00><>$$'Àyò €!„„„‚<1F>Š>AÇÄ@  €È<00><>$$$  €!„„„‚H
@$@  €È<00>$dd@! „„Œ„‚H„"B$D@  €È<00>Ž#££€èá¾ xxt„bGAÄ@  €È  €È  €È ÿÿÿÿà €È ÿÿÿÿà €Èðø"ÿþ?ÿà8 €È€"  ÿýßÿàD €È#‰èàâЀ"pâáÂ!Åú8qÿÿßÿà €ÈáDI ð£P€!á‰""&¢D‰ÿÿßÿà €È„ ðB râCä"@9ÿÿ?ÿà €ÈB B"@Éÿþÿÿà €ÈDI£" "$"D‰ÿýÿÿà@ €Èò#ˆèèàùâêáÂ<00>Ä8uÿüÿà| €È ÿÿÿÿà €È ÿÿÿÿà €È  €È  €Èñ<| ø À 8 €È B!B   D €È€@B éx<42>Ï  €È"DЀ@!#"B ñ CQ<43>$À  €È>€@!!>|  "<10>Ä  €È d€€@!! @  â<10>$  €È "D€B!!#"@  <11>$ D €Èñ:€<@ øéŸ‘ÃÀ 8 €È  €È  €È  €È  €È  ># À  €È1€  !"# À  €È0>qóà
!-.#áÅœ#„@ ( €È0 $! !51£&¢$D@ ( €È1°y0 $ € >!! ¢ä>#„@ H €È1°Ù0¤ @ !!¢ Dà | €È3°Ù0d !! B$"$D@  €È°}ó0 !!>BÄ#„@  €È  €È  €Ïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿü?ÿÿÿù€À?ÿÿÿù€Àà?ÿÃÿù€À?ÿßÿù€ÀÀ?ÿ‡ÿù€À ?ÿ»ÿù€À ?ÿûÿù€À ?ÿûÿù€À ?ÿ»ÿù€ÀÀ?ÿÇÿù€À?ÿÿÿù€À?ÿÿÿù€À €À €ÀÀ 8 €À D €À @ €ÀÀ x €À D €À D €À D €ÀÀ 8 €À €À €À €À €Àà | €À  €À@  €À  €À  €À €À €À €À €À €À €À €ÀÀ 8 €À D €À D €ÀÀ 8 €À D €À D €À D €ÀÀ 8 €À €À €À €À €ÀÀ 8 €À D €À D €À D €Àà < €À  €À D €ÀÀ 8 €À €À €À €À €À8 C€ €À D Ä@ €À<D Ä@ €ÀD D@ €ÀD D@ €ÀD D@ €ÀD D@ €À8 C€ €À €À €Àÿÿÿÿÿÿÿÿù€À€À€ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ€
(GRAPHCALLSW [REBUILD?]) [Function]
Puts up a command window with menus that will interactively set up calls to GRAPHCALLS. The menus let you set the Invert, Count and Edit flags, select from common filters and formats and set the depth of the graph. You can also change the amount of delay used in the advised functions when doing dynamic graphing. If you specify an advised graph (Invert or Count) and do not specify a WHEREIS filter, you will be asked to confirm with the mouse for your own protection.
More than one item on the filter and flags menus can be selected at a time. Buttoning a selected item on these menus unselects it. The command menu contains the following:
Function Prompts for the name of a function to graph when the Graph item is selected.
Include Adds files or functions to the list of items to allow on the graph, see the Include/Exclude algorithm below.
Exclude Adds files of functions to the list of items disallowed on the graph, see the Include/Exclude algorithm below.
Clear Clears all of the settings on the command window to their defaults. Also clears the Include/Exclude lists.
Graph Graphs the function by calling GRAPHCALLS with the selected options.
Include and Exclude allow fine tuning of the filter function. If the function passes the filter, then the following are tried until one determines whether or not the function will be on the graph:
If a set of functions has been explicitly excluded, and the function is a member of this set, it will NOT appear on the graph.
If a set of functions has been explicitly included, and the function is a member of this set, it WILL appear on the graph.
If a set of files has been explicitly excluded, and the function is in one of those files, it will NOT appear on the graph.
If a set of files has been explicitly included, and the function is not in one of those files, it will NOT appear on the graph.
The function WILL appear on the graph.
The format menu contains two items that are not passed on to GRAPHER but are used to select alternate NAMEFN options:
ArgList Supplies a NAMEFN that will print the function and its arguments (using SMARTARGLIST) as the node label.
WhereIs Supplies a NAMEFN that will print the function followed by the file(s) found by doing WHEREIS (with FILES = T) if any .
When the command window is open, middle buttoning a node on a GRAPHCALLS graph will bring up a menu of commands relating to command window and graphs. The menu contains:
EXCLUDE Adds the function to the exclude functions list of the command window. This is the only way to exclude system functions which get added to the SYSTEM file exclusion list.
The command window can also be obtained via the background menu. Subsequent calls to GRAPHCALLSW (either directly or via the background menu) will reuse the old command window if there is one. If this window is damaged, and redisplay does not help, then setting REBUILD? to T will build a new command window from scratch.
NOTES
ÿÿïfÿ Function call graphs are constructed using breadth first search but GRAPHER lays out graphs depth first so functions may be expanded in different places on the graph than expected.
ÿÿïfÿ GRAPHCALLS sysloads GRAPHER and MSANALYZE if they are not already loaded.
ÿÿïfÿ In dynamic graphs, variables caused by advising show up in the frame inspections.
ÿÿïfÿ The global variable GRAPHCALLS.DEFAULT.OPTIONS contains all of the defaults for GRAPHCALLS keywords, in property list format.(LIST ((PAGE NIL (PAPERSIZE LETTER FOLIOINFO (ARABIC "" "") STARTINGPAGE# 95) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "" "")) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL NIL (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF SLOPE REGULAR WEIGHT MEDIUM)) (282 42 72 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 444 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL NIL (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF SLOPE REGULAR WEIGHT MEDIUM)) (282 42 72 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 444 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL)))))2 È ,HH-ÈT-ÈT2H<00>È<00>,2`È`2H<00>È<00>2HÈH,È3ÈÈT3ÈÈT2ÈÈ,È,È,È,È,È,ŠŠ8,ŠŠ8HÈÈ PAGEHEADING RUNNINGHEAD CLASSICCLASSICCLASSICTERMINAL
MODERN
MODERN
MODERN
?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8))
 HELVETICA
MODERN
MODERN MODERN
 HRULE.GETFNMODERN
 HRULE.GETFNMODERN
 HRULE.GETFNMODERN
  HRULE.GETFNMODERN   HRULE.GETFNMODERN  4
8
H
¦


 ¸½GRAPHOBJ.GETFNMODERN
 ;< T Õ~æd(Ù %  71+ 3=&- C = > \ S Q(
' 
` 5    0 < = 4ð " ¥ ; e ¦}G 5 D

r
"
½
ï
o° BMOBJ.GETFN3MODERN




Ù ­ 6 n p m EÆ{|'v j y« ­
4¸MUGM-zº