(FILECREATED "22-Mar-85 11:06:28" {PHYLUM}<NOTECARDS>RELEASE1.2>LIBRARY>NCKEYS.;2 5364 changes to: (FNS NCKI.CommandDispatch) previous date: " 7-Feb-85 20:32:43" {PHYLUM}<NOTECARDS>RELEASE1.2>LIBRARY>NCKEYS.;1) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT NCKEYSCOMS) (RPAQQ NCKEYSCOMS ((GLOBALVARS NCKI.CardRegionOrPosition NCKI.LastCardRetrieved) (VARS (NCKI.LastCardRetrieved NIL)) (INITVARS (NCKI.CardRegionOrPosition (create POSITION XCOORD ← 20 YCOORD ← 550))) (FNS NCKI.CommandDispatch NCKI.FindCard NCKI.ParsePath NCKI.QuitCard NCKI.RetrieveCard) (LISPXMACROS > < ?))) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS NCKI.CardRegionOrPosition NCKI.LastCardRetrieved) ) (RPAQQ NCKI.LastCardRetrieved NIL) (RPAQ? NCKI.CardRegionOrPosition (create POSITION XCOORD ← 20 YCOORD ← 550)) (DEFINEQ (NCKI.CommandDispatch (LAMBDA (Command CommandList) (* fgh: "22-Mar-85 11:05") (* * Dispatch the LISPX command line to the appropriate routines) (COND ((EQ Command (QUOTE RETRIEVE)) (COND ((NOT (NCP.CurrentNoteFile)) "Error: No open NoteFile") (T (NCKI.RetrieveCard (CAR CommandList))))) ((EQ Command (QUOTE QUIT)) (COND ((NOT (NCP.CurrentNoteFile)) "Error: No open NoteFile") (T (NCKI.QuitCard (CAR CommandList))))) ((EQ Command (QUOTE OPEN)) (COND ((NCP.CurrentNoteFile) "Error: There is already an open NoteFile") (T (NCP.OpenNoteFile (CAR CommandList) T)))) ((EQ Command (QUOTE CLOSE)) (COND ((NOT (NCP.CurrentNoteFile)) "Error: No open NoteFile") (T (NCP.CloseNoteFile)))) ((FMEMB Command (QUOTE (CHECKPOINT CHKPT CHECK))) (COND ((NOT (NCP.CurrentNoteFile)) "Error: No open NoteFile") (T (NCP.CheckpointSession))))))) (NCKI.FindCard (LAMBDA (RootCard PathList) (* fgh: " 4-Feb-85 12:53") (* * Finds the card specified by PathList starting at the RootCard) (PROG (Result HitList (RootLinks (NCP.GetLinks (LIST RootCard) NIL (QUOTE (FiledCard SubBox)))) (PathHead (CAR PathList))) (SETQ HitList (for Link in RootLinks when (OR (STREQUAL (NCP.CardTitle ( NCP.GetLinkDestination Link)) PathHead) (STRPOS PathHead (NCP.CardTitle ( NCP.GetLinkDestination Link)))) collect (NCP.GetLinkDestination Link))) (COND ((NULL HitList) (COND ((NULL RootLinks) (RETURN NIL)) (T (RETURN (for Link in RootLinks when (SETQ Result (NCKI.FindCard ( NCP.GetLinkDestination Link) PathList)) do (RETURN Result)))))) ((NULL (CDR PathList)) (RETURN (CAR HitList))) (T (RETURN (for Card in HitList when (SETQ Result (NCKI.FindCard Card (CDR PathList))) do (RETURN Result)))))))) (NCKI.ParsePath (LAMBDA (Path) (* fgh: " 4-Feb-85 11:40") (* * Parses a path of the form X/Y/Z into a list of names {X Y Z}) (PROG ((UnpackedPath (UNPACK Path))) (RETURN (while UnpackedPath collect (PROG1 (MKSTRING (PACK (for Letter in UnpackedPath until (EQ Letter (QUOTE /)) collect (SETQ UnpackedPath (CDR UnpackedPath)) Letter))) (SETQ UnpackedPath (CDR UnpackedPath)))))))) (NCKI.QuitCard (LAMBDA (CardTitle) (* fgh: " 4-Feb-85 18:18") (* * comment) (PROG (Card) (COND (CardTitle (NCP.DeactivateCards (for Window in (OPENWINDOWS) when (AND (SETQ Card (NCP.CardFromWindow Window)) (STRPOS (MKSTRING CardTitle) (NCP.CardTitle Card))) collect Card))) (T (AND NCKI.LastCardRetrieved (NCP.DeactivateCards (LIST NCKI.LastCardRetrieved))) (SETQ NCKI.LastCardRetrieved))) (RETURN (QUOTE Done))))) (NCKI.RetrieveCard (LAMBDA (PathName) (* fgh: " 4-Feb-85 18:07") (* * Brings up card specified by Pathname from currently open NoteFile) (PROG (Card (PathList (NCKI.ParsePath PathName))) (SETQ Card (NCKI.FindCard (QUOTE NC00001) PathList)) (COND (Card (NCP.BringUpCard Card NCKI.CardRegionOrPosition) (SETQ NCKI.LastCardRetrieved Card))) (RETURN (COND (Card (QUOTE Done)) (T (QUOTE NotFound))))))) ) (ADDTOVAR LISPXMACROS (> (NCKI.CommandDispatch (QUOTE RETRIEVE) LISPXLINE)) (< (NCKI.CommandDispatch (QUOTE QUIT) LISPXLINE)) (? (NCKI.CommandDispatch (CAR LISPXLINE) (CDR LISPXLINE)))) (PUTPROPS NCKEYS COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (891 5044 (NCKI.CommandDispatch 901 . 2015) (NCKI.FindCard 2017 . 3220) (NCKI.ParsePath 3222 . 3820) (NCKI.QuitCard 3822 . 4465) (NCKI.RetrieveCard 4467 . 5042))))) STOP