(FILECREATED " 8-Jan-86 21:51:52" {ERIS}<CUTTING>LISP>PATCH>DINFO.;1 33672 changes to: (RECORDS DINFOGRAPH) (FNS DINFO.READ.GRAPH DINFO.UPDATE.TEXT.DISPLAY) (VARS DINFOCOMS) previous date: "13-Sep-85 16:57:31" {ERIS}<LISP>KOTO>LIBRARY>DINFO.;2) (* Copyright (c) 1985, 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT DINFOCOMS) (RPAQQ DINFOCOMS ((FILES TEDIT GRAPHER FREEMENU HELPSYS) (RECORDS DINFOGRAPH DINFONODE) (MACROS DINFO.SETQ DINFO.GETQ) (* Primary functions) (FNS DINFO DINFO.UPDATE DINFO.INIT DINFO.READ.GRAPH DINFO.WRITE.GRAPH DINFO.CHANGE.GRAPHS DINFO.QUIT DINFO.RESET) (* FreeMenu functions) (FNS DINFO.ADD.FMENU DINFO.CREATE.FMENU DINFO.UPDATE.FMENU DINFO.SPECIAL.UPDATE DINFO.LOOKUP DINFO.CHOOSE.GRAPH) (* Other menu functions) (FNS DINFO.UPDATE.MENU.DISPLAY DINFO.TOGGLE.MENU DINFO.UPDATE.HISTORY.DISPLAY DINFO.TOGGLE.HISTORY) (* Interface to GRAPHER) (FNS DINFO.UPDATE.GRAPH.DISPLAY DINFO.UPDATE.FROM.GRAPH DINFO.TOGGLE.GRAPH) (* Interface to TEdit) (FNS DINFO.UPDATE.TEXT.DISPLAY DINFO.FIND DINFO.TOGGLE.TEXT DINFO.GET.FILENAME) (* Interface to HELPSYS) (FNS DINFO.IRM.LOOKUP DINFO.DISPLAY.REF DINFO.REF.TO.NODE) (* Provide hooks for implementors) (FNS DINFO.BUTTONEVENTFN DINFO.DEFAULT.EDITFN DINFO.DEFAULT.LOOKUPFN) (ADDVARS (BackgroundMenuCommands (DInfo [QUOTE (ADD.PROCESS (QUOTE (DINFO] "Open a DInfo window for browsing documentation."))) (VARS (BackgroundMenu)) (INITVARS (DINFOW) (DINFO.INIT.FILE.NAME) (DINFOGRAPHWINDOWPOSITION (CREATE POSITION XCOORD ← 1 YCOORD ← 1)) (DINFOMODES (QUOTE (GRAPH TEXT))) (DINFO.HISTORY.LENGTH 10) (\DINFO.MAX.MENU.LEN 10)) (GLOBALVARS DINFOW DINFO.INIT.FILE.NAME DINFOGRAPHWINDOWPOSITION DINFOMODES DINFO.HISTORY.LENGTH \DINFO.MAX.MENU.LEN))) (FILESLOAD TEDIT GRAPHER FREEMENU HELPSYS) [DECLARE: EVAL@COMPILE (RECORD DINFOGRAPH (NAME NODELST TOPNODEID CURRENTNODE DEFAULTHOST DEFAULTDIR TEXTPROPS LOOKUPFN EDITFN USERDATA DEFAULTDEVICE)) (RECORD DINFONODE (ID LABEL FILE FROMBYTE TOBYTE PARENT CHILDREN NEXTNODE PREVIOUSNODE USERDATA)) ] (DECLARE: EVAL@COMPILE (PUTPROPS DINFO.SETQ MACRO ((KEY VALUE) (LET ((VAL VALUE)) (WINDOWPROP DINFOW (QUOTE KEY) VAL) VAL))) [PUTPROPS DINFO.GETQ MACRO ((KEY) (WINDOWPROP DINFOW (QUOTE KEY] ) (* Primary functions) (DEFINEQ (DINFO [LAMBDA NIL (* drc: "10-Sep-85 22:25") (* Starts or continues DInfo.) (RESETLST [RESETSAVE NIL (QUOTE (AND RESETSTATE (DINFO.RESET] (* DINFOW is a global variable bound to the DInfo window. If it is bound to NIL this means that DInfo has not been initialized yet, or has been reset (w/ DINFO.RESET)) (COND [(WINDOWP DINFOW) (OPENW DINFOW) (DINFO.UPDATE (fetch (DINFOGRAPH CURRENTNODE) of (DINFO.GETQ CURRENT.GRAPH] (T (DINFO.INIT]) (DINFO.UPDATE [LAMBDA (NODE SEL) (* drc: "13-Sep-85 11:36") (* Called to visit a new node.) (* Should be DINFONODEP...) (OR (LISTP NODE) (ERROR NODE "NOT A DINFO NODE")) (OPENW DINFOW) [LET* [(GRAPH (DINFO.GETQ CURRENT.GRAPH)) (PREVIOUS.NODE (fetch (DINFOGRAPH CURRENTNODE) of (DINFO.GETQ CURRENT.GRAPH))) (STATUS (FM.READSTATE (DINFO.GETQ FMENU.WINDOW] (COND ((NOT (OBTAIN.MONITORLOCK (DINFO.GETQ MONITORLOCK) T)) (PRINTOUT (GETPROMPTWINDOW DINFOW) "DInfo is busy")) ((NOT (EQ NODE PREVIOUS.NODE)) (replace (DINFOGRAPH CURRENTNODE) of GRAPH with NODE) (DINFO.UPDATE.FMENU GRAPH NODE) (AND (LISTGET STATUS (QUOTE GRAPH)) (DINFO.UPDATE.GRAPH.DISPLAY GRAPH NODE)) (AND (LISTGET STATUS (QUOTE MENU)) (DINFO.UPDATE.MENU.DISPLAY GRAPH NODE)) (AND (LISTGET STATUS (QUOTE TEXT)) (DINFO.UPDATE.TEXT.DISPLAY GRAPH NODE SEL)) (AND (LISTGET STATUS (QUOTE HISTORY)) (DINFO.UPDATE.HISTORY.DISPLAY NODE SEL)) (CLEARW (GETPROMPTWINDOW DINFOW))) (T (AND (LISTGET STATUS (QUOTE GRAPH)) (OPENW (DINFO.GETQ GRAPH.WINDOW))) (AND (LISTGET STATUS (QUOTE TEXT)) [OR SEL (NOT (WINDOWPROP DINFOW (QUOTE TEXTSTREAM] (DINFO.UPDATE.TEXT.DISPLAY GRAPH NODE SEL)) (AND SEL (LISTGET STATUS (QUOTE HISTORY)) (DINFO.UPDATE.HISTORY.DISPLAY NODE SEL)) (CLEARW (GETPROMPTWINDOW DINFOW] (WINDOWPROP DINFOW (QUOTE BUTTONEVENTFN) (FUNCTION DINFO.BUTTONEVENTFN)) (RELEASE.MONITORLOCK (DINFO.GETQ MONITORLOCK]) (DINFO.INIT [LAMBDA NIL (* drc: "13-Sep-85 16:56") (* Assumes that we are starting DINFO afresh.) (* Set up DINFOW) (SETQ DINFOW (\IRM.GET.IRMWINDOW T)) (WINDOWPROP DINFOW (QUOTE TITLE) "DInfo") (DETACHALLWINDOWS DINFOW) (GETPROMPTWINDOW DINFOW) (DINFO.ADD.FMENU) (OBTAIN.MONITORLOCK (DINFO.SETQ MONITORLOCK (CREATE.MONITORLOCK))) (* Add TEdit functions) (OPENTEXTSTREAM NIL DINFOW NIL NIL (QUOTE (NOTITLE T))) (* Save old def of \IRM.DISPLAY.REF in case DInfo is reset.) (MOVD? (QUOTE \IRM.DISPLAY.REF) (QUOTE \IRM.DISPLAY.REF.SAVE)) (MOVD (QUOTE DINFO.DISPLAY.REF) (QUOTE \IRM.DISPLAY.REF)) (WINDOWPROP (GETPROMPTWINDOW DINFOW) (QUOTE CLOSEFN) NIL) (WINDOWADDPROP DINFOW (QUOTE CLOSEFN) (QUOTE DINFO.QUIT)) (WINDOWADDPROP DINFOW (QUOTE SHRINKFN) (QUOTE DINFO.QUIT)) (WINDOWADDPROP DINFOW (QUOTE EXPANDFN) (QUOTE DINFO)) (WINDOWADDPROP DINFOW (QUOTE RESHAPEFN) (FUNCTION REPOSITIONATTACHEDWINDOWS)) [DINFO.SETQ GRAPH.FILES (if DINFO.INIT.FILE.NAME then (CDR (READFILE DINFO.INIT.FILE.NAME)) else (LIST (PACKFILENAME (QUOTE DIRECTORY) IRM.HOST&DIR (QUOTE NAME) (QUOTE IRM) (QUOTE EXTENSION) (QUOTE DINFOGRAPH] (DINFO.CHANGE.GRAPHS (DINFO.READ.GRAPH (CAR (DINFO.GETQ GRAPH.FILES]) (DINFO.READ.GRAPH [LAMBDA (FILE) (* edited: "19-Dec-85 13:36") (* Reads a file written by DINFO.WRITE.GRAPH. Returns the DInfo graph stored on FILE.) (printout (GETPROMPTWINDOW DINFOW) T "Reading " (FILENAMEFIELD FILE (QUOTE NAME)) " graph...") (LET* ((FULLFILENAME (INFILEP FILE)) (DATA (CDR (READFILE FULLFILENAME))) (GRAPH (create DINFOGRAPH))) (replace (DINFOGRAPH NAME) of GRAPH with (FILENAMEFIELD FULLFILENAME (QUOTE NAME))) (replace (DINFOGRAPH NODELST) of GRAPH with (fetch (DINFOGRAPH NODELST) of DATA)) (replace (DINFOGRAPH TOPNODEID) of GRAPH with (fetch (DINFOGRAPH TOPNODEID) of DATA)) (replace (DINFOGRAPH DEFAULTHOST) of GRAPH with (FILENAMEFIELD FULLFILENAME (QUOTE HOST))) (replace (DINFOGRAPH DEFAULTDEVICE) of GRAPH with (FILENAMEFIELD FULLFILENAME (QUOTE DEVICE))) (replace (DINFOGRAPH DEFAULTDIR) of GRAPH with (FILENAMEFIELD FULLFILENAME (QUOTE DIRECTORY))) (replace (DINFOGRAPH TEXTPROPS) of GRAPH with (fetch (DINFOGRAPH TEXTPROPS) of DATA)) (replace (DINFOGRAPH LOOKUPFN) of GRAPH with (fetch (DINFOGRAPH LOOKUPFN) of DATA)) (replace (DINFOGRAPH EDITFN) of GRAPH with (fetch (DINFOGRAPH EDITFN) of DATA)) (replace (DINFOGRAPH USERDATA) of GRAPH with (fetch (DINFOGRAPH USERDATA) of DATA)) (printout (GETPROMPTWINDOW DINFOW) "OK.") GRAPH]) (DINFO.WRITE.GRAPH [LAMBDA (GRAPH FILE) (* drc: "10-Sep-85 22:38") (* Writes a DInfo graph to a file for reading by DINFO.READ.GRAPH. Returns the full file name of the file.) (WRITEFILE GRAPH FILE]) (DINFO.CHANGE.GRAPHS [LAMBDA (GRAPH) (* drc: "13-Sep-85 11:40") (AND (DINFO.GETQ CURRENT.GRAPH) (WINDOWADDPROP DINFOW (QUOTE CACHED.GRAPHS) (DINFO.GETQ CURRENT.GRAPH))) (DINFO.SETQ CURRENT.GRAPH GRAPH) [FM.CHANGELABEL (FM.ITEMFROMID (DINFO.GETQ FMENU.WINDOW) (QUOTE TOP)) (DINFO.GETQ FMENU.WINDOW) (fetch (DINFONODE LABEL) of (FASSOC (fetch (DINFOGRAPH TOPNODEID) of GRAPH) (fetch (DINFOGRAPH NODELST) of GRAPH] (FM.CHANGELABEL (FM.ITEMFROMID (DINFO.GETQ FMENU.WINDOW) (QUOTE GRAPH!)) (DINFO.GETQ FMENU.WINDOW) (fetch (DINFOGRAPH NAME) of GRAPH)) (DINFO.UPDATE (FASSOC (fetch (DINFOGRAPH TOPNODEID) of GRAPH) (fetch (DINFOGRAPH NODELST) of GRAPH]) (DINFO.QUIT [LAMBDA (W) (* drc: "27-Aug-85 12:34") (* This is the CLOSEFN for DINFOW) (CLOSEW (DINFO.GETQ GRAPH.WINDOW]) (DINFO.RESET [LAMBDA NIL (* drc: "26-Aug-85 20:53") (COND ((WINDOWP DINFOW) (OPENW DINFOW) (CLOSEW DINFOW) (DETACHALLWINDOWS DINFOW) (SETQ DINFOW) (* restore def so that HELPSYS will still work) (MOVD (QUOTE \IRM.DISPLAY.REF.SAVE) (QUOTE \IRM.DISPLAY.REF)) (SETQ IRMWINDOW]) ) (* FreeMenu functions) (DEFINEQ (DINFO.ADD.FMENU [LAMBDA NIL (* drc: " 4-Sep-85 11:08") (LET ((FM.WINDOW (DINFO.CREATE.FMENU))) (DINFO.SETQ FMENU.WINDOW FM.WINDOW) (ATTACHWINDOW FM.WINDOW DINFOW) (WINDOWPROP FM.WINDOW (QUOTE REJECTMAINCOMS) (QUOTE (SHAPEW]) (DINFO.CREATE.FMENU [LAMBDA NIL (* drc: "13-Sep-85 11:16") (FM.FORMATMENU (BQUOTE (((LABEL Graph! FONT (HELVETICA 10 BOLD) SELECTEDFN DINFO.CHOOSE.GRAPH MESSAGE "Select DInfo graph to browse") (ID GRAPH! LABEL "" TYPE TITLE FONT (HELVETICA 10))) ((LABEL Node: TYPE TITLE FONT (HELVETICA 10)) (ID NODE LABEL "" TYPE TITLE FONT (HELVETICA 10))) ((LABEL Top! SELECTEDFN DINFO.SPECIAL.UPDATE FONT (HELVETICA 10 BOLD) MESSAGE "Visit the top node") (ID TOP LABEL "" TYPE TITLE FONT (HELVETICA 10))) ((LABEL Parent! SELECTEDFN DINFO.SPECIAL.UPDATE FONT (HELVETICA 10 BOLD) MESSAGE "Visit the parent of the current node") (ID PARENT LABEL "" TYPE TITLE FONT (HELVETICA 10))) ((LABEL Previous! SELECTEDFN DINFO.SPECIAL.UPDATE FONT (HELVETICA 10 BOLD) MESSAGE "Visit the node previous to the current node") (ID PREVIOUS LABEL "" TYPE TITLE FONT (HELVETICA 10))) ((LABEL Next! SELECTEDFN DINFO.SPECIAL.UPDATE FONT (HELVETICA 10 BOLD) MESSAGE "Visit the node after the current node") (ID NEXT LABEL "" TYPE TITLE FONT (HELVETICA 10))) ((LABEL Display: TYPE TITLE FONT (HELVETICA 10)) (LABEL Graph ID GRAPH STATE , (MEMB (QUOTE GRAPH) DINFOMODES) TYPE TOGGLE SELECTEDFN DINFO.TOGGLE.GRAPH FONT (HELVETICA 10 BOLD) MESSAGE "Toggle display of the graph") (LABEL Menu ID MENU STATE , (MEMB (QUOTE MENU) DINFOMODES) TYPE TOGGLE SELECTEDFN DINFO.TOGGLE.MENU FONT (HELVETICA 10 BOLD) MESSAGE "Toggle display of the subnode menu") (LABEL Text ID TEXT STATE , (MEMB (QUOTE TEXT) DINFOMODES) TYPE TOGGLE SELECTEDFN DINFO.TOGGLE.TEXT FONT (HELVETICA 10 BOLD) MESSAGE "Toggle display of the text of the current node") (LABEL History ID HISTORY STATE , (MEMB (QUOTE HISTORY) DINFOMODES) TYPE TOGGLE FONT (HELVETICA 10 BOLD) SELECTEDFN DINFO.TOGGLE.HISTORY MESSAGE "Toggle recording and display of history")) ((LABEL Lookup! SELECTEDFN DINFO.LOOKUP FONT (HELVETICA 10 BOLD) MESSAGE "Lookup term in IRM index") (ID LOOKUP LABEL "" TYPE EDIT FONT (HELVETICA 10))) ((LABEL Find! SELECTEDFN DINFO.FIND FONT (HELVETICA 10 BOLD) MESSAGE "Find term in text of current node") (ID FIND LABEL "" TYPE EDIT FONT (HELVETICA 10]) (DINFO.UPDATE.FMENU [LAMBDA (GRAPH NODE) (* drc: " 4-Sep-85 08:50") (LET ((W (DINFO.GETQ FMENU.WINDOW)) (NODELST (fetch (DINFOGRAPH NODELST) of GRAPH))) (FM.CHANGELABEL (FM.ITEMFROMID W (QUOTE NODE)) W (fetch (DINFONODE LABEL) of NODE)) (FM.CHANGELABEL (FM.ITEMFROMID W (QUOTE PARENT)) W (fetch (DINFONODE LABEL) of NODE (FASSOC (fetch (DINFONODE PARENT) of NODE) NODELST))) (FM.CHANGELABEL (FM.ITEMFROMID W (QUOTE NEXT)) W (fetch (DINFONODE LABEL) of NODE (FASSOC (fetch (DINFONODE NEXTNODE) of NODE) NODELST))) (FM.CHANGELABEL (FM.ITEMFROMID W (QUOTE PREVIOUS)) W (fetch (DINFONODE LABEL) of NODE (FASSOC (fetch (DINFONODE PREVIOUSNODE) of NODE) NODELST]) (DINFO.SPECIAL.UPDATE [LAMBDA (ITEM BUTTONS WINDOW) (* drc: " 4-Sep-85 11:30") (LET* [(TYPE (FM.ITEMPROP ITEM (QUOTE LABEL))) (GRAPH (DINFO.GETQ CURRENT.GRAPH)) (CURRENT.NODE (fetch (DINFOGRAPH CURRENTNODE) of GRAPH)) (NEW.NODE (FASSOC (SELECTQ TYPE (Top! (fetch (DINFOGRAPH TOPNODEID) of GRAPH)) (Parent! (fetch (DINFONODE PARENT) of CURRENT.NODE)) (Next! (fetch (DINFONODE NEXTNODE) of CURRENT.NODE)) (Previous! (fetch (DINFONODE PREVIOUSNODE) of CURRENT.NODE)) NIL) (fetch (DINFOGRAPH NODELST) of GRAPH] (if NEW.NODE then (PROCESSPROP (THIS.PROCESS) (QUOTE NAME) (CONCAT "DInfo " (SUBSTRING (L-CASE TYPE T) 1 -2))) (DINFO.UPDATE NEW.NODE) else (* TYPE of Top! or Node! will sound silly here, but should never happen.) (printout (GETPROMPTWINDOW DINFOW) T "This node has no " (SUBSTRING (L-CASE TYPE) 1 -2]) (DINFO.LOOKUP [LAMBDA (ITEM) (* drc: "12-Sep-85 23:51") (LET* [(W (DINFO.GETQ FMENU.WINDOW)) (EDIT.ITEM (FM.ITEMFROMID W (QUOTE LOOKUP))) (STRING (FM.ITEMPROP EDIT.ITEM (QUOTE LABEL))) (GRAPH (DINFO.GETQ CURRENT.GRAPH)) (GRAPH.LOOKUPFN (fetch (DINFOGRAPH LOOKUPFN) of GRAPH)) (LOOKUPFN (if (FGETD GRAPH.LOOKUPFN) then GRAPH.LOOKUPFN else (FUNCTION DINFO.DEFAULT.LOOKUPFN] [if (STRING-EQUAL STRING "") then (FM.EDITITEM EDIT.ITEM W) (SETQ STRING (FM.ITEMPROP EDIT.ITEM (QUOTE LABEL] (APPLY* LOOKUPFN STRING GRAPH]) (DINFO.CHOOSE.GRAPH [LAMBDA NIL (* drc: "13-Sep-85 11:40") (LET* ([GRAPH.FILE (MENU (create MENU TITLE ← "Select Graph " CENTERFLG ← T ITEMS ←(for FILENAME in (DINFO.GETQ GRAPH.FILES) collect (LIST (FILENAMEFIELD FILENAME (QUOTE NAME)) (LIST (QUOTE QUOTE) FILENAME] (GRAPH.NAME (FILENAMEFIELD GRAPH.FILE (QUOTE NAME))) GRAPH) (COND ((NULL GRAPH.FILE)) ((EQ GRAPH.NAME (fetch (DINFOGRAPH NAME) of (DINFO.GETQ CURRENT.GRAPH))) (PRINTOUT (GETPROMPTWINDOW DINFOW) T "Already using " GRAPH.NAME " graph.")) ([SETQ GRAPH (ASSOC GRAPH.NAME (WINDOWPROP DINFOW (QUOTE CACHED.GRAPHS] (DINFO.CHANGE.GRAPHS GRAPH)) (T (DINFO.CHANGE.GRAPHS (DINFO.READ.GRAPH GRAPH.FILE]) ) (* Other menu functions) (DEFINEQ (DINFO.UPDATE.MENU.DISPLAY [LAMBDA (GRAPH NODE) (* drc: " 4-Sep-85 11:31") (LET* [(WINDOW (DINFO.GETQ SUBNODE.MENU.WINDOW)) [CHILDREN (DREVERSE (for ID in (fetch (DINFONODE CHILDREN) of NODE) bind (NODELST ←(fetch (DINFOGRAPH NODELST) of GRAPH)) collect (FASSOC ID NODELST] (LENGTH (FLENGTH CHILDREN)) (SCROLLABLE (GREATERP LENGTH \DINFO.MAX.MENU.LEN)) (MENU (create MENU ITEMWIDTH ←(WINDOWPROP DINFOW (QUOTE WIDTH)) CENTERFLG ← T MENUCOLUMNS ← 1 MENUOUTLINESIZE ← 0 ITEMS ←(for CHILD in CHILDREN collect (LIST (fetch (DINFONODE LABEL) of CHILD) (BQUOTE (DINFO.UPDATE (QUOTE , CHILD))) "Will visit this node if selected."] (AND WINDOW (PROGN (DETACHWINDOW WINDOW) (CLOSEW WINDOW))) (if CHILDREN then (UPDATE/MENU/IMAGE MENU) (SETQ WINDOW (CREATEW (create REGION LEFT ← 0 BOTTOM ← 0 WIDTH ←(WINDOWPROP DINFOW (QUOTE WIDTH)) HEIGHT ←(HEIGHTIFWINDOW (if SCROLLABLE then (TIMES \DINFO.MAX.MENU.LEN (fetch (MENU ITEMHEIGHT) of MENU)) else (fetch (MENU IMAGEHEIGHT) of MENU)) T)) "Subnodes" NIL T)) (ADDMENU MENU WINDOW (create POSITION XCOORD ← 0 YCOORD ←(if SCROLLABLE then (TIMES (DIFFERENCE \DINFO.MAX.MENU.LEN LENGTH) (fetch (MENU ITEMHEIGHT) of MENU)) else 0)) T) (ATTACHWINDOW WINDOW DINFOW (QUOTE BOTTOM)) (REDISPLAYW WINDOW) (DINFO.SETQ SUBNODE.MENU.WINDOW WINDOW) (LET [(BITS (fetch (REGION BOTTOM) of (WINDOWPROP (DINFO.GETQ SUBNODE.MENU.WINDOW) (QUOTE REGION] (AND (ILESSP BITS 0) (RELMOVEW DINFOW (create POSITION XCOORD ← 0 YCOORD ←(IDIFFERENCE 0 BITS]) (DINFO.TOGGLE.MENU [LAMBDA (ITEM) (* drc: "21-Aug-85 19:45") (if (FM.ITEMPROP ITEM (QUOTE STATE)) then (DINFO.UPDATE.MENU.DISPLAY (DINFO.GETQ CURRENT.GRAPH) (fetch CURRENTNODE of (DINFO.GETQ CURRENT.GRAPH))) else (DETACHWINDOW (DINFO.GETQ SUBNODE.MENU.WINDOW)) (CLOSEW (DINFO.GETQ SUBNODE.MENU.WINDOW]) (DINFO.UPDATE.HISTORY.DISPLAY [LAMBDA (NODE SEL) (* drc: " 4-Sep-85 09:24") (LET* ((OLDWINDOW (DINFO.GETQ HISTORY.MENU.WINDOW)) (NEWITEM (if SEL then (LIST (CAR SEL) (BQUOTE (DINFO.UPDATE (QUOTE , NODE) (QUOTE , SEL))) "Will lookup this term in IRM") else (LIST (fetch (DINFONODE LABEL) of NODE) (BQUOTE (DINFO.UPDATE (QUOTE , NODE))) "Will visit this node"))) [ITEMS (DINFO.SETQ HISTORY.ITEMS (if NEWITEM then (CONS NEWITEM (for ITEM in (DINFO.GETQ HISTORY.ITEMS) as I from 2 to DINFO.HISTORY.LENGTH collect ITEM)) else (DINFO.GETQ HISTORY.ITEMS] (MENU (create MENU TITLE ← "History" CENTERFLG ← T MENUCOLUMNS ← 1 ITEMS ← ITEMS))) (AND OLDWINDOW (PROGN (DETACHWINDOW OLDWINDOW) (CLOSEW OLDWINDOW))) (AND ITEMS (WINDOWPROP (DINFO.SETQ HISTORY.MENU.WINDOW (ATTACHMENU MENU DINFOW (QUOTE LEFT) (QUOTE TOP))) (QUOTE REJECTMAINCOMS) (QUOTE (SHAPEW]) (DINFO.TOGGLE.HISTORY [LAMBDA (ITEM) (* drc: "26-Aug-85 21:15") (if (FM.ITEMPROP ITEM (QUOTE STATE)) then (DINFO.UPDATE.HISTORY.DISPLAY (fetch (DINFOGRAPH CURRENTNODE) of (DINFO.GETQ CURRENT.GRAPH))) else (DETACHWINDOW (DINFO.GETQ HISTORY.MENU.WINDOW)) (CLOSEW (DINFO.GETQ HISTORY.MENU.WINDOW]) ) (* Interface to GRAPHER) (DEFINEQ (DINFO.UPDATE.GRAPH.DISPLAY [LAMBDA (DINFO.GRAPH NODE) (* drc: " 4-Sep-85 11:32") (LET* [GRAPHER.GRAPH [GRAPH.WINDOW (OR (DINFO.GETQ GRAPH.WINDOW) (DINFO.SETQ GRAPH.WINDOW (CREATEW (create REGION HEIGHT ← 100 WIDTH ← 100 BOTTOM ←(fetch YCOORD of DINFOGRAPHWINDOWPOSITION) LEFT ←(fetch YCOORD of DINFOGRAPHWINDOWPOSITION)) "DInfo Graph" NIL T] (NODELST (fetch (DINFOGRAPH NODELST) of DINFO.GRAPH)) (CHILDREN (for ID in (fetch (DINFONODE CHILDREN) of NODE) collect (FASSOC ID NODELST))) [CHILD.GRAPHER.NODES (for CHILD in CHILDREN collect (create GRAPHNODE NODEID ← CHILD NODELABEL ←(fetch (DINFONODE LABEL) of CHILD] (GRAPHER.NODE (create GRAPHNODE NODELABELSHADE ← BLACKSHADE NODEID ← NODE TONODES ← CHILDREN NODELABEL ←(fetch (DINFONODE LABEL) of NODE] (if (fetch (DINFONODE PARENT) of NODE) then (LET* ((PARENT (FASSOC (fetch (DINFONODE PARENT) of NODE) NODELST)) (SIBLINGS (for ID in (fetch (DINFONODE CHILDREN) of PARENT) collect (FASSOC ID NODELST))) [SIBLING.GRAPHER.NODES (for SIBLING in SIBLINGS collect (if (EQ SIBLING NODE) then GRAPHER.NODE else (create GRAPHNODE NODEID ← SIBLING NODELABEL ←(fetch (DINFONODE LABEL) of SIBLING] (PARENT.GRAPHER.NODE (create GRAPHNODE NODEID ← PARENT NODELABEL ←(fetch (DINFONODE LABEL) of PARENT) TONODES ← SIBLINGS))) (SETQ GRAPHER.GRAPH (LAYOUTGRAPH (CONS PARENT.GRAPHER.NODE (NCONC SIBLING.GRAPHER.NODES CHILD.GRAPHER.NODES)) (LIST PARENT) NIL MENUFONT))) else (SETQ GRAPHER.GRAPH (LAYOUTGRAPH (CONS GRAPHER.NODE CHILD.GRAPHER.NODES) (LIST NODE) NIL MENUFONT))) (SHOWGRAPH GRAPHER.GRAPH [LET ((WINDOW.REGION (WINDOWPROP GRAPH.WINDOW (QUOTE REGION))) (GRAPH.REGION (GRAPHREGION GRAPHER.GRAPH))) (SHAPEW GRAPH.WINDOW (create REGION LEFT ←(fetch (REGION LEFT) of WINDOW.REGION) BOTTOM ←(fetch (REGION BOTTOM) of WINDOW.REGION) HEIGHT ←(HEIGHTIFWINDOW (fetch (REGION HEIGHT) of GRAPH.REGION) T) WIDTH ←(WIDTHIFWINDOW (fetch (REGION WIDTH) of GRAPH.REGION] (FUNCTION DINFO.UPDATE.FROM.GRAPH]) (DINFO.UPDATE.FROM.GRAPH [LAMBDA (GRAPHER.NODE GRAPH.WINDOW) (* drc: " 4-Sep-85 11:26") (AND GRAPHER.NODE (ADD.PROCESS [BQUOTE (DINFO.UPDATE (QUOTE , (fetch (GRAPHNODE NODEID) of GRAPHER.NODE] (QUOTE NAME) "DInfo From Graph"]) (DINFO.TOGGLE.GRAPH [LAMBDA (ITEM) (* drc: "21-Aug-85 19:52") (LET ((GRAPH (DINFO.GETQ CURRENT.GRAPH))) (if (FM.ITEMPROP ITEM (QUOTE STATE)) then (DINFO.UPDATE.GRAPH.DISPLAY GRAPH (fetch CURRENTNODE of GRAPH)) else (CLOSEW (DINFO.GETQ GRAPH.WINDOW]) ) (* Interface to TEdit) (DEFINEQ (DINFO.UPDATE.TEXT.DISPLAY [LAMBDA (GRAPH NODE SEL) (* drc: "19-Dec-85 13:03") (LET ((FILENAME (DINFO.GET.FILENAME GRAPH NODE)) (FROMBYTE (fetch (DINFONODE FROMBYTE) of NODE)) (TOBYTE (fetch (DINFONODE TOBYTE) of NODE)) (PROPS (APPEND (LIST (QUOTE READONLY) T (QUOTE NOTITLE) T (QUOTE FONT) IRM.FONT) (fetch (DINFOGRAPH TEXTPROPS) of GRAPH))) (TEXTSTREAM (WINDOWPROP DINFOW (QUOTE TEXTSTREAM))) TEXT.TRIPLE) (* Default directory and host.) [if (INFILEP FILENAME) then [OR [AND (EQUAL (SETQ TEXT.TRIPLE (LIST FILENAME FROMBYTE TOBYTE)) (WINDOWPROP DINFOW (QUOTE LAST.TEXT) TEXT.TRIPLE)) (SETQ TEXTSTREAM (WINDOWPROP DINFOW (QUOTE TEXTSTREAM] (SETQ TEXTSTREAM (PROG1 (OPENTEXTSTREAM FILENAME DINFOW FROMBYTE TOBYTE PROPS) (CLOSEF? TEXTSTREAM] (if SEL then (TEDIT.NORMALIZECARET (TEXTOBJ TEXTSTREAM) (TEDIT.SETSEL TEXTSTREAM (CADR SEL) (OR (CDDR SEL) (NCHARS (CAR SEL))) NIL T))) else (CLOSEF? TEXTSTREAM) (OPENTEXTSTREAM (CONCAT "Sorry, the documentation for this node is missing." (MKSTRING (CHARACTER (CHARCODE CR))) "Missing file is: " FILENAME) DINFOW NIL NIL (QUOTE (READONLY T] (replace TXTFILE of (TEXTOBJ DINFOW) with (WINDOWPROP DINFOW (QUOTE TITLE]) (DINFO.FIND [LAMBDA (ITEM) (* drc: " 4-Sep-85 10:44") (LET* [(W (DINFO.GETQ FMENU.WINDOW)) (EDIT.ITEM (FM.ITEMFROMID W (QUOTE FIND))) (STRING (FM.ITEMPROP EDIT.ITEM (QUOTE LABEL] [if (STRING-EQUAL STRING "") then (FM.EDITITEM EDIT.ITEM W) (SETQ STRING (FM.ITEMPROP EDIT.ITEM (QUOTE LABEL] (LET* ((TEXTSTREAM (WINDOWPROP DINFOW (QUOTE TEXTSTREAM))) (CHARNUM (TEDIT.FIND TEXTSTREAM STRING))) (COND [CHARNUM (TEDIT.NORMALIZECARET TEXTSTREAM (TEDIT.SHOWSEL TEXTSTREAM T (TEDIT.SETSEL TEXTSTREAM CHARNUM (NCHARS STRING) (QUOTE RIGHT) T] (T (TEDIT.NORMALIZECARET TEXTSTREAM (TEDIT.SETSEL TEXTSTREAM 0 0)) (printout (GETPROMPTWINDOW DINFOW) T "%"" STRING "%"" " Not found."]) (DINFO.TOGGLE.TEXT [LAMBDA (ITEM) (* drc: "13-Sep-85 10:42") (if (FM.ITEMPROP ITEM (QUOTE STATE)) then (DINFO.UPDATE.TEXT.DISPLAY (DINFO.GETQ CURRENT.GRAPH) (fetch (DINFOGRAPH CURRENTNODE) of (DINFO.GETQ CURRENT.GRAPH)) ) else (LET [(OLDTEXTSTREAM (WINDOWPROP DINFOW (QUOTE TEXTSTREAM] (TEDIT.DEACTIVATE.WINDOW DINFOW) (CLEARW DINFOW) (CLOSEF? OLDTEXTSTREAM]) (DINFO.GET.FILENAME [LAMBDA (GRAPH NODE) (* drc: "19-Dec-85 12:51") (* returns the filename of the documentation for NODE in GRAPH. Defaults HOST and DIRECTORY to that of graph) (LET ((FILE (fetch (DINFONODE FILE) of NODE))) (AND FILE (PACKFILENAME (QUOTE HOST) (OR (FILENAMEFIELD FILE (QUOTE HOST)) (fetch (DINFOGRAPH DEFAULTHOST) of GRAPH)) (QUOTE DEVICE) (OR (FILENAMEFIELD FILE (QUOTE DEVICE)) (fetch (DINFOGRAPH DEFAULTDEVICE) of GRAPH)) (QUOTE DIRECTORY) (OR (FILENAMEFIELD FILE (QUOTE DIRECTORY)) (fetch (DINFOGRAPH DEFAULTDIR) of GRAPH)) (QUOTE BODY) FILE]) ) (* Interface to HELPSYS) (DEFINEQ (DINFO.IRM.LOOKUP [LAMBDA (STRING) (* drc: "12-Sep-85 23:51") (IRM.SMART.LOOKUP (MKATOM STRING) DINFOW]) (DINFO.DISPLAY.REF [LAMBDA (REF) (* drc: "13-Sep-85 12:09") (if (EQ (fetch (DINFOGRAPH NAME) of (DINFO.GETQ CURRENT.GRAPH)) (QUOTE IRM)) then [LET* [(NODE (DINFO.REF.TO.NODE REF)) (SHIFT (fetch (DINFONODE FROMBYTE) of NODE)) (FROM (DIFFERENCE (fetch (IRMREFERENCE FROM#) of REF) SHIFT)) (TO# (fetch (IRMREFERENCE TO#) of REF)) (TO (AND TO# (DIFFERENCE TO# SHIFT] (DINFO.UPDATE NODE (CONS (fetch (IRMREFERENCE ITEM) of REF) (CONS FROM (AND TO (DIFFERENCE TO FROM] else (\IRM.DISPLAY.REF.SAVE REF (if (NEQ DINFOW IRMWINDOW) then IRMWINDOW else (\IRM.GET.IRMWINDOW NIL T]) (DINFO.REF.TO.NODE [LAMBDA (REF) (* drc: "26-Aug-85 23:02") (* Will return the node in the IRM DInfo graph that the text for REF is in.) (PROG ((NODES (fetch (DINFOGRAPH NODELST) of (DINFO.GETQ CURRENT.GRAPH))) (FILE (PACK* (fetch (IRMREFERENCE CHAPTER) of REF) ".TXT")) (IRM.BYTE (fetch (IRMREFERENCE FROM#) of REF)) DINFO.BYTE NODE) LOOP(OR (SETQ NODE (CAR NODES)) (ERROR "NODE NOT FOUND")) (SETQ DINFO.BYTE (fetch (DINFONODE FROMBYTE) of NODE)) (SETQ NODES (CDR NODES)) (if (AND (EQ FILE (fetch (DINFONODE FILE) of NODE)) (AND DINFO.BYTE (LEQ DINFO.BYTE IRM.BYTE))) then (RETURN NODE) else (GO LOOP]) ) (* Provide hooks for implementors) (DEFINEQ (DINFO.BUTTONEVENTFN [LAMBDA (WINDOW) (* drc: "12-Sep-85 23:38") (TOTOPW WINDOW) (AND (MOUSESTATE (ONLY MIDDLE)) (LET* [(GRAPH (DINFO.GETQ CURRENT.GRAPH)) (GRAPH.EDITFN (fetch (DINFOGRAPH EDITFN) of GRAPH)) (EDITFN (if (FGETD GRAPH.EDITFN) then GRAPH.EDITFN else (FUNCTION DINFO.DEFAULT.EDITFN] (ADD.PROCESS (LIST EDITFN (KWOTE GRAPH]) (DINFO.DEFAULT.EDITFN [LAMBDA (GRAPH) (* drc: "10-Sep-85 23:10") (SELECTQ [MENU (CREATE MENU ITEMS ←(BQUOTE (("Inspect Current DInfo Graph" (QUOTE GRAPH)) ("Inspect Current DInfo Node" (QUOTE NODE] (GRAPH (INSPECT GRAPH (QUOTE DINFOGRAPH))) (NODE (INSPECT (FETCH (DINFOGRAPH CURRENTNODE) OF GRAPH) (QUOTE DINFONODE))) NIL]) (DINFO.DEFAULT.LOOKUPFN [LAMBDA (STRING GRAPH) (* drc: "12-Sep-85 23:55") (PRINTOUT (GETPROMPTWINDOW DINFOW) T "The " (fetch (DINFOGRAPH NAME) of GRAPH) " graph has no LOOKUPFN."]) ) (ADDTOVAR BackgroundMenuCommands (DInfo [QUOTE (ADD.PROCESS (QUOTE (DINFO] "Open a DInfo window for browsing documentation.")) (RPAQQ BackgroundMenu NIL) (RPAQ? DINFOW ) (RPAQ? DINFO.INIT.FILE.NAME ) (RPAQ? DINFOGRAPHWINDOWPOSITION (CREATE POSITION XCOORD ← 1 YCOORD ← 1)) (RPAQ? DINFOMODES (QUOTE (GRAPH TEXT))) (RPAQ? DINFO.HISTORY.LENGTH 10) (RPAQ? \DINFO.MAX.MENU.LEN 10) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS DINFOW DINFO.INIT.FILE.NAME DINFOGRAPHWINDOWPOSITION DINFOMODES DINFO.HISTORY.LENGTH \DINFO.MAX.MENU.LEN) ) (PUTPROPS DINFO COPYRIGHT ("Xerox Corporation" 1985 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (2519 10836 (DINFO 2529 . 3185) (DINFO.UPDATE 3187 . 5157) (DINFO.INIT 5159 . 7035) ( DINFO.READ.GRAPH 7037 . 8915) (DINFO.WRITE.GRAPH 8917 . 9270) (DINFO.CHANGE.GRAPHS 9272 . 10143) ( DINFO.QUIT 10145 . 10395) (DINFO.RESET 10397 . 10834)) (10868 17554 (DINFO.ADD.FMENU 10878 . 11222) ( DINFO.CREATE.FMENU 11224 . 13755) (DINFO.UPDATE.FMENU 13757 . 14730) (DINFO.SPECIAL.UPDATE 14732 . 15901) (DINFO.LOOKUP 15903 . 16615) (DINFO.CHOOSE.GRAPH 16617 . 17552)) (17588 21941 ( DINFO.UPDATE.MENU.DISPLAY 17598 . 19820) (DINFO.TOGGLE.MENU 19822 . 20254) ( DINFO.UPDATE.HISTORY.DISPLAY 20256 . 21519) (DINFO.TOGGLE.HISTORY 21521 . 21939)) (21975 25629 ( DINFO.UPDATE.GRAPH.DISPLAY 21985 . 24942) (DINFO.UPDATE.FROM.GRAPH 24944 . 25255) (DINFO.TOGGLE.GRAPH 25257 . 25627)) (25661 29764 (DINFO.UPDATE.TEXT.DISPLAY 25671 . 27372) (DINFO.FIND 27374 . 28341) ( DINFO.TOGGLE.TEXT 28343 . 28856) (DINFO.GET.FILENAME 28858 . 29762)) (29798 31755 (DINFO.IRM.LOOKUP 29808 . 29984) (DINFO.DISPLAY.REF 29986 . 30821) (DINFO.REF.TO.NODE 30823 . 31753)) (31799 33007 ( DINFO.BUTTONEVENTFN 31809 . 32278) (DINFO.DEFAULT.EDITFN 32280 . 32747) (DINFO.DEFAULT.LOOKUPFN 32749 . 33005))))) STOP