(FILECREATED "11-Nov-86 14:12:21" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH143.;2 3486   

      changes to:  (VARS RHTPATCH143COMS)
		   (FNS NCP.TitleSearch)

      previous date: "11-Nov-86 12:38:59" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH143.;1)


(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT RHTPATCH143COMS)

(RPAQQ RHTPATCH143COMS ((* * Fix to stackoverflow problem in NCP.TitleSearch)
			  (* * Change to NCPROGINT)
			  (FNS NCP.TitleSearch NCP.RenameLinkType)))
(* * Fix to stackoverflow problem in NCP.TitleSearch)

(* * Change to NCPROGINT)

(DEFINEQ

(NCP.TitleSearch
  (LAMBDA (NoteFile Keys CaseSensitiveFlg)                   (* rht: "11-Nov-86 12:38")

          (* * Return a list of all cards which contain each string of Args within their titles.)



          (* * rht 11/18/85: Updated to handle new notefile and card object formats. Note that first arg is now expected to 
	  be a notefile.)



          (* * kirk 26Jun86 Added BLOCK)



          (* * rht 7/12/86: Cleaned up a bit.)



          (* * rht 7/14/86: Now takes 3 args instead of unlimited number and accepts CaseSensitiveFlg.)



          (* * rht 11/11/86: Took out ENV args to FUNCTION because they seemed to be causing stack overflows.)


    (AND (NCP.OpenNoteFileP NoteFile)
	   (NCP.MapCards NoteFile (FUNCTION (LAMBDA (Card)
			     Card))
			 (if CaseSensitiveFlg
			     then (FUNCTION (LAMBDA (Card)
					(LET ((Title (NCP.CardTitle Card)))
					     (for Key in (MKLIST Keys) always (STRPOS
											Key Title)))))
			   else (FUNCTION (LAMBDA (Card)
				      (LET ((Title (NCP.CardTitle Card)))
				           (for Key in (MKLIST Keys)
					      always (STRPOS (U-CASE Key)
								 (U-CASE Title)))))))))))

(NCP.RenameLinkType
  (LAMBDA (OldLinkType NewLinkType NoteFile)                 (* rht: "11-Nov-86 14:08")

          (* * Renames all instances of links with OldLinkType to be NewLabel. And deletes the old label OldLabel.
	  If NewLinkType doesn't exist, create it.)



          (* * rht 11/18/85: Updated to handle new notefile and card object formats.)



          (* * rht 11/11/86: Took out ENV args to FUNCTION because they seemed to be causing stack overflows.)


    (LET ((LinkTypes (NCP.LinkTypes NoteFile)))
         (COND
	   ((NOT (FMEMB OldLinkType LinkTypes))
	     (NCP.ReportError "No such link type: " OldLinkType ".")
	     NIL)
	   ((FMEMB OldLinkType NC.SystemLinkLabels)
	     (NCP.ReportError "Can't rename system link type: " OldLinkType ".")
	     NIL)
	   ((FMEMB NewLinkType NC.SystemLinkLabels)
	     (NCP.ReportError "Can't rename with a system link type: " NewLinkType ".")
	     NIL)
	   (T (COND
		((NOT (FMEMB NewLinkType LinkTypes))
		  (NCP.CreateLinkType NewLinkType NoteFile)))
                                                             (* Map down all links, relabeling as appropriate.)
	      (NCP.MapLinks NoteFile (FUNCTION (LAMBDA (Link)
				(COND
				  ((EQ OldLinkType (fetch (Link Label) of Link))
				    (NCP.LinkType Link NewLinkType))))))
	      (NC.StoreLinkLabels NoteFile (REMOVE OldLinkType (NCP.UserLinkTypes NoteFile)))
	      NewLinkType)))))
)
(PUTPROPS RHTPATCH143 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (598 3404 (NCP.TitleSearch 608 . 1881) (NCP.RenameLinkType 1883 . 3402)))))
STOP